Bladeren bron

超级厨师

zh 9 maanden geleden
commit
a42f99fb0e
100 gewijzigde bestanden met toevoegingen van 5207 en 0 verwijderingen
  1. BIN
      .DS_Store
  2. BIN
      ICON02.png
  3. 12 0
      assets/Script.meta
  4. 166 0
      assets/Script/Beef.ts
  5. 9 0
      assets/Script/Beef.ts.meta
  6. 39 0
      assets/Script/Enemy.ts
  7. 9 0
      assets/Script/Enemy.ts.meta
  8. 12 0
      assets/Script/Framework.meta
  9. 12 0
      assets/Script/Framework/Config.meta
  10. 82 0
      assets/Script/Framework/Config/ConfigConst.ts
  11. 9 0
      assets/Script/Framework/Config/ConfigConst.ts.meta
  12. 20 0
      assets/Script/Framework/Config/ServerInfo.ts
  13. 9 0
      assets/Script/Framework/Config/ServerInfo.ts.meta
  14. 12 0
      assets/Script/Framework/Const.meta
  15. 102 0
      assets/Script/Framework/Const/EnumDefine.ts
  16. 9 0
      assets/Script/Framework/Const/EnumDefine.ts.meta
  17. 12 0
      assets/Script/Framework/Library.meta
  18. 12 0
      assets/Script/Framework/Library/Encrypt.meta
  19. 209 0
      assets/Script/Framework/Library/Encrypt/algo.js
  20. 9 0
      assets/Script/Framework/Library/Encrypt/algo.js.meta
  21. 351 0
      assets/Script/Framework/Library/Encrypt/encryptjs.js
  22. 9 0
      assets/Script/Framework/Library/Encrypt/encryptjs.js.meta
  23. 12 0
      assets/Script/Framework/Manager.meta
  24. 150 0
      assets/Script/Framework/Manager/ConfigDataMgr.ts
  25. 9 0
      assets/Script/Framework/Manager/ConfigDataMgr.ts.meta
  26. 493 0
      assets/Script/Framework/Manager/DataManager.ts
  27. 9 0
      assets/Script/Framework/Manager/DataManager.ts.meta
  28. 12 0
      assets/Script/Framework/UserData.meta
  29. 74 0
      assets/Script/Framework/UserData/DailyTask.ts
  30. 9 0
      assets/Script/Framework/UserData/DailyTask.ts.meta
  31. 48 0
      assets/Script/Framework/UserData/WelFare.ts
  32. 9 0
      assets/Script/Framework/UserData/WelFare.ts.meta
  33. 12 0
      assets/Script/Framework/Utils.meta
  34. 36 0
      assets/Script/Framework/Utils/DateUtil.ts
  35. 9 0
      assets/Script/Framework/Utils/DateUtil.ts.meta
  36. 171 0
      assets/Script/Framework/Utils/LocalStorageUtil.ts
  37. 9 0
      assets/Script/Framework/Utils/LocalStorageUtil.ts.meta
  38. 29 0
      assets/Script/Framework/Utils/LogUtil.ts
  39. 9 0
      assets/Script/Framework/Utils/LogUtil.ts.meta
  40. 47 0
      assets/Script/Framework/Utils/NumberUtil.ts
  41. 9 0
      assets/Script/Framework/Utils/NumberUtil.ts.meta
  42. 39 0
      assets/Script/Framework/Utils/Singleton.ts
  43. 9 0
      assets/Script/Framework/Utils/Singleton.ts.meta
  44. 19 0
      assets/Script/Framework/Utils/TimeUtil.ts
  45. 9 0
      assets/Script/Framework/Utils/TimeUtil.ts.meta
  46. 85 0
      assets/Script/LoadScene.ts
  47. 9 0
      assets/Script/LoadScene.ts.meta
  48. 18 0
      assets/Script/LowSpeed.ts
  49. 9 0
      assets/Script/LowSpeed.ts.meta
  50. 12 0
      assets/Script/Manager.meta
  51. 37 0
      assets/Script/Manager/AnimData.ts
  52. 9 0
      assets/Script/Manager/AnimData.ts.meta
  53. 81 0
      assets/Script/Manager/App.ts
  54. 9 0
      assets/Script/Manager/App.ts.meta
  55. 21 0
      assets/Script/Manager/DragonAnim.ts
  56. 9 0
      assets/Script/Manager/DragonAnim.ts.meta
  57. 164 0
      assets/Script/Manager/DragonManager.ts
  58. 9 0
      assets/Script/Manager/DragonManager.ts.meta
  59. 50 0
      assets/Script/Manager/EffectUtils.ts
  60. 9 0
      assets/Script/Manager/EffectUtils.ts.meta
  61. 87 0
      assets/Script/Manager/GameInfo.ts
  62. 9 0
      assets/Script/Manager/GameInfo.ts.meta
  63. 40 0
      assets/Script/Manager/LayerManager.ts
  64. 9 0
      assets/Script/Manager/LayerManager.ts.meta
  65. 19 0
      assets/Script/Manager/SingleClass.ts
  66. 9 0
      assets/Script/Manager/SingleClass.ts.meta
  67. 200 0
      assets/Script/Manager/SoundManager.ts
  68. 9 0
      assets/Script/Manager/SoundManager.ts.meta
  69. 51 0
      assets/Script/Manager/SpinManager.ts
  70. 9 0
      assets/Script/Manager/SpinManager.ts.meta
  71. 130 0
      assets/Script/Manager/TipsManager.ts
  72. 9 0
      assets/Script/Manager/TipsManager.ts.meta
  73. 45 0
      assets/Script/Manager/XButton.ts
  74. 9 0
      assets/Script/Manager/XButton.ts.meta
  75. 40 0
      assets/Script/Manager/XProcess.ts
  76. 9 0
      assets/Script/Manager/XProcess.ts.meta
  77. 30 0
      assets/Script/Notification.ts
  78. 9 0
      assets/Script/Notification.ts.meta
  79. 189 0
      assets/Script/Person.ts
  80. 9 0
      assets/Script/Person.ts.meta
  81. 454 0
      assets/Script/Table.ts
  82. 9 0
      assets/Script/Table.ts.meta
  83. 111 0
      assets/Script/TimeControl.ts
  84. 9 0
      assets/Script/TimeControl.ts.meta
  85. 12 0
      assets/Script/command.meta
  86. 15 0
      assets/Script/endPoint.ts
  87. 9 0
      assets/Script/endPoint.ts.meta
  88. 328 0
      assets/Script/gameScene.ts
  89. 9 0
      assets/Script/gameScene.ts.meta
  90. 12 0
      assets/Script/guide.meta
  91. 40 0
      assets/Script/guide/guidePanel.ts
  92. 9 0
      assets/Script/guide/guidePanel.ts.meta
  93. 256 0
      assets/Script/hallScene.ts
  94. 9 0
      assets/Script/hallScene.ts.meta
  95. 43 0
      assets/Script/hallSceneMediator.ts
  96. 9 0
      assets/Script/hallSceneMediator.ts.meta
  97. 12 0
      assets/Script/model.meta
  98. 19 0
      assets/Script/model/NotifyModel.ts
  99. 9 0
      assets/Script/model/NotifyModel.ts.meta
  100. 45 0
      assets/Script/model/hallModel.ts

BIN
.DS_Store


BIN
ICON02.png


+ 12 - 0
assets/Script.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "9149b43a-5fdc-4a97-94aa-64868c9ed63d",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 166 - 0
assets/Script/Beef.ts

@@ -0,0 +1,166 @@
+
+import guidePanel from "./guide/guidePanel";
+import { App } from "./Manager/App";
+import { SoundManager } from "./Manager/SoundManager";
+
+
+const {ccclass, property} = cc._decorator;
+
+
+export enum BeefState {
+    Raw,     //生的
+    Cooked,    //熟的
+    Burnt,     //焦了
+    Plate,     //盘子
+    YellowSouce, 
+    Cocumber,
+    Tomato,
+    RedSouce,
+}
+
+export enum FoodType {
+    None = 0,
+    Drink,
+    PureSteak,
+    CocumberSteak,
+    TomatoSteak,
+    YellowSteak,
+    RedSteak,    
+};
+
+@ccclass
+export default class Beef extends cc.Component {
+
+    // 牛肉
+    @property([cc.SpriteFrame])
+    beefs: cc.SpriteFrame[] = [];
+
+    // // 黄瓜
+    // @property([cc.SpriteFrame])
+    // huangGua: cc.SpriteFrame[] = [];
+
+    // // 番茄
+    // @property([cc.SpriteFrame])
+    // tomato: cc.SpriteFrame[] = [];
+
+    // // 芝士
+    // @property([cc.SpriteFrame])
+    // Cheese: cc.SpriteFrame[] = [];
+
+    // // 番茄酱
+    // @property([cc.SpriteFrame])
+    // fanQieJiang: cc.SpriteFrame[] = [];
+
+
+
+    @property(cc.Sprite)
+    spBeef: cc.Sprite = null;
+
+    @property(cc.Node)
+    nodeCocumber: cc.Node = null;
+
+    @property(cc.Node)
+    nodeTomato: cc.Node = null;
+
+    @property(cc.Node)
+    nodeYellowSouce: cc.Node = null;
+
+    @property(cc.Node)
+    nodeRedSouce: cc.Node = null;
+
+    @property(cc.ProgressBar)
+    pBarCooked: cc.ProgressBar = null;
+
+    @property(cc.ProgressBar)
+    pBarBurnt: cc.ProgressBar = null;
+
+    public m_state = BeefState.Raw;
+    public m_foodType = FoodType.None;
+
+    private m_cookedTime = 3; 
+    private m_burntTime = 3; 
+    private m_pause = false;
+
+    onLoad () {
+
+    }
+
+    start () {
+        this.setState(BeefState.Raw);
+    }
+
+    public setState(state: BeefState){
+        this.m_state = state;
+        switch(this.m_state){
+
+            case BeefState.Raw:
+                cc.tween(this.pBarCooked).to(this.m_cookedTime, {progress: 1}).call(()=>{
+                    this.setState(BeefState.Cooked);
+                }).start();
+
+            break;
+
+            case BeefState.Cooked:
+                this.spBeef.spriteFrame = this.beefs[1];
+                this.pBarCooked.node.active = false;
+                this.pBarBurnt.node.active = true;
+
+                if(App.DataManager.guideStep == 1){                    
+                    guidePanel.getInstance().showCurGuide();
+                }
+
+                cc.tween(this.pBarBurnt).to(this.m_burntTime, {progress: 1}).call(()=>{
+                    this.setState(BeefState.Burnt);
+                }).start();
+                
+                App.SoundManager.playEffect(SoundManager.cookingOver);
+            break;
+                        
+            case BeefState.Burnt:
+                this.pBarCooked.node.active = false;
+                this.pBarBurnt.node.active = false;
+                this.spBeef.spriteFrame = this.beefs[2];
+            break;
+
+            case BeefState.Plate:
+                cc.Tween.stopAllByTarget(this.pBarCooked);
+                cc.Tween.stopAllByTarget(this.pBarBurnt);
+                this.pBarCooked.node.active = false;
+                this.pBarBurnt.node.active = false;
+
+                this.m_foodType = FoodType.PureSteak;
+            break;
+
+            case BeefState.YellowSouce:
+                this.nodeYellowSouce.active = true;
+                this.m_foodType = FoodType.YellowSteak;
+            break; 
+
+            case BeefState.Cocumber:
+                this.nodeCocumber.active = true;
+                this.m_foodType = FoodType.CocumberSteak;
+            break;
+
+            case BeefState.Tomato:
+                this.nodeTomato.active = true;
+                this.m_foodType = FoodType.TomatoSteak;
+            break;
+
+            case BeefState.RedSouce:
+                this.nodeRedSouce.active = true;
+                this.m_foodType = FoodType.RedSteak;
+            break;
+        }
+    }
+    
+    update (dt) {
+        if(!this.m_pause){
+            if(this.m_state == BeefState.Raw){
+                this.m_cookedTime -= dt;
+            }
+            else if(this.m_state == BeefState.Cooked){
+                this.m_burntTime -= dt;
+            }
+        }        
+    }
+}

+ 9 - 0
assets/Script/Beef.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "3346e31b-f7c4-4e65-95a3-5a030b645ce9",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 39 - 0
assets/Script/Enemy.ts

@@ -0,0 +1,39 @@
+
+import DragonAnim from "./Manager/DragonAnim";
+import { AnimData } from "./Manager/AnimData";
+import gameScene from "./gameScene";
+import player from "./player";
+import { App } from "./Manager/App";
+import { SoundManager } from "./Manager/SoundManager";
+
+
+const {ccclass, property} = cc._decorator;
+
+
+@ccclass
+export default class Enemy extends cc.Component {
+
+ 
+
+    onLoad () {
+
+    }
+
+    start () {
+
+    }
+
+    onBeginContact(contact: cc.PhysicsContact, selfCollider: cc.PhysicsCollider, otherCollider: cc.PhysicsCollider): void{
+
+        
+    }    
+
+    enemyDie(selfCollider: cc.PhysicsCollider, otherCollider: cc.PhysicsCollider){
+
+       
+    }
+
+    update(){
+        
+    }
+}

+ 9 - 0
assets/Script/Enemy.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "0a850f57-1f8a-4925-a557-8a8555cc725a",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 12 - 0
assets/Script/Framework.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "d49351c5-3f3f-40aa-b4fb-74ebb7c1c544",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 12 - 0
assets/Script/Framework/Config.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "9a394977-e393-43b0-b87e-69e78123d51e",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 82 - 0
assets/Script/Framework/Config/ConfigConst.ts

@@ -0,0 +1,82 @@
+
+/******  配置类  ******/
+export class nick {
+    /******  昵称  ******/
+    public nick: string;
+}
+export class attr {
+    /******  狗的初始属性及各个时期成长值  ******/
+    public prop: string;
+    /******  勇气  ******/
+    public yq: number;
+    /******  智慧  ******/
+    public zh: number;
+    /******  魅力  ******/
+    public ml: number;
+}
+export class exp {
+    /******  亲密度(等级)  ******/
+    public lv: number;
+    /******  升级所需亲密值(经验)  ******/
+    public exp: number;
+}
+export class task {
+    /******  日常任务  ******/
+    public id: number;
+
+    public type: number;
+
+    public name: string;
+
+    public explain: string;
+
+    public maxNum: number;
+
+    public unit: string;
+
+    public reason: number;
+
+    public gold: number;
+
+    public img: string;
+
+    public overNum: number;
+
+    public isGet: number;
+}
+export class consume {
+    /******  狗消耗  ******/
+    public feedid: number;
+
+    public type: number;
+
+    public titleLabel: string;
+
+    public sourceImg: string;
+
+    public typeImg: string;
+
+    public descr: string;
+
+    public delAttr: string;
+
+    public reward: string;
+}
+export class fuli_day {
+    /******  福利-每日签到  ******/
+    public day: number;
+
+    public reward: number;
+
+    public status: number;
+}
+export class fuli_watch {
+    /******  福利-每日观看  ******/
+    public day: number;
+
+    public times: string;
+
+    public reward: number;
+
+    public status: number;
+}

+ 9 - 0
assets/Script/Framework/Config/ConfigConst.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "45fb626e-eeeb-46ba-a0f7-e4f0735636d5",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 20 - 0
assets/Script/Framework/Config/ServerInfo.ts

@@ -0,0 +1,20 @@
+
+export enum EPlatform {
+    Web,
+}
+
+export enum EBuildVersion {
+    Debug,
+    Release,
+}
+
+export class ServerInfo {
+    public platform: EPlatform = EPlatform.Web;
+    public buildVersion: EBuildVersion = EBuildVersion.Debug;
+    public get isRelease() {
+        if (this.buildVersion == EBuildVersion.Release)
+            return true;
+        else
+            return false;
+    }
+}

+ 9 - 0
assets/Script/Framework/Config/ServerInfo.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "82170190-563f-4fc7-8795-b0e00388a5ab",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 12 - 0
assets/Script/Framework/Const.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "c757cc62-3abc-4410-a1c6-d043490461e6",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 102 - 0
assets/Script/Framework/Const/EnumDefine.ts

@@ -0,0 +1,102 @@
+
+export enum Sex {
+    None = 0,
+    Boy = 1,
+    Girl = 2,
+}
+export enum EPlay {
+    ShuMao = 0,
+    FeiPan = 1,
+    CaiGuTou = 2,
+}
+export enum ERewardType {
+    Icon = 0,//金币
+    Feed = 1,//喂食
+    Clear = 2,//清洁
+    Active = 3,//活力
+    QingMi = 4,//亲密
+}
+export enum dogStatus {
+    None = 0,
+    Feed = 1,//喂食
+    Play = 3,//玩耍
+    Clear = 2,//清理
+}
+export enum CommunicationType {
+    Water = 1,//喂水
+    GouLiang = 2,//狗粮
+    GuanTou = 3,//罐头
+    Bone = 4,//骨头
+    ShuBao = 10,//梳毛
+    FeiPan = 11,//接飞盘
+    PlayBon = 13,//玩骨头
+    FeiZhao = 5,//肥皂
+    XiangZhao = 6,//香皂
+    XiangBo = 7,//香波
+    ShunMaoGao = 8,//顺毛膏
+}
+
+/** 年龄段 */
+export enum EAgeGroup {
+    /**幼年阶段 */
+    PERIOD_KIDS = 1,
+    /**青春期阶段 */
+    PERIOD_YOUNG = 2,
+    /**成年阶段 */
+    PERIOD_GROWNUP = 3
+}
+
+/** 消耗 */
+export enum EConsume {
+    /**属性:金币 */
+    Attr_coin = 1,
+    /**属性:经验,亲密度 */
+    Attr_jingyan = 101,
+    /**属性:勇敢 */
+    Attr_yonggan = 102,
+    /**属性:智慧或聪明 */
+    Attr_congming = 103,
+    /**属性:魅力 */
+    Attr_meili = 104,
+    /**属性:体力或者饥饿 */
+    Attr_tili = 201,
+    /**属性:心情 */
+    Attr_xinqing = 202,
+    /**属性:卫生或清洁 */
+    Attr_weisheng = 203,
+    /**属性:屎 */
+    Attr_shi = 301
+}
+
+// /**1 心情值降低 */
+// public static readonly DOG_OUT_EVENT_SAD: number = 1;
+// /**2 丢失金币 */
+// public static readonly DOG_OUT_EVENT_LOST_MONEY: number = 2;
+// /**3 心情值增加 */
+// public static readonly DOG_OUT_EVENT_HAPPY: number = 3;
+// /**4 获得金币 */
+// public static readonly DOG_OUT_EVENT_GAIN_MONEY: number = 4;
+
+/** 任务ID */
+export enum ETaskID {
+    WeiShi = 27,//喂食
+    QingJie = 28,//清洁
+    WanShua = 29,//玩耍
+    WaiChu = 30,//外出
+    LeiJiXiaoHao = 31,//累计消耗
+    ZhongJiJiangLi = 32//终极奖励
+}
+export enum ETaskStatus {
+    None = 0,
+    GOTO = 1,//前往
+    Reward = 2,//领取
+    Finish = 3,//完成
+}
+
+/** 配置表中的属性字段 */
+export enum EConfigAttrProp {
+    cq_attr,
+    cq_childhood,
+    cq_youth,
+    cq_adulthood,
+}

+ 9 - 0
assets/Script/Framework/Const/EnumDefine.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "bf45390c-e9a3-440a-85bb-0dc7c17c21f2",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 12 - 0
assets/Script/Framework/Library.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "13166129-d1e3-425c-816a-0953ce988348",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 12 - 0
assets/Script/Framework/Library/Encrypt.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "c8780ffa-69a9-41ad-a16c-08f37f758886",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 209 - 0
assets/Script/Framework/Library/Encrypt/algo.js

@@ -0,0 +1,209 @@
+
+/* jshint node:true *//* global define */
+'use strict';
+
+
+/**
+ * Rijndael cipher encryption routines,
+ *
+ * Reference implementation of FIPS-197 http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf.
+ *
+ * @namespace
+ */
+var Algo = {};
+
+
+/**
+ *  Cipher function: encrypt 'input' state with Rijndael algorithm [§5.1];
+ *   applies Nr rounds (10/12/14) using key schedule w for 'add round key' stage.
+ *
+ * @param   {number[]}   input - 16-byte (128-bit) input state array.
+ * @param   {number[][]} w - Key schedule as 2D byte-array (Nr+1 x Nb bytes).
+ * @returns {number[]}   Encrypted output state array.
+ */
+Algo.cipher = function(input, w) {
+    var Nb = 4;               // block size (in words): no of columns in state
+    var Nr = w.length/Nb - 1; // no of rounds: 10/12/14 for 128/192/256-bit keys
+
+    var state = [[],[],[],[]];  // initialise 4xNb byte-array 'state' with input [§3.4]
+    for (var i=0; i<4*Nb; i++) state[i%4][Math.floor(i/4)] = input[i];
+
+    state = Algo.addRoundKey(state, w, 0, Nb);
+
+    for (var round=1; round<Nr; round++) {
+        state = Algo.subBytes(state, Nb);
+        state = Algo.shiftRows(state, Nb);
+        state = Algo.mixColumns(state, Nb);
+        state = Algo.addRoundKey(state, w, round, Nb);
+    }
+
+    state = Algo.subBytes(state, Nb);
+    state = Algo.shiftRows(state, Nb);
+    state = Algo.addRoundKey(state, w, Nr, Nb);
+
+    var output = new Array(4*Nb);  // convert state to 1-d array before returning [§3.4]
+    for (var i=0; i<4*Nb; i++) output[i] = state[i%4][Math.floor(i/4)];
+
+    return output;
+};
+
+
+/**
+ * Perform key expansion to generate a key schedule from a cipher key [§5.2].
+ *
+ * @param   {number[]}   key - Cipher key as 16/24/32-byte array.
+ * @returns {number[][]} Expanded key schedule as 2D byte-array (Nr+1 x Nb bytes).
+ */
+Algo.keyExpansion = function(key) {
+    var Nb = 4;            // block size (in words): no of columns in state
+    var Nk = key.length/4; // key length (in words): 4/6/8 for 128/192/256-bit keys
+    var Nr = Nk + 6;       // no of rounds: 10/12/14 for 128/192/256-bit keys
+
+    var w = new Array(Nb*(Nr+1));
+    var temp = new Array(4);
+
+    // initialise first Nk words of expanded key with cipher key
+    for (var i=0; i<Nk; i++) {
+        var r = [key[4*i], key[4*i+1], key[4*i+2], key[4*i+3]];
+        w[i] = r;
+    }
+
+    // expand the key into the remainder of the schedule
+    for (var i=Nk; i<(Nb*(Nr+1)); i++) {
+        w[i] = new Array(4);
+        for (var t=0; t<4; t++) temp[t] = w[i-1][t];
+        // each Nk'th word has extra transformation
+        if (i % Nk == 0) {
+            temp = Algo.subWord(Algo.rotWord(temp));
+            for (var t=0; t<4; t++) temp[t] ^= Algo.rCon[i/Nk][t];
+        }
+        // 256-bit key has subWord applied every 4th word
+        else if (Nk > 6 && i%Nk == 4) {
+            temp = Algo.subWord(temp);
+        }
+        // xor w[i] with w[i-1] and w[i-Nk]
+        for (var t=0; t<4; t++) w[i][t] = w[i-Nk][t] ^ temp[t];
+    }
+
+    return w;
+};
+
+
+/**
+ * Apply SBox to state S [§5.1.1]
+ * @private
+ */
+Algo.subBytes = function(s, Nb) {
+    for (var r=0; r<4; r++) {
+        for (var c=0; c<Nb; c++) s[r][c] = Algo.sBox[s[r][c]];
+    }
+    return s;
+};
+
+
+/**
+ * Shift row r of state S left by r bytes [§5.1.2]
+ * @private
+ */
+Algo.shiftRows = function(s, Nb) {
+    var t = new Array(4);
+    for (var r=1; r<4; r++) {
+        for (var c=0; c<4; c++) t[c] = s[r][(c+r)%Nb];  // shift into temp copy
+        for (var c=0; c<4; c++) s[r][c] = t[c];         // and copy back
+    }          // note that this will work for Nb=4,5,6, but not 7,8
+    return s;  // see asmaes.sourceforge.net/rijndael/rijndaelImplementation.pdf
+};
+
+
+/**
+ * Combine bytes of each col of state S [§5.1.3]
+ * @private
+ */
+Algo.mixColumns = function(s, Nb) {
+    for (var c=0; c<4; c++) {
+        var a = new Array(4);  // 'a' is a copy of the current column from 's'
+        var b = new Array(4);  // 'b' is a•{02} in GF(2^8)
+        for (var i=0; i<4; i++) {
+            a[i] = s[i][c];
+            b[i] = s[i][c]&0x80 ? s[i][c]<<1 ^ 0x011b : s[i][c]<<1;
+        }
+        // a[n] ^ b[n] is a•{03} in GF(2^8)
+        s[0][c] = b[0] ^ a[1] ^ b[1] ^ a[2] ^ a[3]; // {02}•a0 + {03}•a1 + a2 + a3
+        s[1][c] = a[0] ^ b[1] ^ a[2] ^ b[2] ^ a[3]; // a0 • {02}•a1 + {03}•a2 + a3
+        s[2][c] = a[0] ^ a[1] ^ b[2] ^ a[3] ^ b[3]; // a0 + a1 + {02}•a2 + {03}•a3
+        s[3][c] = a[0] ^ b[0] ^ a[1] ^ a[2] ^ b[3]; // {03}•a0 + a1 + a2 + {02}•a3
+    }
+    return s;
+};
+
+
+/**
+ * Xor Round Key into state S [§5.1.4]
+ * @private
+ */
+Algo.addRoundKey = function(state, w, rnd, Nb) {
+    for (var r=0; r<4; r++) {
+        for (var c=0; c<Nb; c++) state[r][c] ^= w[rnd*4+c][r];
+    }
+    return state;
+};
+
+
+/**
+ * Apply SBox to 4-byte word w
+ * @private
+ */
+Algo.subWord = function(w) {
+    for (var i=0; i<4; i++) w[i] = Algo.sBox[w[i]];
+    return w;
+};
+
+
+/**
+ * Rotate 4-byte word w left by one byte
+ * @private
+ */
+Algo.rotWord = function(w) {
+    var tmp = w[0];
+    for (var i=0; i<3; i++) w[i] = w[i+1];
+    w[3] = tmp;
+    return w;
+};
+
+
+// sBox is pre-computed multiplicative inverse in GF(2^8) used in subBytes and keyExpansion [§5.1.1]
+Algo.sBox =  [0x63,0x7c,0x77,0x7b,0xf2,0x6b,0x6f,0xc5,0x30,0x01,0x67,0x2b,0xfe,0xd7,0xab,0x76,
+             0xca,0x82,0xc9,0x7d,0xfa,0x59,0x47,0xf0,0xad,0xd4,0xa2,0xaf,0x9c,0xa4,0x72,0xc0,
+             0xb7,0xfd,0x93,0x26,0x36,0x3f,0xf7,0xcc,0x34,0xa5,0xe5,0xf1,0x71,0xd8,0x31,0x15,
+             0x04,0xc7,0x23,0xc3,0x18,0x96,0x05,0x9a,0x07,0x12,0x80,0xe2,0xeb,0x27,0xb2,0x75,
+             0x09,0x83,0x2c,0x1a,0x1b,0x6e,0x5a,0xa0,0x52,0x3b,0xd6,0xb3,0x29,0xe3,0x2f,0x84,
+             0x53,0xd1,0x00,0xed,0x20,0xfc,0xb1,0x5b,0x6a,0xcb,0xbe,0x39,0x4a,0x4c,0x58,0xcf,
+             0xd0,0xef,0xaa,0xfb,0x43,0x4d,0x33,0x85,0x45,0xf9,0x02,0x7f,0x50,0x3c,0x9f,0xa8,
+             0x51,0xa3,0x40,0x8f,0x92,0x9d,0x38,0xf5,0xbc,0xb6,0xda,0x21,0x10,0xff,0xf3,0xd2,
+             0xcd,0x0c,0x13,0xec,0x5f,0x97,0x44,0x17,0xc4,0xa7,0x7e,0x3d,0x64,0x5d,0x19,0x73,
+             0x60,0x81,0x4f,0xdc,0x22,0x2a,0x90,0x88,0x46,0xee,0xb8,0x14,0xde,0x5e,0x0b,0xdb,
+             0xe0,0x32,0x3a,0x0a,0x49,0x06,0x24,0x5c,0xc2,0xd3,0xac,0x62,0x91,0x95,0xe4,0x79,
+             0xe7,0xc8,0x37,0x6d,0x8d,0xd5,0x4e,0xa9,0x6c,0x56,0xf4,0xea,0x65,0x7a,0xae,0x08,
+             0xba,0x78,0x25,0x2e,0x1c,0xa6,0xb4,0xc6,0xe8,0xdd,0x74,0x1f,0x4b,0xbd,0x8b,0x8a,
+             0x70,0x3e,0xb5,0x66,0x48,0x03,0xf6,0x0e,0x61,0x35,0x57,0xb9,0x86,0xc1,0x1d,0x9e,
+             0xe1,0xf8,0x98,0x11,0x69,0xd9,0x8e,0x94,0x9b,0x1e,0x87,0xe9,0xce,0x55,0x28,0xdf,
+             0x8c,0xa1,0x89,0x0d,0xbf,0xe6,0x42,0x68,0x41,0x99,0x2d,0x0f,0xb0,0x54,0xbb,0x16];
+
+
+// rCon is Round Constant used for the Key Expansion [1st col is 2^(r-1) in GF(2^8)] [§5.2]
+Algo.rCon = [ [0x00, 0x00, 0x00, 0x00],
+             [0x01, 0x00, 0x00, 0x00],
+             [0x02, 0x00, 0x00, 0x00],
+             [0x04, 0x00, 0x00, 0x00],
+             [0x08, 0x00, 0x00, 0x00],
+             [0x10, 0x00, 0x00, 0x00],
+             [0x20, 0x00, 0x00, 0x00],
+             [0x40, 0x00, 0x00, 0x00],
+             [0x80, 0x00, 0x00, 0x00],
+             [0x1b, 0x00, 0x00, 0x00],
+             [0x36, 0x00, 0x00, 0x00] ]; 
+
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
+if (typeof module != 'undefined' && module.exports) module.exports = Algo; // CommonJs export
+if (typeof define == 'function' && define.amd) define([], function() { return Algo; }); // AMD

+ 9 - 0
assets/Script/Framework/Library/Encrypt/algo.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "7f259be4-4ed5-410c-a989-2fcac72d9004",
+  "isPlugin": true,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 351 - 0
assets/Script/Framework/Library/Encrypt/encryptjs.js

@@ -0,0 +1,351 @@
+/*!
+ * Copyright (c) 2015 Sri Harsha <sri.harsha@zenq.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+(function (name, definition) {
+    if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
+        module.exports = definition();
+    } else if (typeof define === 'function' && typeof define.amd === 'object') {
+        define(definition);
+    } else if (typeof define === 'function' && typeof define.petal === 'object') {
+        define(name, [], definition);
+    } else {
+        this[name] = definition();
+    }
+})('encryptjs', function (encryptjs) {
+    var rl;
+    //Electron doesnt support stdin, so dont setup CLI if its not available.
+    
+    encryptjs = { version: '1.0.0' };
+
+    //Right before exporting the validator object, pass each of the builtins
+    //through extend() so that their first argument is coerced to a string
+    encryptjs.init = function () {
+        console.log("--------------------Applying Encryption Algorithm------------------ ");
+    };
+    'use strict';  
+    // if (typeof module!='undefined' && module.exports) 
+    var Algo = window["Algo"] // CommonJS (Node.js)
+
+    encryptjs.encrypt = function(plaintext, password, nBits) {
+        var blockSize = 16;  // block size fixed at 16 bytes / 128 bits (Nb=4)
+        if (!(nBits==128 || nBits==192 || nBits==256)) return ''; // standard allows 128/192/256 bit keys
+        plaintext = String(plaintext).utf8Encode();
+        password = String(password).utf8Encode();
+
+        // use AES itself to encrypt password to get cipher key (using plain password as source for key
+        // expansion) - gives us well encrypted key (though hashed key might be preferred for prod'n use)
+        var nBytes = nBits/8;  // no bytes in key (16/24/32)
+        var pwBytes = new Array(nBytes);
+        for (var i=0; i<nBytes; i++) {  // use 1st 16/24/32 chars of password for key
+            pwBytes[i] = isNaN(password.charCodeAt(i)) ? 0 : password.charCodeAt(i);
+        }
+        var key = Algo.cipher(pwBytes, Algo.keyExpansion(pwBytes)); // gives us 16-byte key
+        key = key.concat(key.slice(0, nBytes-16));  // expand key to 16/24/32 bytes long
+
+        // initialise 1st 8 bytes of counter block with nonce (NIST SP800-38A �B.2): [0-1] = millisec,
+        // [2-3] = random, [4-7] = seconds, together giving full sub-millisec uniqueness up to Feb 2106
+        var counterBlock = new Array(blockSize);
+
+        var nonce = (new Date()).getTime();  // timestamp: milliseconds since 1-Jan-1970
+        var nonceMs = nonce%1000;
+        var nonceSec = Math.floor(nonce/1000);
+        var nonceRnd = Math.floor(Math.random()*0xffff);
+        // for debugging: nonce = nonceMs = nonceSec = nonceRnd = 0;
+
+        for (var i=0; i<2; i++) counterBlock[i]   = (nonceMs  >>> i*8) & 0xff;
+        for (var i=0; i<2; i++) counterBlock[i+2] = (nonceRnd >>> i*8) & 0xff;
+        for (var i=0; i<4; i++) counterBlock[i+4] = (nonceSec >>> i*8) & 0xff;
+
+        // and convert it to a string to go on the front of the ciphertext
+        var ctrTxt = '';
+        for (var i=0; i<8; i++) ctrTxt += String.fromCharCode(counterBlock[i]);
+
+        // generate key schedule - an expansion of the key into distinct Key Rounds for each round
+        var keySchedule = Algo.keyExpansion(key);
+
+        var blockCount = Math.ceil(plaintext.length/blockSize);
+        var ciphertxt = new Array(blockCount);  // ciphertext as array of strings
+
+        for (var b=0; b<blockCount; b++) {
+            // set counter (block #) in last 8 bytes of counter block (leaving nonce in 1st 8 bytes)
+            // done in two stages for 32-bit ops: using two words allows us to go past 2^32 blocks (68GB)
+            for (var c=0; c<4; c++) counterBlock[15-c] = (b >>> c*8) & 0xff;
+            for (var c=0; c<4; c++) counterBlock[15-c-4] = (b/0x100000000 >>> c*8);
+
+            var cipherCntr = Algo.cipher(counterBlock, keySchedule);  // -- encrypt counter block --
+
+            // block size is reduced on final block
+            var blockLength = b<blockCount-1 ? blockSize : (plaintext.length-1)%blockSize+1;
+            var cipherChar = new Array(blockLength);
+
+            for (var i=0; i<blockLength; i++) {  // -- xor plaintext with ciphered counter char-by-char --
+                cipherChar[i] = cipherCntr[i] ^ plaintext.charCodeAt(b*blockSize+i);
+                cipherChar[i] = String.fromCharCode(cipherChar[i]);
+            }
+            ciphertxt[b] = cipherChar.join('');
+        }
+
+        // use Array.join() for better performance than repeated string appends
+        var ciphertext = ctrTxt + ciphertxt.join('');
+        // ciphertext = ciphertext.base64Encode();
+        ciphertext = encryptjs.base64Encode(ciphertext);
+
+        return ciphertext;
+    };
+
+    encryptjs.decrypt = function(ciphertext, password, nBits) {
+        var blockSize = 16;  // block size fixed at 16 bytes / 128 bits (Nb=4) for AES
+        if (!(nBits==128 || nBits==192 || nBits==256)) return ''; // standard allows 128/192/256 bit keys
+        // ciphertext = String(ciphertext).base64Decode();
+        ciphertext = encryptjs.base64Decode(String(ciphertext));
+        password = String(password).utf8Encode();
+
+        // use AES to encrypt password (mirroring encrypt routine)
+        var nBytes = nBits/8;  // no bytes in key
+        var pwBytes = new Array(nBytes);
+        for (var i=0; i<nBytes; i++) {
+            pwBytes[i] = isNaN(password.charCodeAt(i)) ? 0 : password.charCodeAt(i);
+        }
+        var key = Algo.cipher(pwBytes, Algo.keyExpansion(pwBytes));
+        key = key.concat(key.slice(0, nBytes-16));  // expand key to 16/24/32 bytes long
+
+        // recover nonce from 1st 8 bytes of ciphertext
+        var counterBlock = new Array(8);
+        var ctrTxt = ciphertext.slice(0, 8);
+        for (var i=0; i<8; i++) counterBlock[i] = ctrTxt.charCodeAt(i);
+
+        // generate key schedule
+        var keySchedule = Algo.keyExpansion(key);
+
+        // separate ciphertext into blocks (skipping past initial 8 bytes)
+        var nBlocks = Math.ceil((ciphertext.length-8) / blockSize);
+        var ct = new Array(nBlocks);
+        for (var b=0; b<nBlocks; b++) ct[b] = ciphertext.slice(8+b*blockSize, 8+b*blockSize+blockSize);
+        ciphertext = ct;  // ciphertext is now array of block-length strings
+
+        // plaintext will get generated block-by-block into array of block-length strings
+        var plaintxt = new Array(ciphertext.length);
+
+        for (var b=0; b<nBlocks; b++) {
+            // set counter (block #) in last 8 bytes of counter block (leaving nonce in 1st 8 bytes)
+            for (var c=0; c<4; c++) counterBlock[15-c] = ((b) >>> c*8) & 0xff;
+            for (var c=0; c<4; c++) counterBlock[15-c-4] = (((b+1)/0x100000000-1) >>> c*8) & 0xff;
+
+            var cipherCntr = Algo.cipher(counterBlock, keySchedule);  // encrypt counter block
+
+            var plaintxtByte = new Array(ciphertext[b].length);
+            for (var i=0; i<ciphertext[b].length; i++) {
+                // -- xor plaintxt with ciphered counter byte-by-byte --
+                plaintxtByte[i] = cipherCntr[i] ^ ciphertext[b].charCodeAt(i);
+                plaintxtByte[i] = String.fromCharCode(plaintxtByte[i]);
+            }
+            plaintxt[b] = plaintxtByte.join('');
+        }
+
+        // join array of blocks into single plaintext string
+        var plaintext = plaintxt.join('');
+        plaintext = plaintext.utf8Decode();  // decode from UTF8 back to Unicode multi-byte chars
+
+        return plaintext;
+    };
+
+    //----------------base64 start---------------
+    var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
+
+    encryptjs.base64Encode = function (input) {
+        var output = "";
+        var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
+        var i = 0;
+        input = encryptjs._utf8_encode(input);
+        while (i < input.length) {
+            chr1 = input.charCodeAt(i++);
+            chr2 = input.charCodeAt(i++);
+            chr3 = input.charCodeAt(i++);
+            enc1 = chr1 >> 2;
+            enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
+            enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
+            enc4 = chr3 & 63;
+            if (isNaN(chr2)) {
+                enc3 = enc4 = 64;
+            } else if (isNaN(chr3)) {
+                enc4 = 64;
+            }
+            output = output +
+            _keyStr.charAt(enc1) + _keyStr.charAt(enc2) +
+            _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
+        }
+        return output;
+    }
+    encryptjs.base64Decode = function (input) {
+        var output = "";
+        var chr1, chr2, chr3;
+        var enc1, enc2, enc3, enc4;
+        var i = 0;
+        input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
+        while (i < input.length) {
+            enc1 = _keyStr.indexOf(input.charAt(i++));
+            enc2 = _keyStr.indexOf(input.charAt(i++));
+            enc3 = _keyStr.indexOf(input.charAt(i++));
+            enc4 = _keyStr.indexOf(input.charAt(i++));
+            chr1 = (enc1 << 2) | (enc2 >> 4);
+            chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
+            chr3 = ((enc3 & 3) << 6) | enc4;
+            output = output + String.fromCharCode(chr1);
+            if (enc3 != 64) {
+                output = output + String.fromCharCode(chr2);
+            }
+            if (enc4 != 64) {
+                output = output + String.fromCharCode(chr3);
+            }
+        }
+        output = encryptjs._utf8_decode(output);
+        return output;
+    }
+
+    // private method for UTF-8 encoding
+    encryptjs._utf8_encode = function (string) {
+        string = string.replace(/\r\n/g,"\n");
+        var utftext = "";
+        for (var n = 0; n < string.length; n++) {
+            var c = string.charCodeAt(n);
+            if (c < 128) {
+                utftext += String.fromCharCode(c);
+            } else if((c > 127) && (c < 2048)) {
+                utftext += String.fromCharCode((c >> 6) | 192);
+                utftext += String.fromCharCode((c & 63) | 128);
+            } else {
+                utftext += String.fromCharCode((c >> 12) | 224);
+                utftext += String.fromCharCode(((c >> 6) & 63) | 128);
+                utftext += String.fromCharCode((c & 63) | 128);
+            }
+ 
+        }
+        return utftext;
+    }
+ 
+    // private method for UTF-8 decoding
+    encryptjs._utf8_decode = function (utftext) {
+        var string = "";
+        var i = 0;
+        var c = 0;
+        var c1 = 0;
+        var c2 = 0;
+        while ( i < utftext.length ) {
+            c = utftext.charCodeAt(i);
+            if (c < 128) {
+                string += String.fromCharCode(c);
+                i++;
+            } else if((c > 191) && (c < 224)) {
+                c2 = utftext.charCodeAt(i+1);
+                string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
+                i += 2;
+            } else {
+                c2 = utftext.charCodeAt(i+1);
+                c3 = utftext.charCodeAt(i+2);
+                string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
+                i += 3;
+            }
+        }
+        return string;
+    }
+    //------------------base64 end----------------
+
+    encryptjs.getTextEncryptAndSaveToTextFile = function(filePath,password,nBits) {
+        if (!rl) throw Error("Command line not supported on this platform");
+        rl.question("Enter the text to be encrypted: ", function(answer) {
+            // TODO: Log the answer in a database
+            console.log("'"+answer+"' This text will be encrypted and stored in a text file 'encrypted.txt'");
+           var cipherText=encryptjs.encrypt(answer,password,nBits);
+            rl.close();
+        });
+    };
+
+    encryptjs.getTextEncryptAndSaveToJSONFile = function(filePath,password,nBits) {
+        if (!rl) throw Error("Command line not supported on this platform");
+        rl.question("Enter the text to be encrypted: ", function(answer) {
+            // TODO: Log the answer in a database
+            console.log("'"+answer+"' This text will be encrypted and stored in a text file 'encrypted.txt'");
+            var cipherText=encryptjs.encrypt(answer,password,nBits);
+            encryptjs.writeCipherTextToJSON(filePath,{EncryptedText:cipherText},function(){
+                console.log("'encryptedText.JSON' File created in your local directory, if not present refresh your project");
+            });
+            rl.close();
+        });
+    };
+
+    encryptjs.writeCipherTextToJSON=function(file, obj, options, callback) {
+        if (callback == null) {
+            callback = options;
+            options = {}
+        }
+
+        var spaces = typeof options === 'object' && options !== null
+            ? 'spaces' in options
+            ? options.spaces : this.spaces
+            : this.spaces;
+
+        var str = '';
+        try {
+            str = JSON.stringify(obj, options ? options.replacer : null, spaces) + '\n'
+        } catch (err) {
+            if (callback) return callback(err, null)
+        }
+    };
+
+    if (typeof String.prototype.utf8Encode == 'undefined') {
+        String.prototype.utf8Encode = function() {
+            return unescape( encodeURIComponent( this ) );
+        };
+    }
+
+    if (typeof String.prototype.utf8Decode == 'undefined') {
+        String.prototype.utf8Decode = function() {
+            try {
+                return decodeURIComponent( escape( this ) );
+            } catch (e) {
+                return this; // invalid UTF-8? return as-is
+            }
+        };
+    }
+
+    if (typeof String.prototype.base64Encode == 'undefined') {
+        String.prototype.base64Encode = function() {
+            if (typeof btoa != 'undefined') return btoa(this); // browser
+            if (typeof Buffer != 'undefined') return new Buffer(this, 'utf8').toString('base64'); // Node.js
+            throw new Error('No Base64 Encode');
+        };
+    }
+
+    if (typeof String.prototype.base64Decode == 'undefined') {
+        String.prototype.base64Decode = function() {
+            if (typeof atob != 'undefined') return atob(this); // browser
+            if (typeof Buffer != 'undefined') return new Buffer(this, 'base64').toString('utf8'); // Node.js
+            throw new Error('No Base64 Decode');
+        };
+    }
+
+    encryptjs.init();
+
+    return encryptjs;
+
+});

+ 9 - 0
assets/Script/Framework/Library/Encrypt/encryptjs.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "9c4bf27c-d7e7-4124-a898-56c6cc176ac0",
+  "isPlugin": true,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 12 - 0
assets/Script/Framework/Manager.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "2bd57adc-1d9d-4a40-a761-c8c2b7a5b77f",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 150 - 0
assets/Script/Framework/Manager/ConfigDataMgr.ts

@@ -0,0 +1,150 @@
+
+import { Singleton } from "../Utils/Singleton";
+import { attr, consume, exp, fuli_day, task, fuli_watch, nick } from "../Config/ConfigConst";
+import { NumberUtil } from "../Utils/NumberUtil";
+import { App } from "../../Manager/App";
+import { EConfigAttrProp, EAgeGroup } from "../Const/EnumDefine";
+
+/**
+ * 配置管理类
+ */
+export class ConfigDataMgr extends Singleton {
+
+    private _config: any;
+
+    constructor() {
+        super();
+    }
+
+    private get attrs(): attr[] { return this._config["attr"] as attr[]; }
+    private get consumes(): consume[] { return this._config["consume"] as consume[]; }
+    private get exps(): exp[] { return this._config["exp"] as exp[]; }
+    private get tasks(): task[] { return this._config["task"] as task[]; }
+    private get fuli_days(): fuli_day[] { return this._config["fuli_day"] as fuli_day[]; }
+    // private get fuli_times(): fuli_time[] { return this._config["fuli_time"] as fuli_time[]; }
+    private get fuli_watchs(): fuli_watch[] { return this._config["fuli_watch"] as fuli_watch[]; }
+    private get nicks(): nick[] { return this._config["nick"] as nick[]; }
+
+    public set configs(res) {
+        console.log("解析配置文件");
+        if (!res) return;
+        for (let i = 0; i < res.length; i++) {
+            let arr = [];
+            let json = res[i]["json"];
+            for (let j = 0; j < json.length; j++) {
+                arr.push(json[j]);
+            }
+            this._config[res[i].name] = arr;
+        }
+    }
+
+    public get configs() {
+        if (this._config)
+            return this._config;
+        else {
+            console.log("config配置文件还未读取!!");
+            return null;
+        }
+    }
+
+    /** 导入配置文件 */
+    public loadConfigs(cb: Function) {
+        console.log("读取配置文件");
+        this._config = {};
+        let url = "configs"
+        let self = this;
+        cc.loader.loadResDir(url, cc.Asset, function (err, res) {
+            self.configs = res;
+            console.log("配置文件解析完成");
+            console.log(self.attrs);
+            App.DataManager.init();
+            cb();
+        })
+    }
+
+    /** 随机生成昵称 */
+    public getNick() {
+        let range = this.nicks.length;
+        return this.nicks[NumberUtil.getRandomInt(0, range)];
+    }
+
+    /** 获取消耗列表 */
+    public getConsumeList(): consume[] {
+        return this.consumes;
+    }
+
+    /** 获取任务列表 */
+    public getTaskList(): task[] {
+        return this.tasks;
+    }
+
+    /** 获取福利Day列表 */
+    public getFuLiDayList(): fuli_day[] {
+        return this.fuli_days;
+    }
+
+    /** 获取福利Watch列表 */
+    public getFuLiWatchList(): fuli_watch[] {
+        return this.fuli_watchs;
+    }
+
+    /** 获取指定狗的初始属性 */
+    public getBeginingAttr(prop: EConfigAttrProp): attr {
+        let result;
+        for (let i = 0; i < this.attrs.length; i++) {
+            let item = this.attrs[i];
+            if (item.prop == EConfigAttrProp[prop]) {
+                result = item;
+                break;
+            }
+        }
+        return result;
+    }
+
+    /** 获取年龄段 */
+    public getAgeGroup(level: number): EAgeGroup {
+        return level < 11 ? EAgeGroup.PERIOD_KIDS
+            : level < 31 ? EAgeGroup.PERIOD_YOUNG : EAgeGroup.PERIOD_GROWNUP;
+    }
+
+    /** 获取指定狗的成长属性 */
+    public getGrowingAttr(level: number): attr {
+        let prop = level < 11 ? EConfigAttrProp.cq_childhood
+            : level < 31 ? EConfigAttrProp.cq_youth : EConfigAttrProp.cq_adulthood;
+        let result: attr;
+        for (let i = 0; i < this.attrs.length; i++) {
+            let item = this.attrs[i];
+            if (item.prop == EConfigAttrProp[prop]) {
+                result = item;
+                break;
+            }
+        }
+        return result;
+    }
+
+    /** 通过亲密度等级获取升级所需经验 */
+    public getExpByLv(lv: number): number {
+        for (let i = 0; i < this.exps.length; i++) {
+            let item = this.exps[i];
+            if (item.lv == lv) {
+                return item.exp;
+            }
+        }
+        return -1;
+    }
+
+    /** 获取狗的最高等级 */
+    public get DOG_MAX_LEVEL(): number {
+        return this.exps.length;
+    }
+
+    /** 获取每日签到奖励 */
+    public getFuLiDayReward(day: number) {
+        for (let i = 0; i < this.fuli_days.length; i++) {
+            if (this.fuli_days[i].day == day)
+                return this.fuli_days[i].reward;
+        }
+        console.log("出错了");
+    }
+
+}

+ 9 - 0
assets/Script/Framework/Manager/ConfigDataMgr.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "c513e8a2-25e1-462f-9e02-8fddca9b38f6",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 493 - 0
assets/Script/Framework/Manager/DataManager.ts

@@ -0,0 +1,493 @@
+
+import { Singleton } from "../Utils/Singleton";
+import { ETaskID } from "../Const/EnumDefine";
+import { App } from "../../Manager/App";
+import { DateUtil } from "../Utils/DateUtil";
+import NotificationManager from "../../../lightMVC/core/manager/NotificationManager";
+import TimeControl from "../../TimeControl";
+import hallModel from "../../model/hallModel";
+/**
+ * 数据管理器
+ */
+export class DataManager extends Singleton {
+    // /** 免费视频总次数 */
+    // public FREE_WATCH_TIMES: number = 10;
+
+    /**已有皮肤数组 */
+    public GetSkins: any = ['niao1'];
+
+    /**当前穿戴皮肤 */
+    public DressingSkin: string = 'niao1';
+
+    /**用户金币*/
+    public UserCoin: number = 0;
+
+    public UserDiamond: number = 0;
+
+    /**通关进度   2表示通过了第一关,当前关卡为2, 3表示通过了第2关,当前关卡为3,  */
+    public PassProgress: any = { "1": 1 };
+
+    /**30关后随机关卡存储 保证只随机一次 */
+    public InfiniteLevelDate: any = {};
+
+    /**玩家已经玩到的关卡*/
+    public PlayLevel: number = 1;
+
+    /**点击关卡号进入的关卡*/
+    public CurrentIntoLevel: number = 1;
+
+    /**关卡数据*/
+    public Configs: any = [];
+
+    /**看视频得体力数*/
+    public VideoAddTili: number = 10;
+
+    /**看视频得金币数*/
+    public VideoAddCoin: number = 500;
+
+    /**总关卡数*/
+    public LevelCount: number = 15;
+
+    /**重玩标志 */
+    public resetFlag: boolean = false;
+
+    /**重玩关卡*/
+    public resetLevel: number = 0;
+    /**重玩关卡*/
+    public resetLevelBgIndex: number = 0;    
+
+    public guideStep = 0;
+
+    // 关卡钻石数量
+    public diamondNum = [
+        [1, 1, 1],
+        [1, 1, 1],
+        [1, 1, 1],
+        [1, 1, 1],
+        [1, 1, 1],
+        [1, 1, 1],
+        [1, 1, 1],
+        [1, 1, 1],
+        [1, 1, 1],
+        [1, 1, 1],
+        [1, 1, 1],
+        [1, 1, 1],
+        [1, 1, 1],
+        [1, 1, 1],
+        [1, 1, 1],
+    ];
+
+    // 钥匙的位置
+    public keyPos = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3];
+
+    public foodLevel: any = [0, 0, 0, 0, 0, 0];
+    public kinchenLevel: any = [0, 0, 0];
+    public maxFoodLevel = 2;
+    public maxKitchenLevel = 2;
+
+    //升级食物需要的金币
+    public upgradeFoodCoin = [
+        [500, 1000],
+        [630, 1200],
+        [550, 860],
+        [520, 800],
+        [500, 600],
+        [870, 1000],
+    ];
+
+    // 食物升级之后售价
+    public foodSoldCoin = [
+        [5, 8, 11],
+        [6, 9, 12],
+        [3, 5, 10],
+        [4, 6, 10],
+        [1, 2, 3],
+        [3, 4, 5],
+    ]
+    
+    //  升级厨具需要的金币
+    public upgradeKitchenCoin = [
+        [500, 1000],
+        [500, 1000],
+        [1000, 1500],
+    ];
+
+    // 餐具数量
+    public kitchenNum = [
+        [2, 3, 4],
+        [2, 3, 4],
+        [1, 2, 3],
+    ]
+
+    public dirnkMachinTime = [4, 3, 2];
+
+
+    // 食物搭配种类
+    public levelFoodKind = [  
+        3, 3, 4, 4, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+    ];
+
+
+    public personCount = [ 
+        [6,  9,  12],  
+        [7,  10, 13],
+        [8,  11, 14],
+        [9,  12, 15],
+        [10, 13, 16],
+        [11, 14, 17],
+        [12, 15, 18],
+        [13, 16, 19],
+        [14, 17, 20],
+        [15, 18, 21],
+        [16, 19, 22],
+        [17, 20, 23],
+        [18, 21, 24],
+        [19, 22, 25],
+        [20, 23, 26],  
+    ];
+
+
+    public RandomLevelList = [
+        {
+            startLevel: 11,
+            endLevel: 15
+        },
+        {
+            startLevel: 16,
+            endLevel: 20
+        },
+        {
+            startLevel: 21,
+            endLevel: 25
+        },
+        {
+            startLevel: 26,
+            endLevel: 30
+        }
+    ];
+
+    public particleColorList: any = {
+        'niao1': {
+            startColor: new cc.Color(12, 166, 249, 255),
+            endColor: new cc.Color(5, 223, 255, 255)
+        },
+    }
+
+    // 道具数量
+    public PropNum: any = [0, 0, 0, 0, 0];
+
+    public propPrice: any = [1800, 1500, 1700, 1250, 2300];
+
+    /**变小道具持续时间*/
+    public SmallTime: number = 5;
+
+    /**已加载预设组*/
+    public PropPrefabs: any = [];    
+
+    /**倒计时标志*/
+    public TimeFlag: boolean = false;
+
+    /**获得新皮肤标志 */
+    public GetNewSkinFlag: boolean = false;
+
+    public NewSkinName: string = "";
+
+    public MissionName = ["制作%d个牛排", "卖出饮料%d杯", "招待%d个顾客", "获得%d颗星星"];                            
+    public MissionComplete: any = [0, 0, 0, 0];  // soldSteakNum,soldDrinkNum,solCustomerNum,getStarNum;
+    public MissionReceive: any = [0, 0, 0, 0];
+    
+    
+
+    /**皮肤设置 */
+    public SkinDataList: any = [
+        {
+            name: 'niao1',
+            path: 'skin/niao1'
+        },        
+    ];
+
+
+    /**任务设置 */
+    public MissionDataList: any = [
+        {
+            missonNum: [5,10,20,30,40,50,60],
+            rewardCoin: [100,200,300,400,500,600,700],
+            rewardDiamon: [10,20,30,40,50,60,70],
+        },
+        {
+            missonNum: [5,10,15,20,30,40,50],
+            rewardCoin: [100,200,300,400,500,600,700],
+            rewardDiamon: [10,20,30,40,50,60,70],
+        },
+        {
+            missonNum: [5,10,20,30,40,50,60,1000],
+            rewardCoin: [100,200,300,400,500,600,700],
+            rewardDiamon: [10,20,30,40,50,60,70],
+        },
+        {
+            missonNum: [9,18,27,36,45,54,63,72,81],
+            rewardCoin: [100,200,300,400,500,600,700],
+            rewardDiamon: [10,20,30,40,50,60,70],
+        },
+    ];
+
+    
+    public constructor() {
+        super();
+    }
+
+    public init() {
+        console.log("初始化用户数据");
+        this.initSkinData();
+        cc.game.on(cc.game.EVENT_SHOW, () => {
+            this.OnShow();
+            console.log('进入游戏&&&&&&&&&&&&&&');
+        });
+        cc.game.on(cc.game.EVENT_HIDE, () => {
+            this.OnHide();
+            console.log('退出游戏&&&&&&&&&&&&&&');
+        });
+
+        this.iniLevelData();
+        this.initUserCoin();
+        this.initUserDiamond();
+    }
+
+    private iniLevelData(): void {
+        let playLevel = App.LocalStorageUtil.getNumber(App.LocalStorageUtil.lst_playLevel);
+        if (!playLevel) App.LocalStorageUtil.setNumber(App.LocalStorageUtil.lst_playLevel, this.PlayLevel);
+        else this.PlayLevel = playLevel;
+
+        let passProgress = App.LocalStorageUtil.getJsonObj(App.LocalStorageUtil.lst_passProgress);
+        if (!passProgress) App.LocalStorageUtil.setJsonObj(App.LocalStorageUtil.lst_passProgress, this.PassProgress);
+        else this.PassProgress = passProgress;
+        console.log('通关进度:', this.PassProgress);
+
+        // let infiniteLevelDate = App.LocalStorageUtil.getJsonObj(App.LocalStorageUtil.lst_InfiniteLevelDate);
+        // if (!infiniteLevelDate) App.LocalStorageUtil.setJsonObj(App.LocalStorageUtil.lst_InfiniteLevelDate, this.InfiniteLevelDate);
+        // else this.InfiniteLevelDate = infiniteLevelDate;
+        // console.log('30关后随机关卡存储:', this.InfiniteLevelDate);
+        
+        // 食物等级
+        let fLevel = App.LocalStorageUtil.getJsonObj(App.LocalStorageUtil.list_foodLevel);
+        if (!fLevel) App.LocalStorageUtil.setJsonObj(App.LocalStorageUtil.list_foodLevel, this.foodLevel);
+        else this.foodLevel = fLevel;
+
+        // 厨具等级
+        let kChenLevel = App.LocalStorageUtil.getJsonObj(App.LocalStorageUtil.list_kitchenLevel);
+        if (!kChenLevel) App.LocalStorageUtil.setJsonObj(App.LocalStorageUtil.list_kitchenLevel, this.kinchenLevel);
+        else this.kinchenLevel = kChenLevel;
+
+        // 任务完成进度
+        let missionComplete = App.LocalStorageUtil.getJsonObj(App.LocalStorageUtil.list_missionComplete);
+        if (!missionComplete) App.LocalStorageUtil.setJsonObj(App.LocalStorageUtil.list_missionComplete, this.MissionComplete);
+        else this.MissionComplete = missionComplete;
+
+        console.log('aaa--------missionComplete-----------', missionComplete);
+
+        // 任务奖励领取进度
+        let missionReceive = App.LocalStorageUtil.getJsonObj(App.LocalStorageUtil.list_missionReceive);
+        if (!missionReceive) App.LocalStorageUtil.setJsonObj(App.LocalStorageUtil.list_missionReceive, this.MissionReceive);
+        else this.MissionReceive = missionReceive;
+
+        console.log('aaa--------missionReceive-----------', missionReceive);
+
+        let guidei = App.LocalStorageUtil.getNumber(App.LocalStorageUtil.str_guideStep);
+        if (!guidei) App.LocalStorageUtil.setNumber(App.LocalStorageUtil.str_guideStep, this.guideStep);
+        else this.guideStep = Number(guidei);        
+    }
+
+    private initUserCoin(){
+        let coin = App.LocalStorageUtil.getNumber(App.LocalStorageUtil.lst_Coin);
+        if (!coin) App.LocalStorageUtil.setNumber(App.LocalStorageUtil.lst_Coin, this.UserCoin);
+        else this.UserCoin = Number(coin);
+    }
+
+    private initUserDiamond(){
+        let diamond = App.LocalStorageUtil.getNumber(App.LocalStorageUtil.lst_UserDiamond);
+        if (!diamond) App.LocalStorageUtil.setNumber(App.LocalStorageUtil.lst_UserDiamond, this.UserDiamond);
+        else this.UserDiamond = Number(diamond);
+    }
+
+    public SaveMessage(): void {
+        App.LocalStorageUtil.setNumber(App.LocalStorageUtil.lst_Tili, TimeControl.instance.currentTili);
+    }
+
+    public UpdateTili(num: number = 1, cb: Function = null): void {
+        let shengyuTili = TimeControl.instance.currentTili + num;
+
+        if (shengyuTili < 0) {
+            if (cb) cb(false);
+            return;
+        }
+        if (cb) cb(true);
+        TimeControl.instance.currentTili = shengyuTili;
+        // console.log('^^^^^^^^^^^', TimeControl.instance.currentTili, shengyuTili)
+        App.DataManager.SaveMessage();
+        this.TimeCountJudge();
+        App.Facade.getModel(hallModel).updateTiliNumber();
+    }
+
+    /**
+     * 加载关卡预设
+     * @param levelName 关卡预设名
+     * @param cb 加载完关卡后回调
+     */
+    public LoadLevelPrefab(levelName: string, cb: Function): void {
+        if (this.PropPrefabs.hasOwnProperty(levelName)) {
+            cb && cb(this.PropPrefabs[levelName]);
+        } else {
+            cc.assetManager.loadBundle("gameScene", (err, bundle) => {
+                bundle.load('prefabs/levelPrefab/' + levelName, cc.Prefab, (err, assets) => {
+                    this.PropPrefabs[levelName] = assets;
+                    cb && cb(assets);
+                });
+            });
+
+
+        }
+    }
+
+    public LoadAllPropPrefab(cb: Function): void {
+        cc.assetManager.loadBundle("gameScene", (err, bundle) => {
+            bundle.loadDir('prefabs/levelPrefab', cc.Prefab, (err, assets) => {
+                for (var i = 0; i < assets.length; i++) {
+                    var sf = assets[i];
+                    this.PropPrefabs[sf.name] = sf;
+                    if (i == assets.length - 1) {
+                        cb && cb();
+                    }
+                }
+            });
+        });
+    }
+
+    
+
+    public TimeCountJudge(): void {
+        if (TimeControl.instance.currentTili < TimeControl.instance.tiliMax) {
+            TimeControl.instance.CountTili();
+        } else {
+            if (App.DataManager.TimeFlag)
+                TimeControl.instance.StopCount();
+        }
+    }
+
+    public TimeChange(time: number): string {
+        // var h = Math.floor(time / 3600) < 10 ? '0' + Math.floor(time / 3600) : Math.floor(time / 3600);
+        var min = Math.floor((time / 60 % 60)) < 10 ? '0' + Math.floor((time / 60 % 60)) : Math.floor((time / 60 % 60));
+        var sec = Math.floor((time % 60)) < 10 ? '0' + Math.floor((time % 60)) : Math.floor((time % 60));
+        //return result = h + ":" + m + ":" + s;
+        var returnValue = min + ":" + sec;
+        return returnValue;
+    }
+
+    private initSkinData() {
+        let getSkins = App.LocalStorageUtil.getJsonObj(App.LocalStorageUtil.lst_getSkin);
+        if (!getSkins) App.LocalStorageUtil.setJsonObj(App.LocalStorageUtil.lst_getSkin, this.GetSkins);
+        else this.GetSkins = getSkins;
+        let dressOnSkin = App.LocalStorageUtil.getString(App.LocalStorageUtil.lst_dressOnSkin);
+        if (!dressOnSkin) App.LocalStorageUtil.setString(App.LocalStorageUtil.lst_dressOnSkin, this.DressingSkin);
+        else this.DressingSkin = dressOnSkin;
+        if (this.DressingSkin == "niao0") {
+            this.DressingSkin = 'niao1';
+            if (this.GetSkins.indexOf('niao1') == -1) this.GetSkins.push('niao1');
+        }
+    }
+
+    private OnShow() {
+        if (App.DataManager.TimeFlag) {
+            TimeControl.instance.OfflineTime();
+        }
+    }
+
+    private OnHide() {
+        if (App.DataManager.TimeFlag) {
+            var currentTime = Date.parse(new Date().toString());
+            App.LocalStorageUtil.setNumber(App.LocalStorageUtil.lst_CountTime, currentTime);
+            App.LocalStorageUtil.setNumber(App.LocalStorageUtil.lst_CountSecond, TimeControl.instance.currentTimeCount);
+        }
+    }
+
+
+
+    // /** 获取免费视频次数 */
+    // public getFreeWatchTimes(): number {
+    //     console.log("free watch times");
+    //     let now = new Date().getDay();
+    //     let json = App.LocalStorageUtil.getJsonObj(App.LocalStorageUtil.lst_free_watch_times);
+    //     if (json) {
+    //         let preDay = json["day"];
+    //         if (now == preDay) {
+    //             return json["times"];
+    //         }
+    //     }
+    //     App.LocalStorageUtil.setJsonObj(App.LocalStorageUtil.lst_free_watch_times,
+    //         { "day": now, "times": this.FREE_WATCH_TIMES });
+    //     return this.FREE_WATCH_TIMES;
+    // }
+
+    // /** 设置免费视频次数 */
+    // public subWatchTimes() {
+    //     let now = new Date().getDay();
+    //     let json = App.LocalStorageUtil.getJsonObj(App.LocalStorageUtil.lst_free_watch_times);
+    //     if (json) {
+    //         let preDay = json["day"];
+    //         let times = json["times"] - 1;
+    //         if (now == preDay) {
+    //             App.LocalStorageUtil.setJsonObj(App.LocalStorageUtil.lst_free_watch_times,
+    //                 { "day": now, "times": times < 0 ? 0 : times });
+    //         } else {
+    //             App.LocalStorageUtil.setJsonObj(App.LocalStorageUtil.lst_free_watch_times,
+    //                 { "day": now, "times": this.FREE_WATCH_TIMES });
+    //         }
+    //     }
+    // }
+
+
+
+    // /** 获取已签到天数 */
+    // public getDailyDay(): any {
+    //     console.log("getDailyDay");
+    //     let json = App.LocalStorageUtil.getJsonObj(App.LocalStorageUtil.lst_daily_signin);
+    //     if (json) {
+    //         if (this.isTodaySignIn()) {
+    //             //今天已经签过到
+    //             return json["day"];
+    //         } else {
+    //             //昨天签到的
+    //             if (json["day"] >= 7)   //已经过去一周, 刷新次数
+    //                 return 0;
+    //         }
+    //     }
+    //     else {
+    //         return 0;
+    //     }
+    // }
+
+    // /** 今天是否签到 */
+    // public isTodaySignIn(): boolean {
+    //     let signin = App.LocalStorageUtil.getJsonObj(App.LocalStorageUtil.lst_daily_signin);
+    //     if (signin) {
+    //         let now = DateUtil.getYearMonthDay();
+    //         if (signin["date"] == now)
+    //             return true;
+    //         else
+    //             return false;
+    //     }
+    //     return false;
+    // }
+
+    // /** 设置签到数据 */
+    // public setDailySignInData() {
+    //     let now = DateUtil.getYearMonthDay();
+    //     console.log(now);
+    //     let day = this.getDailyDay() + 1;
+    //     App.LocalStorageUtil.setJsonObj(App.LocalStorageUtil.lst_daily_signin,
+    //         { "day": day, "date": now });
+    //     let reward = App.ConfigMgr.getFuLiDayReward(day);
+    //     let data = { "1": reward };
+    // }
+
+
+}

+ 9 - 0
assets/Script/Framework/Manager/DataManager.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "6f4547a8-3dc0-41e3-90dc-e61f7bc48665",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 12 - 0
assets/Script/Framework/UserData.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "eda67ade-fb84-4bc8-86ba-b42e0fae620f",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 74 - 0
assets/Script/Framework/UserData/DailyTask.ts

@@ -0,0 +1,74 @@
+import { task } from "../Config/ConfigConst";
+import { App } from "../../Manager/App";
+import { ETaskID } from "../Const/EnumDefine";
+
+/** 日常任务 */
+export class DailyTask {
+
+    public taskType = 1;
+    public finishTaskType = 2;
+    private _tasks: task[];
+    public get tasks(): task[] {
+        return this._tasks;
+    }
+    public set tasks(value: task[]) {
+        this._tasks = value;
+        this.updateLocalStorate();
+    }
+
+
+    public constructor() {
+        this.initData();
+    }
+
+    public initData() {
+        let dailyTask = App.LocalStorageUtil.getJsonObj(App.LocalStorageUtil.lst_dailytask) as DailyTask;
+        if (dailyTask)
+            this.tasks = dailyTask._tasks;
+        else
+            this.tasks = App.ConfigMgr.getTaskList();
+    }
+
+    private updateLocalStorate() {
+        App.LocalStorageUtil.setJsonObj(App.LocalStorageUtil.lst_dailytask, this);
+        console.log("设置日常任务数据:", this);
+    }
+
+    /** 获取任务在任务数组中的索引 */
+    private getTask(taskID: ETaskID): number {
+        let result = -1;
+        this.tasks.forEach((value, index) => {
+            if (value.id == taskID) result = index;
+        });
+        return result;
+    }
+
+    /** 完成一次 */
+    public doOneTimes(taskID: ETaskID) {
+        let taskIndex = this.getTask(taskID);
+        this.tasks[taskIndex].overNum += 1;
+        this.isFinishTask(this.tasks[taskIndex]);
+        this.updateLocalStorate();
+    }
+
+
+    /** 是否完成某个任务 */
+    private isFinishTask(task: task): boolean {
+        let result = false;
+        if (task.overNum >= task.maxNum) {
+            task.overNum = task.maxNum;
+            result = true;
+        }
+        return result;
+    }
+
+    /** 是否完成所有任务 */
+    private isFinishAllTask(): boolean {
+        let result = true;
+        this.tasks.forEach((value) => {
+            if (value.overNum < value.maxNum) result = false;
+        })
+        return result;
+    }
+
+}

+ 9 - 0
assets/Script/Framework/UserData/DailyTask.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "8677dce9-93c0-4f9c-99c2-29a7bc98c25a",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 48 - 0
assets/Script/Framework/UserData/WelFare.ts

@@ -0,0 +1,48 @@
+import { App } from "../../Manager/App";
+import { fuli_day, fuli_watch } from "../Config/ConfigConst";
+
+/** 福利 */
+export class WelFare{
+    
+    private _fuliDay: fuli_day[];
+    private _fuliWatch: fuli_watch[];
+    public get fuliDay(): fuli_day[] {
+        return this._fuliDay;
+    }
+    public set fuliDay(value: fuli_day[]) {
+        this._fuliDay = value;
+        this.updateLocalStorate();
+    }
+
+    public get fuliWatch(): fuli_watch[] {
+        return this._fuliWatch;
+    }
+    public set fuliWatch(value: fuli_watch[]) {
+        this._fuliWatch = value;
+        this.updateLocalStorate();
+    }
+
+    public constructor() {
+        this.initData();
+    }
+
+    public initData() {
+        let dailyTask = App.LocalStorageUtil.getJsonObj(App.LocalStorageUtil.lst_welfare) as WelFare;
+        if (dailyTask){
+            this.fuliDay = dailyTask._fuliDay;
+            this.fuliWatch = dailyTask._fuliWatch;
+        }
+        else{
+            this.fuliDay = App.ConfigMgr.getFuLiDayList();
+            this.fuliWatch = App.ConfigMgr.getFuLiWatchList();
+        }
+    }
+
+    private updateLocalStorate() {
+        App.LocalStorageUtil.setJsonObj(App.LocalStorageUtil.lst_welfare, this);
+        console.log("设置福利数据:", this);
+    }
+
+
+}
+

+ 9 - 0
assets/Script/Framework/UserData/WelFare.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "59fde526-edad-459a-ac1e-c69fad0611b6",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 12 - 0
assets/Script/Framework/Utils.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "c01949e4-d78c-482b-b5d2-c7d617e45a1d",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 36 - 0
assets/Script/Framework/Utils/DateUtil.ts

@@ -0,0 +1,36 @@
+
+
+export class DateUtil {
+
+    /** 获取年月日  2020/8/3*/
+    public static getYearMonthDay() {
+        let dateObj = new Date();
+        let month = dateObj.getUTCMonth() + 1; //months from 1-12
+        let day = dateObj.getUTCDate();
+        let year = dateObj.getUTCFullYear();
+        return year + "/" + month + "/" + day;
+    }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 9 - 0
assets/Script/Framework/Utils/DateUtil.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "6c9602b4-7da5-4a70-ac00-17b7c98b4f60",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 171 - 0
assets/Script/Framework/Utils/LocalStorageUtil.ts

@@ -0,0 +1,171 @@
+import { Singleton } from "./Singleton";
+
+export class LocalStorageUtil extends Singleton {
+    /**音乐 */
+    public lst_music: string = "Bird_music";
+    /**音效 */
+    public lst_effect: string = "Bird_effect";
+    /**倒计时时间*/
+    public lst_CountTime: string = "BirdCountTime";
+    /**倒计时秒数*/
+    public lst_CountSecond: string = "BirdCountSecond";
+    /**体力 */
+    public lst_Tili: string = "BirdTili";
+    /** 最后进入关卡*/
+    public lst_playLevel: string = "Bird_playLevel";
+
+    /** 通关进度*/
+    public lst_passProgress: string = "Bird_passProgress";
+
+    public list_foodLevel: string = "list_foodLevel";
+
+    public list_kitchenLevel: string = "list_kitchenLevel";
+
+    public list_missionComplete: string = "list_missionComplete";
+
+    public list_missionReceive: string = "list_missionReceive";
+
+    // 通关场景进度
+    public Bird_passScene: string = "Bird_passScene";
+
+    /** 通关进度*/
+    public lst_InfiniteLevelDate: string = "Bird_infiniteLevelDate";
+
+    public str_guideStep: string = "str_guideStep";
+
+    /** 道具数量*/
+    public lst_PropNum: string = "lst_PropNum";
+
+    /** 金币*/
+    public lst_Coin: string = "lst_UserCoin";
+    public lst_UserDiamond: string = "lst_UserDiamond";
+
+    /** 用户皮肤组*/
+    public lst_getSkin: string = "Bird_getSkin";
+    /** 用户当前使用皮肤*/
+    public lst_dressOnSkin: string = "Bird_dressOnSkin";
+    /** 新手引导标志*/
+    public lst_guide: string = "Bird_guide";
+
+    // /** 免费视频次数 */
+    // public lst_free_watch_times: string = "sausage_free_watch_times";
+    // /** 每日签到数据 */
+    // public lst_daily_signin: string = "sausage_daily_signin";
+
+    private secretkey: string = 'ccxh_ws111'; // 加密密钥
+    private isSecret: boolean = false;
+    private set(key: string, value: any) {
+        try {
+            if (key) {
+                if (this.isSecret) {
+                    let dataString = JSON.stringify(value);
+                    value = window["encryptjs"].encrypt(dataString, this.secretkey, 256);
+                }
+                cc.sys.localStorage.setItem(key, value);
+            }
+        } catch (e) {
+            console.error("设置数据出错!!!");
+        }
+    }
+
+    //不存在key时返回null
+    private get(key: string): any {
+        try {
+            if (key) {
+                let value = cc.sys.localStorage.getItem(key);
+                if (value) {
+                    if (this.isSecret)
+                        return JSON.parse(window["encryptjs"].decrypt(value, this.secretkey, 256));
+                    else
+                        return value;
+                }
+            }
+            return null;
+        } catch (e) {
+            console.error("获取数据出错!!!");
+            return null;
+        }
+    }
+
+    /**存string */
+    public setString(key: string, value: string) {
+        this.set(key, value);
+    }
+
+    /**取string */
+    public getString(key: string): string {
+        let value = this.get(key);
+        return value;
+    }
+
+    /**存boolean */
+    public setBoolean(key: string, value: boolean) {
+        let temp = value ? "1" : "0";
+        this.set(key, temp);
+    }
+
+    /**取boolean */
+    public getBoolean(key: string): boolean {
+        let value = this.get(key);
+        if (value) {
+            if (value == "1")
+                return true;
+            else
+                return false;
+        }
+        return null;
+    }
+
+    /**存number */
+    public setNumber(key: string, value: number, encode?: boolean) {
+        if (value != null && value != undefined) {
+            // if (value == Math.floor(value) && encode) { //整数
+            // 	value = EncryptUtil.enValue(value);
+            // }
+            this.set(key, value.toString());
+        }
+    }
+
+    /**取number */
+    public getNumber(key: string, decode?: boolean): number {
+        let temp = this.get(key);
+        if (temp) {
+            if ((temp as string).indexOf(".") >= 0) {
+                return parseFloat(temp);
+            } else {
+                let value = parseInt(temp);
+                // return EncryptUtil.desValue(value);	
+            }
+        }
+        return temp;
+    }
+
+    /**存json */
+    public setJsonObj(key: string, value: Object) {
+        if (value != null && value != undefined) {
+            this.set(key, JSON.stringify(value));
+        }
+    }
+
+    /**取json */
+    public getJsonObj(key: string): Object {
+        let temp = this.get(key);
+        if (temp != null) {
+            return JSON.parse(temp);
+        }
+        return temp;
+    }
+
+    /**清空本地存在数据 */
+    public clearAll() {
+        cc.sys.localStorage.clear();
+    }
+
+    /**删除数据key */
+    public deleteKey(key: string) {
+        let temp = this.get(key);
+        if (temp != null) {
+            cc.sys.localStorage.removeItem(key);
+        }
+    }
+}

+ 9 - 0
assets/Script/Framework/Utils/LocalStorageUtil.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "8b8b926d-2f0d-42e9-a81a-dc10184e8ffd",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 29 - 0
assets/Script/Framework/Utils/LogUtil.ts

@@ -0,0 +1,29 @@
+
+export class LogUtil implements Console {
+    memory: any;
+    assert(test?: boolean, message?: string, ...optionalParams: any[]) { }
+    clear() { }
+    count(countTitle?: string) { }
+    debug(message?: string, ...optionalParams: any[]) { }
+    dir(value?: any, ...optionalParams: any[]) { }
+    dirxml(value: any) { }
+    error(message?: any, ...optionalParams: any[]) { }
+    exception(message?: string, ...optionalParams: any[]) { }
+    group(groupTitle?: string) { }
+    groupCollapsed(groupTitle?: string) { }
+    groupEnd() { }
+    info(message?: any, ...optionalParams: any[]) { }
+    log(message?: any, ...optionalParams: any[]) { }
+    msIsIndependentlyComposed(element: Element) { return false };
+    profile(reportName?: string) { }
+    profileEnd() { }
+    select(element: Element) { }
+    table(...data: any[]) { }
+    time(timerName?: string) { }
+    timeEnd(timerName?: string) { }
+    trace(message?: any, ...optionalParams: any[]) { }
+    warn(message?: any, ...optionalParams: any[]) { }
+    countReset(label?: string): void { }
+    timeLog(label?: string, ...data: any[]): void { }
+    timeStamp(label?: string): void { }
+}

+ 9 - 0
assets/Script/Framework/Utils/LogUtil.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "34f4c5b6-b14d-4b78-b6fd-6f270a5a2419",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 47 - 0
assets/Script/Framework/Utils/NumberUtil.ts

@@ -0,0 +1,47 @@
+
+/**数值处理相关 */
+export class NumberUtil {
+    /**
+     * 数值向下取整
+     */
+    public static toInt(num: number): number {
+        return Math.floor(num);
+    }
+
+    /** 随机值,[min, max)*/
+    public static getRandomNum(min: number, max: number): number {
+        return min + Math.random() * (max - min);
+    }
+
+    /**随机整数 [min,max)*/
+    public static getRandomInt(min: number, max: number): number {
+        return Math.floor(min + Math.random() * (max - min));
+    }
+
+    /** 保留2位小数 */
+    public static toFixedTwoDigit(value: number) {
+        return parseFloat(value.toFixed(2));
+    }
+
+    /**
+     * 显示完整数值,补0
+     * num:源数据
+     * len:需要的长度
+     */
+    public static toFitZero(num: number, len: number): string {
+        let numStr = num.toString();
+        if (numStr.length < len) {
+            let need = len - numStr.length;
+            for (let i = 0; i < need; i++) {
+                numStr = "0" + numStr;
+            }
+        }
+        return numStr;
+    }
+
+    // /** 随机值,[min, max)*/
+    // public static getRandomNum(min: number, max: number): number {
+    //     return min + Math.random() * (max - min);
+    // }
+
+}

+ 9 - 0
assets/Script/Framework/Utils/NumberUtil.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "7fae91f9-33e7-4e49-bc60-e17a8af359ce",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 39 - 0
assets/Script/Framework/Utils/Singleton.ts

@@ -0,0 +1,39 @@
+/**
+ * 单例类父类
+ */
+export class Singleton {
+    private static instance;
+    public static getInstance<T>(): T {
+        if (this.instance == null) {
+            var Class: any = this;
+            this.instance = new Class() as T;
+        }
+        return this.instance;
+    }
+    public static ins() {
+        if (this.instance == null) {
+            var Class: any = this;
+            this.instance = new Class();
+        }
+        return this.instance;
+    }
+
+    public static createInstance() {
+        if (this.instance == null) {
+            var Class: any = this;
+            this.instance = new Class();
+            this.instance.init();
+        }
+    }
+
+    public static destroyInstance() {
+        if (this.instance != null) {
+            this.instance.unInit();
+            this.instance = null;
+        }
+    }
+
+    public init() { };	//资源初始化		
+
+    public unInit() { };	//资源释放
+}

+ 9 - 0
assets/Script/Framework/Utils/Singleton.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "fb0ff5c4-33e0-49f8-a5e8-1f242addb311",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 19 - 0
assets/Script/Framework/Utils/TimeUtil.ts

@@ -0,0 +1,19 @@
+
+export class TimeUtil {
+
+    /** 获取现在到明天凌晨的秒数 */
+    public static getSecUntilTomorrow() {
+        console.log("隔天凌晨时间: ");
+        let date = new Date();
+        // 获取当前时间(毫秒数)
+        let now = date.getTime();        
+        // 去除当前时间的小时/分钟/秒
+        date.setHours(0);
+        date.setMinutes(0);
+        date.setSeconds(0);
+        // 获取今天凌晨的时间(毫秒数)
+        let earlyMorning = date.getTime();        
+        // 获取距离明天的秒数
+        return 60 * 60 * 24 - (now - earlyMorning) / 1000;
+    }
+}

+ 9 - 0
assets/Script/Framework/Utils/TimeUtil.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "5329b9bd-bb75-4aff-a1af-fc4b8b10ff96",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 85 - 0
assets/Script/LoadScene.ts

@@ -0,0 +1,85 @@
+import SDK from "./sdk/SDK";
+import { App } from "./Manager/App";
+import hallModel from "./model/hallModel";
+import NotifyModel from "./model/NotifyModel";
+import TimeControl from "./TimeControl";
+import { EncryptType } from "./sdk/tools/EncryptUtil";
+
+
+const { ccclass, property } = cc._decorator;
+
+@ccclass
+export default class loadScene extends cc.Component {
+
+    @property(cc.Label)
+    public percentLabel: cc.Label = null;
+
+    @property(cc.ProgressBar)
+    public loadingBar: cc.ProgressBar = null;
+
+    private loadSceneName: string = "hallScene";
+
+    // LIFE-CYCLE CALLBACKS:
+
+    onLoad() {
+        
+        App.Facade.init(false, cc.size(720, 1280), false, true);
+        App.startUp();
+        App.DataManager.init();
+        TimeControl.instance.OfflineTime();
+        this.initModel();
+        let gameId: any = "richestMan";
+        SDK.Instance.init(gameId, EncryptType.ED_CM);
+        this.LoadOther();
+    }
+
+    initModel(): void {
+        App.Facade.registerModel(hallModel);
+        App.Facade.registerModel(NotifyModel);
+    }
+
+    LoadOther() {
+        // this.loadConfigs(() => { App.DataManager.LoadAllPropPrefab(this.loadScene.bind(this)) });
+        // App.DataManager.LoadAllPropPrefab(this.loadScene.bind(this)) ;
+
+        this.loadScene();
+    }
+
+    // private loadConfig() {
+    //     App.ConfigMgr.loadConfigs(this.loadScene.bind(this));
+    // }
+
+    private loadScene() {
+        App.Facade.runBundleScene(this.loadSceneName,this.loadSceneName,this.loadHallProgress.bind(this))
+    }
+
+    /** 导入配置文件 */
+    private loadConfigs(cb: Function) {
+        console.log("读取配置文件");
+        let url = "configs"
+        let self = this;
+        cc.loader.loadResDir(url, cc.Asset, (err, res) => {
+            App.DataManager.Configs = res;
+            App.DataManager.LevelCount = res.length;
+            res.sort((a: any, b: any) => { return Number(a._name) - Number(b._name) });
+            console.log("配置文件解析完成", res);
+            cb();
+        })
+    }
+
+    /**加载大厅界面进度*/
+    private loadHallProgress(completedCount: number, totalCount: number, item: any) {
+        let progress = completedCount / totalCount;
+        this.setProgress(Math.round(progress * 100));
+    }
+
+    /**加载进度 */
+    private setProgress(value: number) {
+        this.loadingBar.progress = value / 100;
+        this.percentLabel.getComponent(cc.Label).string = value + "%";
+    }
+
+    // update (dt) {}
+
+    
+}

+ 9 - 0
assets/Script/LoadScene.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "0863d0cc-7025-4417-8bd5-af874c53b873",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 18 - 0
assets/Script/LowSpeed.ts

@@ -0,0 +1,18 @@
+import player from "./player";
+
+
+const {ccclass, property} = cc._decorator;
+
+@ccclass
+export default class LowSpeed extends cc.Component {
+
+
+
+    start () {
+
+    }
+
+    update (dt) {
+
+    }
+}

+ 9 - 0
assets/Script/LowSpeed.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "0dc99145-c955-4e9b-9813-862c1f5968e3",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 12 - 0
assets/Script/Manager.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "d257c230-0d05-4990-9fd1-2f4daaeba2b0",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 37 - 0
assets/Script/Manager/AnimData.ts

@@ -0,0 +1,37 @@
+/**
+ * 动画配置
+ */
+export class AnimData {
+
+
+    // player    
+    public static run1: string = "chay_char";  //奔跑
+    public static run2: string = "chay_char2";  //奔跑
+    public static sit: string = "ngoi_char";   //坐下
+    public static win: string = "chien_thang_char";  //胜利
+    public static lose: string = "bi_phat_hien_char" ;  //失败
+
+
+    // enemy
+    public static idel: string = "idle";    
+    public static idle_tay_loop: string = "idle_tay_loop";  //犹豫
+            
+    public static idle_tay: string = "idle_tay";   //伸手
+    public static tho_len: string = "tho_len"; // 突然探头
+    public static tho_len2: string = "tho_len2"; // 突然探头
+    public static soi2: string = "soi2";            //发射前准备
+    public static soi: string = "soi";             //发射
+
+    public static phat_hien1: string = "phat_hien";  //  击中三连
+    public static phat_hien2: string = "phat_hien2";  //
+    public static phat_hien3: string = "phat_hien3";  //
+
+    public static ngac_nhien: string = "ngac_nhien";   //没击中
+
+    public static thut_xuong: string = "thut_xuong";//隐藏
+    public static idle_tay_rut: string = "idle_tay_rut";   //彻底影藏
+
+    
+    public static wanzheng: string = "wanzheng";   //面包掉落
+
+}

+ 9 - 0
assets/Script/Manager/AnimData.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "6f689e92-646a-4885-9455-f4dea88493ee",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 81 - 0
assets/Script/Manager/App.ts

@@ -0,0 +1,81 @@
+/**
+ * App主类
+ * @author xiongjian
+ * @since 2018-1-22
+
+ */
+import { SingleClass } from "./SingleClass";
+import { SoundManager } from "./SoundManager";
+import DragonManager from "./DragonManager";
+import LayerManager from "./LayerManager";
+import TipsManager from "./TipsManager";
+import EffectUtils from "./EffectUtils";
+import { BaseView } from "../../lightMVC/core/base/BaseView";
+import { Facade } from "../../lightMVC/core/Facade";
+import { ConfigDataMgr } from "../Framework/Manager/ConfigDataMgr";
+import { LocalStorageUtil } from "../Framework/Utils/LocalStorageUtil";
+import { DataManager } from "../Framework/Manager/DataManager";
+import SpinManager from "./SpinManager";
+export class App extends SingleClass {
+
+    /** 配置管理类 */
+    public static get ConfigMgr(): ConfigDataMgr {
+        return ConfigDataMgr.getInstance<ConfigDataMgr>();
+    }
+
+    /** 数据管理类 */
+    public static get DataManager(): DataManager {
+        return DataManager.getInstance<DataManager>();
+    }
+
+
+    /**启动框架*/
+    public static startUp(): void {
+        //声音设置
+        let allowBGM = App.LocalStorageUtil.getBoolean(App.LocalStorageUtil.lst_music);
+        App.SoundManager.allowPlayBGM = (allowBGM == null || allowBGM) ? true : false;
+        let allowEffec = App.LocalStorageUtil.getBoolean(App.LocalStorageUtil.lst_effect);
+        App.SoundManager.allowPlayEffect = (allowEffec == null || allowEffec) ? true : false;
+        App.LocalStorageUtil.setBoolean(App.LocalStorageUtil.lst_music, App.SoundManager.allowPlayBGM);
+        App.LocalStorageUtil.setBoolean(App.LocalStorageUtil.lst_effect, App.SoundManager.allowPlayEffect);
+        console.log('音乐:', App.SoundManager.allowPlayBGM, '音效:', App.SoundManager.allowPlayEffect)
+    }
+
+    /**声音管理器 */
+    public static get SoundManager(): SoundManager {
+        return SoundManager.getInstance();
+    }
+    /**存储管理器 */
+    public static get LocalStorageUtil(): LocalStorageUtil {
+        return LocalStorageUtil.getInstance<LocalStorageUtil>();
+    }
+    /**动画管理器 */
+    public static get DragonManager(): DragonManager {
+        return DragonManager.getInstance();
+    }
+    /**动画管理器 */
+    public static get SpinManager(): SpinManager {
+        return SpinManager.getInstance();
+    }
+    /**图层管理器 */
+    public static get LayerManager(): LayerManager {
+        return LayerManager.getInstance();
+    }
+    /**提示管理器 */
+    public static get TipsManager(): TipsManager {
+        return TipsManager.getInstance();
+    }
+    /**缓动系统 */
+    public static get EffectUtils(): EffectUtils {
+        return EffectUtils.getInstance();
+    }
+    /**屏幕宽高 */
+    public static get StageUtils(): cc.Size {
+        return cc.winSize;
+    }
+    /**加载场景 */
+    public static get Facade(): Facade {
+        return Facade.getInstance();
+    }
+
+}

+ 9 - 0
assets/Script/Manager/App.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "ef087155-8918-424b-97af-db0d26f8d9c7",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 21 - 0
assets/Script/Manager/DragonAnim.ts

@@ -0,0 +1,21 @@
+
+
+import { App } from "./App";
+import { AnimData } from "./AnimData";
+import TipsManager from "./TipsManager";
+import { ERewardType, EConsume } from "../Framework/Const/EnumDefine";
+import player from "../player";
+const { ccclass, property } = cc._decorator;
+
+@ccclass
+export default class DragonAnim extends cc.Component {
+
+
+    onLoad() {
+
+    }
+
+    public playerAnimaton(animationName: string, loop: boolean,  callbanck: Function){
+        App.SpinManager.PlaySpinAnimation(this.node, animationName, loop, callbanck);
+    }
+}

+ 9 - 0
assets/Script/Manager/DragonAnim.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "5c2d4255-e38e-41d7-86cb-0e614265b9dc",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 164 - 0
assets/Script/Manager/DragonManager.ts

@@ -0,0 +1,164 @@
+import { SingleClass } from "./SingleClass";
+
+const { ccclass, property } = cc._decorator;
+export enum AnimType {
+    Dog = 1,
+    Daoju = 2,
+}
+@ccclass
+export default class DragonManager extends SingleClass {
+    public armatureDisplay: dragonBones.ArmatureDisplay = null;//动画
+    public armatureDisplayList: any = [];//已加载动画组
+    public armature: dragonBones.Armature;
+    public factory: dragonBones.CCFactory;
+    public currentAnimName: string = '';
+
+    /**
+     * 播放龙骨动画
+     * @param animationName 动画名称
+     * @param completeCallback 播放回调
+     * @param playTimes 播放次数
+     */
+    public PlayDragonAnimation(animationName: string, completeCallback: any = null, playTimes: number = 1) {
+        // this.armatureDisplay.armatureName = armatureName;
+        this.removeListen();
+        this.currentAnimName = animationName;
+        this.armatureDisplay.playAnimation(animationName, playTimes);
+        this.armatureDisplay.addEventListener(dragonBones.EventObject.COMPLETE, completeCallback.bind(this, this.armatureDisplay.node));
+    }
+
+    /**
+    * 生成骨骼动画
+    * @param node 当前的节点
+    * @param path 龙骨地址
+    * @param armatureName Armature名称
+    * @param newAnimation      Animation名称
+    * @param completeCallback  动画播放完毕的回调
+    * @param playTimes         播放次数 -1是根据龙骨文件 0五险循环 >0是播放次数
+    */
+    public dragonBoneAnim(node: cc.Node, path: string, armatureName: string, newAnimation: string, completeCallback, playTimes: number = 1) {
+        let armatureDisplay = null;
+        this.armatureDisplay = node.getComponent(dragonBones.ArmatureDisplay);
+        armatureDisplay = this.armatureDisplay;
+        cc.loader.loadResDir(path, (err, assets) => {
+            assets.forEach(asset => {
+                if (asset instanceof dragonBones.DragonBonesAsset) {
+                    armatureDisplay.dragonAsset = asset;
+                }
+                if (asset instanceof dragonBones.DragonBonesAtlasAsset) {
+                    armatureDisplay.dragonAtlasAsset = asset;
+                }
+            });
+            armatureDisplay.armatureName = armatureName;
+            armatureDisplay.playAnimation(newAnimation, playTimes);
+            armatureDisplay.addEventListener(dragonBones.EventObject.COMPLETE, completeCallback);
+        });
+    }
+
+    /**
+     * 更换龙骨皮肤
+     */
+    public ChangeDragonSkin(skinName: string) {
+        try {
+            let skinNames = ["shou1", "shou", "pigu_"];
+            let skinIndexArr = {
+                "default": [0, 0, 0],
+                "skin_one": [1, 1, 3],
+                "skin_two": [0, 0, 1],
+                "skin_three": [2, 2, 2],
+            };
+            let currentIndexArr = skinIndexArr[skinName];
+            for (var i = 0; i < skinNames.length - 1; i++) {
+                var bones = this.armatureDisplay.armature().getSlot(skinNames[i]);
+                bones.displayIndex = currentIndexArr[i] - 0;
+                // console.log('bones****', bones, '  ', currentIndexArr[i]);
+            }
+            let slot = this.armatureDisplay.armature().getSlot("Armature");
+            slot.displayList[0].getSlot("pigu_").displayIndex = skinIndexArr[skinName][2];
+            slot.displayList[0].getSlot("yan").displayIndex = (skinName == "skin_one") ? -1 : 0;
+            // console.log('slot.armature.name:', slot);
+        } catch (err) {
+
+        }
+    }
+
+    /**删除动画完毕的监听 */
+    public removeListen() {
+        if (this.armatureDisplay)
+            this.armatureDisplay.removeEventListener(dragonBones.EventObject.COMPLETE);
+    }
+
+    // /**
+    //  *初始化骨骼动画资源
+    //  */
+    // public initArmatureFile(skeletonData, textureData, texturePng) {
+    //     let factory = this.getFactory;
+    //     //this.armatureDisplay.getArmatureKey
+    //     //factory.parseTextureAtlasData(cc.loader.loadRes(textureData), cc.loader.loadRes(texturePng));
+    // }
+    // /**获取骨骼工厂 */
+    // public get getFactory(): dragonBones.CCFactory {
+    //     return dragonBones.CCFactory.getInstance();
+    // }
+    /**获取动画对象 */
+    // public buildArmature(armatureName): dragonBones.Armature {
+    //     this.armature = this.getFactory.buildArmature(armatureName);
+    //     return this.armature;
+    // }
+    // /**
+    // * 播放动作
+    // * @param action
+    // * @param playNum 播放次数
+    // */
+    // public play(action: string, playNum: number = 1) {
+    //     if (this.dog_armatureDisplay)
+    //         this.dog_armatureDisplay.playAnimation(action, playNum);
+    // }
+
+    // /**
+    //  * 替换动画
+    //  */
+    // public replaceAnim(armatureName: string) {
+
+    // }
+
+    // /**
+    //  * 生成骨骼动画
+    //  * @param node 当前的节点
+    //  * @param path 龙骨地址
+    //  * @param armatureName Armature名称
+    //  * @param newAnimation      Animation名称
+    //  * @param completeCallback  动画播放完毕的回调
+    //  * @param playTimes         播放次数 -1是根据龙骨文件 0五险循环 >0是播放次数
+    //  */
+    // public dragonBoneAnim(node: cc.Node, path: string, armatureName: string, newAnimation: string, completeCallback, playTimes: number = 1) {
+    //     let armatureDisplay = null;
+    //     // if (!this.dog_armatureDisplay) {
+    //     this.dog_armatureDisplay = node.getComponent(dragonBones.ArmatureDisplay);
+    //     armatureDisplay = this.dog_armatureDisplay;
+    //     //  }
+
+    //     cc.loader.loadResDir(path, (err, assets) => {
+    //         assets.forEach(asset => {
+    //             if (asset instanceof dragonBones.DragonBonesAsset) {
+    //                 armatureDisplay.dragonAsset = asset;
+    //             }
+    //             if (asset instanceof dragonBones.DragonBonesAtlasAsset) {
+    //                 armatureDisplay.dragonAtlasAsset = asset;
+    //             }
+    //         });
+    //         armatureDisplay.armatureName = armatureName;
+    //         armatureDisplay.playAnimation(newAnimation, playTimes);
+    //         armatureDisplay.addEventListener(dragonBones.EventObject.COMPLETE, completeCallback);
+    //     });
+    // }
+
+    // /**
+    //  * 获取当前的动画
+    //  */
+    // public getCurrentAnim(node: cc.Node): dragonBones.ArmatureDisplay {
+    //     let armatureDisplay = node.getComponent(dragonBones.ArmatureDisplay);
+    //     armatureDisplay.removeEventListener(dragonBones.EventObject.COMPLETE);
+    //     return armatureDisplay;
+    // }
+}

+ 9 - 0
assets/Script/Manager/DragonManager.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "994e76f3-6856-41e2-a430-f2deb112d3be",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 50 - 0
assets/Script/Manager/EffectUtils.ts

@@ -0,0 +1,50 @@
+// Learn TypeScript:
+//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
+// Learn Attribute:
+//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
+// Learn life-cycle callbacks:
+//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
+
+import { SingleClass } from "./SingleClass";
+
+const { ccclass, property } = cc._decorator;
+
+@ccclass
+export default class EffectUtils extends SingleClass {
+
+    /**
+    * 由小到大
+    */
+    public smallToLarge(obj: cc.Node, waitTime: number = 1, callback: Function = null) {
+        obj.setScale(0.5);
+        cc.tween(obj).to(0.3, { scale: 1, opacity: 255 }, { easing: 'easeOut' })
+            .delay(waitTime)
+            .to(0.3, { opacity: 0 }).call(() => {
+                if (callback)
+                    callback();
+            }).start();
+        // var scale = cc.scaleTo(0.5, 1, 1).easing(cc.easeOut(1));
+        // var ac1 = cc.fadeIn(0.5);
+        // var delay = cc.delayTime(waitTime);
+        // var ac2 = cc.fadeOut(0.5);
+        // var cfunc = cc.callFunc(() => {
+        //     obj.stopAction(seq);
+        //     console.log("我是最后一个动作");
+        //     if (callback)
+        //         callback();
+        // });
+        // var seq = cc.sequence(scale,ac1,delay,ac2, cfunc);
+        // obj.runAction(seq);
+    }
+    /**
+     * 从下向上
+     */
+    public bottomToTop(obj:cc.Node,waitTime:number=1,callback:Function = null){
+        cc.tween(obj).set({opacity: 0,y:-80}).to(0.3, { y: 0, opacity: 255 })
+        .delay(waitTime)
+        .to(0.3, { opacity: 0 }).call(() => {
+            if (callback)
+                callback();
+        }).start();
+    }
+}

+ 9 - 0
assets/Script/Manager/EffectUtils.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "f4f79581-ffbf-4a27-8a76-d9ea2174a7f9",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 87 - 0
assets/Script/Manager/GameInfo.ts

@@ -0,0 +1,87 @@
+/**
+ * 游戏数据
+ * @author xiongjian 
+ * @date 2018/8/25
+ */
+class GameInfo {
+
+
+
+}
+
+/**狗狗类型 */
+export enum dogType {
+    s_hsq,
+    m_hsq,
+    l_hsq,
+    s_jm,
+    m_jm,
+    l_jm,
+    s_td,
+    m_td,
+    l_td,
+    //------add 柴犬
+    s_cq,   //小
+    m_cq,   //中1
+    b_cq    //中2
+
+}
+
+/**狗狗动作 */
+enum dogAct {
+    baobao,
+    chifan,
+    daiji,
+    jiepanzi,
+    meijiezhong,
+    shumao1,
+    shumao2,
+    shumao3,
+    xizao,
+    zang,
+    e,
+    shangxin
+}
+
+/**狗狗吃饭类型 */
+enum ChifanType {
+    shui,
+    gouliang,
+    guantou,
+    gutou
+}
+
+/**洗澡类型 */
+enum XizaoType {
+    feizao,
+    xiangzao,
+    muyulu,
+    shunmaogao
+}
+
+/**属性类型 */
+enum ATType {
+    jinbi,
+    tili,
+    qingjie
+
+}
+
+/**日常任务类型 */
+enum DailyTaskID {
+    jinbixiaohao = 26,
+    weishi,
+    qingjie,
+    wanshua,
+    songli = 30,
+    waichu,
+    zengsongjinbi,
+    haoyouzhuli,
+    huifuzhuangtai,
+    bimei = 35,
+    zhongjidajiang = 37
+}
+
+
+
+

+ 9 - 0
assets/Script/Manager/GameInfo.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "e0b27808-8b27-4dfa-b48c-07c780b39de9",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 40 - 0
assets/Script/Manager/LayerManager.ts

@@ -0,0 +1,40 @@
+/**
+ * 图层管理类
+ * @author xiongjian
+ * @date 2016/6/27
+ * 
+ */
+import { SingleClass } from "./SingleClass";
+import FrameworkCfg from "../../lightMVC/core/FrameworkCfg";
+const { ccclass, property } = cc._decorator;
+@ccclass
+export default class LayerManager extends SingleClass {
+    /**根容器*/
+    private rootLayer: cc.Node;
+    /**锁定动画层*/
+    public lockLayer: cc.Node;
+    /**提示语层*/
+    public tipLayer: cc.Node;
+
+
+    public constructor() {
+        super();
+
+        this.rootLayer = new cc.Node("rootLayer");
+        //this.rootLayer.addComponent(cc.BlockInputEvents);
+        cc.game.addPersistRootNode(this.rootLayer);
+        this.rootLayer.width = FrameworkCfg.DESIGN_RESOLUTION.width;
+        this.rootLayer.height = FrameworkCfg.DESIGN_RESOLUTION.height;
+        this.rootLayer.x = 360;
+        this.rootLayer.y = 640;
+
+        this.lockLayer = new cc.Node("lockLayer");
+        this.rootLayer.addChild(this.lockLayer);
+
+        this.tipLayer = new cc.Node("tipLayer");
+        this.rootLayer.addChild(this.tipLayer);
+    }
+
+
+
+} 

+ 9 - 0
assets/Script/Manager/LayerManager.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "20726158-a3e0-4e74-8dc2-160b55760ca0",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 19 - 0
assets/Script/Manager/SingleClass.ts

@@ -0,0 +1,19 @@
+import { BaseView } from "../../lightMVC/core/base/BaseView";
+/**
+ * 单例基类
+ * @author xiongjian
+ * @date 2016/10/11
+ */
+export class SingleClass extends BaseView{
+   
+    /**
+     * 获取一个单例
+     */
+    public static getInstance(): any {
+        var Class: any = this;
+        if(Class.instance == null) {
+            Class.instance = new Class();
+        }
+        return Class.instance;
+    }
+}

+ 9 - 0
assets/Script/Manager/SingleClass.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "1e871f2d-10f5-43b5-8f40-47c9cb8fec06",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 200 - 0
assets/Script/Manager/SoundManager.ts

@@ -0,0 +1,200 @@
+/**
+ * 声音管理类
+ * @author xiongjian
+ * @date 2016/6/30
+ */
+import { SingleClass } from "./SingleClass";
+import { dogType } from "./GameInfo";
+export class SoundManager extends SingleClass {
+    private soundList = {};                    //声音列表
+    private soundActList = {};                  //动作列表
+    private actChannelList = {};                //动作音道列表
+
+    private EffectAudioID: number;//音效的ID
+    private bgmChannelID: number;     //背景音声道
+    private clockChannelID: number;    //闹铃音声道
+    private actchannelID: number;      //动作音道
+    private actSound: cc.AudioClip;//动作声音
+    private _allowPlayEffect: boolean = true;   //是否允许播放音效
+    private _allowPlayBGM: boolean = true;      //是否允许播放背景音乐
+    private _effectVolume: number = 1;          //音效音量
+    private _bgmVolume: number = 1;             //背景音量
+
+    private jumpID: number = -1;      //跳跃音道
+
+    //大厅背景音乐, //菜单背景音乐,  //游戏背景音乐 
+    public static hallBgm: string[] = ["bgm_1.mp3", "bgm_2.mp3",  "bgm_3.mp3"] ;          
+
+    public static click: string = "click.mp3";//按钮点击
+    public static start: string = "start.mp3";// 开始游戏
+
+    public static addCoin: string = "addCoin.mp3";// 
+    public static cookingOver: string = "cookingOver.mp3";// 
+    
+    public static success: string[] = ["success_1.mp3", "success_2.mp3"];  // 胜利音效
+    public static fail: string = "fail_1.mp3";// 失败音效
+
+
+    public constructor() {
+        super();
+    }
+
+    /**将牌值转换未音效名 */
+    private changeCardValue(cardValue) {
+        return
+    }
+
+    /**
+     * 播放音效
+     * @param soundName 声音名
+     * @param loops 循环次数
+     */
+    public playEffect(soundName: string, loops: boolean = false) {
+        if (!this.allowPlayEffect) {
+            return;
+        }
+        //从声音列表中获取,声音列表中不存在,则从加载资源中获取
+        var sound: cc.AudioClip = this.soundList[soundName];
+        if (sound == null) {
+            cc.loader.loadRes("Audio/" + soundName, cc.AudioClip, (err, audioClip) => {
+                console.log("==>" + typeof audioClip);
+                this.soundList[soundName] = audioClip;
+                this.EffectAudioID = cc.audioEngine.playEffect(audioClip, loops);
+                cc.audioEngine.setVolume(this.EffectAudioID, this._effectVolume);
+            });
+        }
+        else {
+            this.EffectAudioID = cc.audioEngine.playEffect(sound, loops);
+            cc.audioEngine.setVolume(this.EffectAudioID, this._effectVolume);
+        }
+
+    }
+
+    private videoEffect: boolean = false;
+    private videoMusic: boolean = false;
+    /**观看视频音量关闭 */
+    public VideoStartStop() {
+        this.videoEffect = this._allowPlayEffect;
+        this.videoMusic = this._allowPlayBGM;
+        this._allowPlayEffect = false;
+        this.stopBGM();
+    }
+
+    /**观看视频音量开启*/
+    public VideoEndOpen() {
+        if (this.videoMusic) this.playBGM(SoundManager.hallBgm[2]);
+        this._allowPlayEffect = this.videoEffect;
+    }
+
+    /**
+     * 停止播放音效
+     */
+    public stopEffect() {
+        cc.audioEngine.stopAllEffects();
+        // if (!this.EffectAudioID) return;
+        // cc.audioEngine.stopEffect(this.EffectAudioID)
+    }
+
+
+
+
+
+    /**
+     * 播放背景音乐
+     * @param bgmName 背景音名
+     * @param startTime 播放起始位置
+     * @param loops 循环次数
+     */
+    public playBGM(bgmName: string, loops: boolean = true) {
+        if (this.allowPlayBGM == false) {// || this.bgmChannelID != null
+            return;
+        }
+        this.stopBGM();
+        console.log('播放背景音乐:bgmName', bgmName)
+        var bgm: cc.AudioClip = this.soundList[bgmName];
+        if (bgm == null) {
+            cc.loader.loadRes("Audio/" + bgmName, cc.AudioClip, (err, audioClip) => {
+                console.log("==>" + typeof audioClip);
+                this.soundList[bgmName] = audioClip;
+                // this.bgmChannelID = cc.audioEngine.play(audioClip, loops,this._bgmVolume);
+                this.bgmChannelID = cc.audioEngine.playMusic(audioClip, loops);
+                cc.audioEngine.setVolume(this.bgmChannelID, this._bgmVolume);
+            });
+        }
+        if (bgm) {
+            this.bgmChannelID = cc.audioEngine.playMusic(bgm, loops);
+            cc.audioEngine.setVolume(this.bgmChannelID, this._bgmVolume);
+        }
+
+    }
+
+    /**停止背景音乐*/
+    public stopBGM() {
+        // if (this.bgmChannelID) {
+        cc.audioEngine.stopMusic();
+        // cc.audioEngine.stop(this.bgmChannelID);
+        this.bgmChannelID = null;
+        // }
+    }
+
+
+    /**停止背景音乐*/
+    public stopClock() {
+        if (this.clockChannelID) {
+            cc.audioEngine.stop(this.clockChannelID);
+            this.clockChannelID = null;
+        }
+    }
+
+    /**获取是否允许播放音效*/
+    public get allowPlayEffect() {
+        return this._allowPlayEffect;
+    }
+
+    /**设置是否允许播放音效*/
+    public set allowPlayEffect(bAllow: boolean) {
+        this._allowPlayEffect = bAllow;
+    }
+
+    /**获取是否允许播放背景音*/
+    public get allowPlayBGM() {
+        return this._allowPlayBGM;
+    }
+
+    /**设置是否允许播放背景音*/
+    public set allowPlayBGM(bAllow: boolean) {
+        this._allowPlayBGM = bAllow;
+        if (this._allowPlayBGM == false) {
+            this.stopBGM();
+        } else {
+            this.playBGM(SoundManager.hallBgm[0]);
+        }
+    }
+
+    /**获取音效音量*/
+    public get effectVolume() {
+        return this._effectVolume;
+    }
+
+    /**设置音效音量*/
+    public set effectVolume(value: number) {
+        this._effectVolume = value;
+    }
+
+    /**获取BGM音量*/
+    public get bgmVolume() {
+        return this._bgmVolume;
+    }
+
+    /**设置BGM音量*/
+    public set bgmVolume(value: number) {
+        this._bgmVolume = value;
+        if (this.bgmChannelID) {
+            cc.audioEngine.setVolume(this.bgmChannelID, this._bgmVolume);
+        }
+    }
+
+
+
+
+}

+ 9 - 0
assets/Script/Manager/SoundManager.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "b6d756ce-9346-4388-9d29-38c2394f228f",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 51 - 0
assets/Script/Manager/SpinManager.ts

@@ -0,0 +1,51 @@
+import { SingleClass } from "./SingleClass";
+
+const { ccclass, property } = cc._decorator;
+export enum AnimType {
+    Dog = 1,
+    Daoju = 2,
+}
+@ccclass
+export default class SpinManager extends SingleClass {
+    // public spSkeleton: sp.Skeleton = null;//动画
+    // public currentAnimName: string = '';
+
+    // 更换动画资源
+    public ChangeSpineAnimation(node: cc.Node, path: string,  animationName: string, isLoop: boolean,  completeCallback: any = null, self: any = null, timeScale: number = 1){
+        let spSkeleton = node.getComponent(sp.Skeleton);
+        spSkeleton.loop = isLoop;
+        spSkeleton.timeScale = timeScale;
+        cc.assetManager.loadBundle("gameScene", (err,bundle)=>{
+            bundle.load(path, sp.SkeletonData, function (err: Error, data: sp.SkeletonData) {
+                    if (err) {
+                        console.log("err", err);
+                    } else {
+                        spSkeleton.skeletonData = data;           
+                    }
+                });
+        })
+    }
+
+    /**
+    * 播放spin动画
+    * @param animationName 动画名称
+    * @param completeCallback 播放回调
+    * @param isLoop 是否循环
+    */
+    public PlaySpinAnimation(node: cc.Node, animationName: string, isLoop: boolean, completeCallback: any = null, self: any = null, timeScale: number = 1) {
+        
+        let spinSkeleton = node.getComponent(sp.Skeleton);
+        spinSkeleton.loop = isLoop;
+        spinSkeleton.timeScale = timeScale;
+
+        console.log("aaa----播放动画", animationName, isLoop);
+
+        (completeCallback) ? spinSkeleton.setCompleteListener(completeCallback) : spinSkeleton.setCompleteListener(null);
+        spinSkeleton.setAnimation(1, animationName, isLoop);
+        // spinSkeleton.setEndListener(completeCallback);
+    }
+
+    public GetAnimationName(spinSkeleton: sp.Skeleton): string {
+        return spinSkeleton.animation;
+    }
+}

+ 9 - 0
assets/Script/Manager/SpinManager.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "e937f332-0fed-4a49-b656-78b2542fbacd",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 130 - 0
assets/Script/Manager/TipsManager.ts

@@ -0,0 +1,130 @@
+// Learn TypeScript:
+//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
+// Learn Attribute:
+//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
+// Learn life-cycle callbacks:
+//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
+
+import { SingleClass } from "./SingleClass";
+import { App } from "./App";
+import { ERewardType, EConsume } from "../Framework/Const/EnumDefine";
+const { ccclass, property } = cc._decorator;
+
+@ccclass
+export default class TipsManager extends SingleClass {
+    private hasShowTips: boolean = true;
+    private hasShowRewardTips: boolean = true;
+    public showmid(str: string, waitTime: number = 0.8) {
+        if (!this.hasShowTips)
+            return;
+        this.hasShowTips = false;
+        if (App.LayerManager.tipLayer && App.LayerManager.tipLayer.getChildByName("tipsBg")) {
+            let bgnode = App.LayerManager.tipLayer.getChildByName("tipsBg");
+            let nodeText = bgnode.getChildByName("tips");
+            nodeText.getComponent(cc.Label).string = str;
+            App.EffectUtils.smallToLarge(bgnode, waitTime, () => {
+                this.hasShowTips = true;
+            });
+        } else {
+            var nodeText = new cc.Node("tips");
+            var showtext = nodeText.addComponent(cc.Label);
+            var bgnode = new cc.Node("tipsBg");
+            let tipsBg: cc.Sprite = bgnode.addComponent(cc.Sprite);
+            cc.loader.loadRes("new_tips", cc.SpriteFrame, (err, spriteFrame) => {
+                if (err) {
+                    console.error(err);
+                    return;
+                }
+                tipsBg.spriteFrame = spriteFrame;
+                App.LayerManager.tipLayer && App.LayerManager.tipLayer.addChild(bgnode);
+                bgnode.x = 0;
+                bgnode.y = 0;
+                bgnode.addChild(nodeText);
+                showtext.string = str;
+                showtext.fontFamily = "SimHei";
+                showtext.fontSize = 30;
+                showtext.enableBold = true;
+                nodeText.color = new cc.Color(255, 255, 255);
+                nodeText.anchorX = 0;
+                nodeText.width = bgnode.width - 145;
+                nodeText.height = bgnode.height;
+                nodeText.y = 0;
+                nodeText.x = -145;
+                showtext.overflow = cc.Label.Overflow.CLAMP;
+                showtext.horizontalAlign = cc.Label.HorizontalAlign.LEFT;
+                showtext.verticalAlign = cc.Label.VerticalAlign.CENTER;
+                App.EffectUtils.smallToLarge(bgnode, waitTime, () => {
+                    this.hasShowTips = true;
+                });
+            });
+        }
+    }
+    public showReward(type: any[], data: any, waitTime: number = 0.5) {
+        if (!this.hasShowRewardTips)
+            return;
+        this.hasShowRewardTips = false;
+        let rewardTips = null;
+        // if (App.LayerManager.lockLayer && App.LayerManager.lockLayer.getChildByName("rewardTips")) {
+        //     rewardTips = App.LayerManager.lockLayer.getChildByName("rewardTips");
+        //     this.setRewardImg(rewardTips, type);
+        //     this.setRewardNum(rewardTips, data);
+        //     App.EffectUtils.bottomToTop(rewardTips, waitTime, () => {
+        //         this.hasShowRewardTips = true;
+        //     });
+        // } else {
+        App.LayerManager.lockLayer.addComponent(cc.Layout);
+        App.LayerManager.lockLayer.getComponent(cc.Layout).type = cc.Layout.Type.HORIZONTAL;
+        App.LayerManager.lockLayer.getComponent(cc.Layout).spacingX = 80;
+        App.LayerManager.lockLayer.width = 0;
+        App.LayerManager.lockLayer.height = 0;
+
+        App.LayerManager.lockLayer.y = 0;
+        cc.loader.loadRes("prefabs/rewardTips", cc.Prefab, (err, prefab) => {
+            if (err) {
+                console.error(err);
+                return;
+            }
+            for (let i = 0; i < type.length; i++) {
+                rewardTips = cc.instantiate(prefab);
+                rewardTips.name = "rewardTips" + i;
+                this.setRewardImg(rewardTips, type[i]);
+                this.setRewardNum(rewardTips, data[type[i]]);
+                App.LayerManager.lockLayer && App.LayerManager.lockLayer.addChild(rewardTips);
+                rewardTips.y = 20;
+                App.LayerManager.lockLayer.x = -20 * (type.length - 1);
+            }
+
+            App.EffectUtils.bottomToTop(App.LayerManager.lockLayer, waitTime, () => {
+                this.hasShowRewardTips = true;
+                App.LayerManager.lockLayer.removeAllChildren();
+            });
+        });
+    }
+    //设置获奖的图片
+    private setRewardImg(node: cc.Node, type: EConsume) {
+        let rewardImgArray = {
+            "1": "icon.png",
+            "201": "hall_icon_weishi_new.png",
+            "203": "clear1.png",
+            "202": "feipan1.png",
+            "101": "qinmidu.png",
+            "102": "mp_t3",
+            "103": "mp_t2",
+            "104": "mp_t1",
+        }
+        cc.loader.loadRes(rewardImgArray[type], cc.SpriteFrame, (err, SpriteFrame) => {
+            if (err) {
+                console.error(err);
+                return;
+            }
+            node.getChildByName("image").getComponent(cc.Sprite).spriteFrame = SpriteFrame;
+        });
+
+        // let rewardImgArray = ["icon.png", "hall_icon_weishi_new.png", "clear1.png", "feipan1.png", "qinmidu.png"];
+
+    }
+    //设置获奖的数量
+    private setRewardNum(node: cc.Node, sum: string) {
+        node.getChildByName("image").getChildByName("label").getComponent(cc.Label).string = '+' + sum;
+    }
+}

+ 9 - 0
assets/Script/Manager/TipsManager.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "ecf49bfd-0e8a-446f-9434-b12cb50acd97",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 45 - 0
assets/Script/Manager/XButton.ts

@@ -0,0 +1,45 @@
+// Learn TypeScript:
+//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
+// Learn Attribute:
+//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
+// Learn life-cycle callbacks:
+//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
+import { App } from "./App";
+import { SoundManager } from "./SoundManager";
+const { ccclass, property } = cc._decorator;
+
+@ccclass
+export default class XButton extends cc.Component {
+
+    onLoad() {
+
+    }
+    private onTouchDown(event) {
+        this.playOutAnim();
+        App.SoundManager.playEffect(SoundManager.click);
+    }
+    private onTouchUp(event) {
+        this.playBackAnim();
+    }
+    //播放扩展动画
+    private playOutAnim() {
+        cc.tween(this.node).set({ scale: 1 }).to(0.2, { scale: 0.9 }).start();
+    }
+    //播放收缩动画
+    private playBackAnim() {
+        cc.tween(this.node).stop()
+        cc.tween(this.node).to(0.2, { scale: 1 }).call(() => {
+            cc.tween(this.node).removeSelf()
+        }).start();
+    }
+
+
+    start() {
+        this.node.on(cc.Node.EventType.TOUCH_END, this.onTouchUp.bind(this), this.node);
+        this.node.on(cc.Node.EventType.TOUCH_CANCEL, this.onTouchUp.bind(this), this.node);
+        this.node.on(cc.Node.EventType.TOUCH_START, this.onTouchDown.bind(this), this.node);
+      
+    }
+
+    // update (dt) {}
+}

+ 9 - 0
assets/Script/Manager/XButton.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "b81015ae-719e-4fc2-ab4c-fd12473241ca",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 40 - 0
assets/Script/Manager/XProcess.ts

@@ -0,0 +1,40 @@
+// Learn TypeScript:
+//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
+// Learn Attribute:
+//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
+// Learn life-cycle callbacks:
+//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
+
+const { ccclass, property } = cc._decorator;
+
+@ccclass
+export default class XProcess extends cc.Component {
+
+    @property(cc.Node)
+    process: cc.Node = null;
+    @property(cc.Label)
+    processLabel: cc.Label = null;
+
+    private ProcessWidth: number = 0;
+
+    onLoad() {
+        this.ProcessWidth = this.node.width;
+    }
+    public showProcessLabel() {
+        if (!this.processLabel.node.activeInHierarchy)
+            this.processLabel.node.active = true;
+    }
+    public setProcess(processNum: number, processstr: string = "0/0") {
+        
+        this.processLabel.string = processstr;
+        if (processNum > 1)
+            processNum = 1;
+        this.process.width = this.node.width * processNum;
+    }
+
+    start() {
+
+    }
+
+    // update (dt) {}
+}

+ 9 - 0
assets/Script/Manager/XProcess.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "d1080978-b182-4f96-b359-0ae030c2f75e",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 30 - 0
assets/Script/Notification.ts

@@ -0,0 +1,30 @@
+
+export default class Notification {
+    static readonly START_PLAY_FeiPan = "START_PLAY_FeiPan";//开始玩飞盘
+    static readonly PLAY_FeiPan = "PLAY_FeiPan";//玩飞碟
+    static readonly PLAY_FeiPan_FINISH = "PLAY_FeiPan_FINISH";//玩飞碟完毕
+    static readonly START_PLAY_SHUMAO = "START_PLAY_SHUMAO";//开始梳毛
+    static readonly PLAY_SHUMAO = "PLAY_SHUMAO";//梳毛
+    static readonly PLAY_SHUMAO_FINISH = "PLAY_SHUMAO_FINISH";//梳毛完成
+    static readonly START_PLAY_BONE = "START_PLAY_BONE";//开始猜骨头
+    static readonly INTERACTION_FINISH = "INTERACTION_FINISH";//互动完毕
+    // static readonly REWARD_TIPS = "REWARD_TIPS";//奖励提示
+    /******************任务*********** */
+    static readonly CLOSETASKPANEL = "CLOSETASKPANEL";//关闭任务弹框
+    /**************刷新金币数******************** */
+    static readonly updateCoinNumber = "updateCoinNumber";//
+    /******************亲密度,体力,心情,喂食*********** */
+    static readonly ADD_WEISHI = "ADD_WEISHI";//添加喂食
+    /***********************提示泡泡******************** */
+    static readonly TIPS_PAOPAO = "TIPS_PAOPAO";
+    /*****************************屎******************* */
+    static readonly SHOW_SHI = "SHOW_SHI";
+
+    static readonly UPDATE_EXP_FINISH = "UPDATE_EXP_FINISH";
+
+
+    static readonly UPDATE_COIN = "UPDATE_COIN";//开始玩飞盘
+
+
+
+}

+ 9 - 0
assets/Script/Notification.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "3e9b906b-acc3-4c16-858c-dc05fec272fe",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 189 - 0
assets/Script/Person.ts

@@ -0,0 +1,189 @@
+import gameScene from "./gameScene";
+import { App } from "./Manager/App";
+import { SoundManager } from "./Manager/SoundManager";
+import Beef, { FoodType } from "./Beef";
+
+
+const {ccclass, property} = cc._decorator;
+
+export enum PersonState {
+    None = 0,
+    Comming,
+    Waite,
+    FullOut,
+    HungryOut,    
+};
+
+
+@ccclass
+export default class Person extends cc.Component {
+
+    @property(cc.ProgressBar)
+    pBar: cc.ProgressBar = null;
+
+    @property([cc.Prefab])
+    foodKindPerfabs: cc.Prefab[] = [];
+
+    @property(cc.Node)
+    meun: cc.Node = null;
+
+    @property(cc.Node)
+    love: cc.Node = null;
+    
+    m_state = PersonState.Comming;
+    
+    leftTime = 50;
+    m_pause = false;
+
+    foodNum = 3;    
+    foodList: cc.Node[] = [];
+    foodTypeList: FoodType[] = [];
+    foodPos: cc.Vec2[] = [cc.v2(-105, 70), cc.v2(-105, 25), cc.v2(-105, -20)];
+    // LIFE-CYCLE CALLBACKS:
+
+    onLoad () {        
+        this.meun.active = false;
+        this.love.active = false;
+        // 点餐的数量
+        // this.foodNum = Math.ceil(Math.random() * 3);
+
+        for (let i = 0; i < this.foodNum; i++) {
+            this.foodTypeList[i] = FoodType.None;            
+        }
+
+        this.leftTime -= App.DataManager.CurrentIntoLevel;
+    }
+
+    start () {
+
+    }
+
+    public setState(state: PersonState){
+        this.m_state = state;
+        if(state == PersonState.Waite){
+            this.meun.active = true;
+            
+            this.love.active = true;
+            App.SpinManager.PlaySpinAnimation(this.love, "newAnimation", true);
+
+            let guideGood = [0, 1, 2];
+            let foodKind = App.DataManager.levelFoodKind[App.DataManager.CurrentIntoLevel - 1];
+            for (let i = 0; i < this.foodNum; i++) {
+
+                let foodIndex = Math.floor(Math.random() * foodKind);
+
+                if(App.DataManager.guideStep < 5){
+                    foodIndex = guideGood[i];
+                }
+
+                let food = cc.instantiate(this.foodKindPerfabs[foodIndex]);
+                food.setScale(0.5);
+                food.setPosition(this.foodPos[i]);
+                this.node.addChild(food);
+
+                this.foodList[i] = food;
+                this.foodTypeList[i] = foodIndex + 1;
+            }
+            
+            this.pBar.progress = 1;
+            if(!this.m_pause){
+                cc.tween(this.pBar).to(this.leftTime, {progress: 0}).call(()=>{
+                    this.setState(PersonState.HungryOut);
+                }).start();
+            }
+        }
+        else if(state == PersonState.FullOut){
+            App.DataManager.MissionComplete[2]++;
+            App.LocalStorageUtil.setJsonObj(App.LocalStorageUtil.list_missionComplete, App.DataManager.MissionComplete);
+
+            cc.Tween.stopAllByTarget(this.pBar);            
+            this.meun.active = false;
+            this.love.active = false;
+        }
+        else if(state == PersonState.HungryOut){
+            // gameFail
+            gameScene.instance.GameFail();
+        }
+    }
+
+    public getFoodWorldPos(foodt: FoodType): cc.Vec2{
+        for (let i = 0; i < this.foodNum; i++) {
+            if(this.foodTypeList[i] == foodt){
+
+                this.addFoodCoin(foodt);
+                this.foodTypeList[i] = FoodType.None;
+
+                cc.tween(this.foodList[i]).delay(0.5).call(()=>{
+                    this.foodList[i].removeFromParent();                
+                    this.foodList[i] = null;                
+                }).start();        
+
+                return this.node.convertToWorldSpaceAR(this.foodPos[i]);
+            }            
+        }
+    }
+
+    addFoodCoin(foodt: FoodType){
+        switch(foodt){
+            case FoodType.PureSteak:
+                App.DataManager.MissionComplete[0]++;    
+                gameScene.instance.curLevelWinCoin += App.DataManager.foodSoldCoin[0][App.DataManager.foodLevel[0]];
+            break;
+
+            case FoodType.Drink:
+                App.DataManager.MissionComplete[1]++;
+                gameScene.instance.curLevelWinCoin += App.DataManager.foodSoldCoin[1][App.DataManager.foodLevel[1]];
+            break;
+
+            case FoodType.CocumberSteak:
+                App.DataManager.MissionComplete[0]++;
+                gameScene.instance.curLevelWinCoin += App.DataManager.foodSoldCoin[0][App.DataManager.foodLevel[0]];
+                gameScene.instance.curLevelWinCoin += App.DataManager.foodSoldCoin[2][App.DataManager.foodLevel[2]];
+            break;
+
+            case FoodType.TomatoSteak:
+                App.DataManager.MissionComplete[0]++;
+                gameScene.instance.curLevelWinCoin += App.DataManager.foodSoldCoin[0][App.DataManager.foodLevel[0]];
+                gameScene.instance.curLevelWinCoin += App.DataManager.foodSoldCoin[3][App.DataManager.foodLevel[3]];
+            break;
+
+            case FoodType.YellowSteak:
+                App.DataManager.MissionComplete[0]++;
+                gameScene.instance.curLevelWinCoin += App.DataManager.foodSoldCoin[0][App.DataManager.foodLevel[0]];
+                gameScene.instance.curLevelWinCoin += App.DataManager.foodSoldCoin[4][App.DataManager.foodLevel[4]];
+            break;
+
+            case FoodType.RedSteak:
+                App.DataManager.MissionComplete[0]++;
+                gameScene.instance.curLevelWinCoin += App.DataManager.foodSoldCoin[0][App.DataManager.foodLevel[0]];
+                gameScene.instance.curLevelWinCoin += App.DataManager.foodSoldCoin[5][App.DataManager.foodLevel[5]];
+            break;
+        }
+
+        App.LocalStorageUtil.setJsonObj(App.LocalStorageUtil.list_missionComplete, App.DataManager.MissionComplete);
+        gameScene.instance.updateWinCoin();
+        App.SoundManager.playEffect(SoundManager.addCoin);
+    }
+
+    public judgeFoodFull(): boolean{
+        for (let i = 0; i < this.foodNum; i++) {
+
+            // console.log("aaa------judgeFoodFull----", this.foodTypeList[i]);
+
+            if(this.foodTypeList[i] != FoodType.None)
+            {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    update (dt) {
+        if(this.m_state != PersonState.Waite)
+            return;
+
+        if(!this.m_pause){
+            this.leftTime -= dt;
+        }    
+    }
+}

+ 9 - 0
assets/Script/Person.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "5c78a515-c607-4276-a114-53df4825f885",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 454 - 0
assets/Script/Table.ts

@@ -0,0 +1,454 @@
+import Beef, { BeefState, FoodType } from "./Beef";
+import gameScene from "./gameScene";
+import guidePanel from "./guide/guidePanel";
+import { App } from "./Manager/App";
+import Person, { PersonState } from "./Person";
+
+
+const {ccclass, property} = cc._decorator;
+
+
+@ccclass
+export default class Table extends cc.Component {
+    private static _instance: Table = null;
+
+    // @property([cc.SpriteFrame])
+    // private tableSpriteFrame: cc.SpriteFrame[] = [];
+
+    @property(cc.Button)
+    btnShengNiuPai: cc.Button = null;
+
+    rawSteakList: cc.Node[] = [null, null, null, null];
+    cookedSteakList: cc.Node[] = [null, null, null, null];    
+
+    @property(cc.Prefab)
+    prefabBeef: cc.Prefab = null;
+
+    @property(cc.Button)
+    btnYellowSouce: cc.Button = null;
+
+    @property(cc.Button)
+    btnCocumber: cc.Button = null;
+
+    @property(cc.Button)
+    btnTomato: cc.Button = null;
+
+    @property(cc.Button)
+    btnRedSouce: cc.Button = null;
+
+    @property(cc.Node)
+    liuShui: cc.Node = null;
+
+    @property(cc.Node)
+    drinkCup: cc.Node = null;
+
+    @property([cc.Node])
+    kaoPanGaiZi: cc.Node[] = [];
+
+    @property([cc.Node])
+    plateGaiZi: cc.Node[] = [];
+
+    @property([cc.Node])
+    cupGaiZi: cc.Node[] = [];
+
+    @property(cc.ProgressBar)
+    pDrinkBar: cc.ProgressBar = null;
+
+    m_shuiLiuTime = 3;
+
+    @property(cc.Prefab)
+    fullCup: cc.Prefab = null;
+
+    drinkCupList: cc.Node[] = [];
+
+    kaoPanNum = 2;
+    plateNum = 2;
+    cupNum = 3;
+
+    beefBornPos: cc.Vec3[] = [cc.v3(-290, -185, 0), cc.v3(-197, -195, 0), cc.v3(-243, -131, 0), cc.v3(-160, -133, 0)];
+    platePos: cc.Vec3[] = [cc.v3(-58, -200, 0), cc.v3(80, -201, 0), cc.v3(-52, -126, 0), cc.v3(68, -131, 0)];
+    burntPos: cc.Vec3 = cc.v3(-360, -640, 0);
+    cupPos: cc.Vec3[] = [cc.v3(258, -209, 0), cc.v3(232, -161, 0), cc.v3(205, -115, 0)];
+
+// ------------------------person---------------------------
+    @property([cc.Prefab])
+    renwuPerfabList:cc.Prefab[] = [];
+
+    personList: cc.Node[] = [];
+
+    // 点餐位置
+    personPos:cc.Vec3[] = [cc.v3(30, 38, 0), cc.v3(260, 38, 0), cc.v3(-200, 38, 0)];
+    // 人物出生位置
+    bornPos: cc.Vec3[] = [cc.v3(-500, 38, 0), cc.v3(550, 38, 0)];
+
+    fixTime = 1;
+    passTime = 0;
+
+    personWalkTime = 2;
+    createpPersonNum = 0;  //已经来了到少人
+    fullPersonNum = 0;    //多少吃饱了
+    maxSitPersonNum = 3; //总共只能坐下人数
+
+
+    // LIFE-CYCLE CALLBACKS:
+
+    public static getInstance(): any {
+        if (this._instance == null) {
+            this._instance = new Table();
+        }
+        return this._instance;
+    }
+
+    onLoad () {
+        Table._instance = this;            
+
+        this.btnShengNiuPai.node.on(cc.Node.EventType.TOUCH_END, this.onClickShengNiuPai.bind(this), this);
+        this.btnYellowSouce.node.on(cc.Node.EventType.TOUCH_END, this.onClickYellowSouce.bind(this), this);
+        this.btnCocumber.node.on(cc.Node.EventType.TOUCH_END, this.onClickCocumber.bind(this), this);
+        this.btnTomato.node.on(cc.Node.EventType.TOUCH_END, this.onClickTomato.bind(this), this);
+        this.btnRedSouce.node.on(cc.Node.EventType.TOUCH_END, this.onClickRedSouce.bind(this), this);
+        // this.drinksMachine.node.on(cc.Node.EventType.TOUCH_END, this.onClickDrinksMachine.bind(this), this);
+
+        for (let i = 0; i < this.maxSitPersonNum; i++) {
+            this.personList[i] = null;
+        }
+
+        this.plateNum = App.DataManager.kitchenNum[0][App.DataManager.kinchenLevel[0]];
+        this.kaoPanNum = App.DataManager.kitchenNum[1][App.DataManager.kinchenLevel[1]];
+        this.cupNum = App.DataManager.kitchenNum[2][App.DataManager.kinchenLevel[2]];
+    }
+
+    start () {    
+        for (let i = 0; i < this.kaoPanNum - 2; i++) {
+            this.kaoPanGaiZi[i].active = false            
+        }
+
+        for (let i = 0; i < this.plateNum - 2; i++) {
+            this.plateGaiZi[i].active = true            
+        }
+
+        for (let i = 0; i < this.cupNum - 1; i++) {
+            this.cupGaiZi[i].active = true            
+        }
+
+        if(App.DataManager.CurrentIntoLevel >= 3){
+            this.btnTomato.node.active = true;
+        }
+        if(App.DataManager.CurrentIntoLevel >= 5){
+            this.btnYellowSouce.node.active = true;
+        }
+        if(App.DataManager.CurrentIntoLevel >= 7){
+            this.btnRedSouce.node.active = true;
+        }
+
+        this.onClickDrinksMachine();
+
+        if(App.DataManager.guideStep == 0){
+            guidePanel.getInstance().showCurGuide();
+        }
+    }
+
+    onClickShengNiuPai(){
+
+        if(App.DataManager.guideStep == 0){
+            App.DataManager.guideStep++;        
+            App.LocalStorageUtil.setNumber(App.LocalStorageUtil.str_guideStep, App.DataManager.guideStep);    
+            guidePanel.getInstance().hideGuideStep();
+        }
+        
+
+        for (let i = 0; i < this.kaoPanNum; i++) {
+            if(this.rawSteakList[i] == null){
+                let beef = cc.instantiate(this.prefabBeef);
+                beef.on(cc.Node.EventType.TOUCH_END, this.onClickRawBeef.bind(this, i), beef);
+                beef.setPosition(this.beefBornPos[i]);
+                this.node.addChild(beef);
+                this.rawSteakList[i] = beef; 
+                break;
+            }            
+        }
+    }
+
+    onClickRawBeef(index: number){
+
+        if(this.rawSteakList[index].getComponent(Beef).m_state == BeefState.Burnt){
+            cc.tween(this.rawSteakList[index]).to(0.5, {position: this.burntPos}).removeSelf().start()
+            this.rawSteakList[index] = null;
+            return;
+        }
+        else if(this.rawSteakList[index].getComponent(Beef).m_state == BeefState.Cooked){
+            for (let i = 0; i < this.plateNum; i++) {
+                if(!this.cookedSteakList[i])
+                {
+                    this.rawSteakList[index].targetOff(this.rawSteakList[index]);
+
+                    // this.rawSteakList[index].off(cc.Node.EventType.TOUCH_END, this.onClickRawBeef.bind(this, index), this);
+                    this.cookedSteakList[i] = this.rawSteakList[index];
+                    this.rawSteakList[index] = null;
+
+                    
+                    // 从烤架移动到盘子里面
+                    this.cookedSteakList[i].getComponent(Beef).setState(BeefState.Plate);
+                    this.cookedSteakList[i].on(cc.Node.EventType.TOUCH_END, this.onClickCookedBeef.bind(this, i), this);                    
+                    cc.tween(this.cookedSteakList[i]).to(0.5, {position: this.platePos[i]}).start()
+                    break;
+                }
+            }
+
+            if(App.DataManager.guideStep == 1){                
+                App.DataManager.guideStep++;                
+                App.LocalStorageUtil.setNumber(App.LocalStorageUtil.str_guideStep, App.DataManager.guideStep);
+                guidePanel.getInstance().showCurGuide();
+            }
+            
+        }        
+    }
+
+    // 点击熟牛排
+    onClickCookedBeef(index: number){
+
+        if(App.DataManager.guideStep == 3){                
+            App.DataManager.guideStep++;      
+            App.LocalStorageUtil.setNumber(App.LocalStorageUtil.str_guideStep, App.DataManager.guideStep);          
+            guidePanel.getInstance().showCurGuide();
+        }
+        // todo 移动到人        
+        // 移动到人之后,从数组里面删除
+        let toPos = this.findFoodPos(this.cookedSteakList[index].getComponent(Beef).m_foodType);
+
+        if(toPos){            
+            let pos = this.node.convertToNodeSpaceAR(toPos);
+            cc.tween(this.cookedSteakList[index]).to(0.5, {position: pos, scale: 0.5}).removeSelf().start();
+            this.cookedSteakList[index] = null;
+        }
+    }
+
+    onClickYellowSouce(){
+        for (let i = 0; i < this.cookedSteakList.length; i++) {
+            if(this.cookedSteakList[i] && this.cookedSteakList[i].getComponent(Beef).m_state == BeefState.Cocumber){                
+                this.cookedSteakList[i].getComponent(Beef).setState(BeefState.YellowSouce);
+                break;
+            }            
+        }
+    }
+
+
+    onClickCocumber(){
+        if(App.DataManager.guideStep == 2){                
+            App.DataManager.guideStep++;                
+            App.LocalStorageUtil.setNumber(App.LocalStorageUtil.str_guideStep, App.DataManager.guideStep);
+            guidePanel.getInstance().showCurGuide();
+        }
+
+        for (let i = 0; i < this.cookedSteakList.length; i++) {
+            if(this.cookedSteakList[i] && this.cookedSteakList[i].getComponent(Beef).m_state == BeefState.Plate){                
+                this.cookedSteakList[i].getComponent(Beef).setState(BeefState.Cocumber);
+                break;
+            }            
+        }        
+    }
+
+    onClickTomato(){
+        for (let i = 0; i < this.cookedSteakList.length; i++) {
+            if(this.cookedSteakList[i] && this.cookedSteakList[i].getComponent(Beef).m_state == BeefState.Plate){                
+                this.cookedSteakList[i].getComponent(Beef).setState(BeefState.Tomato);
+                break;
+            }            
+        }        
+    }
+
+    onClickRedSouce(){
+        for (let i = 0; i < this.cookedSteakList.length; i++) {
+            if(this.cookedSteakList[i] && this.cookedSteakList[i].getComponent(Beef).m_state == BeefState.Tomato){                
+                this.cookedSteakList[i].getComponent(Beef).setState(BeefState.RedSouce);
+                break;
+            }            
+        }        
+    }
+
+    onClickDrinksMachine(){
+
+        this.pDrinkBar.node.active = true;
+        this.liuShui.active = true;
+        App.SpinManager.PlaySpinAnimation(this.liuShui, "newAnimation", true, null); 
+        App.SpinManager.PlaySpinAnimation(this.drinkCup, "newAnimation", false, null); 
+        
+        this.pDrinkBar.progress = 0;
+        cc.tween(this.pDrinkBar).to(this.m_shuiLiuTime, {progress: 1}).call(()=>{
+            this.pDrinkBar.node.active = false;  
+            this.liuShui.active = false;
+
+            this.drinkCup.getComponent(sp.Skeleton).animation = null;
+        
+            for (let i = 0; i < this.cupNum; i++) {
+                if(!this.drinkCupList[i])
+                {
+                    let cup = cc.instantiate(this.fullCup);
+                    cup.setPosition(this.drinkCup.getPosition());
+                    this.node.addChild(cup);
+                    cup.zIndex = this.cupNum - i;
+                    this.drinkCupList[i] = cup;
+
+                    cup.on(cc.Node.EventType.TOUCH_END, this.onClickFullCup.bind(this, i), this);
+                    
+                    if(i == 0){
+                        cc.tween(cup).to(0.5, {position: this.cupPos[0]}).start();
+                    }
+                    else{
+                        cc.tween(cup).to(0.5, {position: this.cupPos[0]}).to(0.2, {position: this.cupPos[i]}).start();
+                    }
+                }
+            }            
+        }).start();        
+    }
+    
+    // 点击饮料
+    onClickFullCup(index: number){
+        // todo 移动到人
+        if(App.DataManager.guideStep == 4){
+            App.DataManager.guideStep++;                        
+            App.LocalStorageUtil.setNumber(App.LocalStorageUtil.str_guideStep, App.DataManager.guideStep);
+            guidePanel.getInstance().hideGuideStep();
+        }
+        
+        // 移动到人之后,从数组里面删除
+        let toPos = this.findFoodPos(FoodType.Drink);
+
+        if(toPos){            
+            let pos = this.node.convertToNodeSpaceAR(toPos);
+            cc.tween(this.drinkCupList[index]).to(0.3, {position: pos, scale: 0.5}).removeSelf().start();
+            this.drinkCupList[index] = null;
+            // this.m_machineState = DrinksMachineState.None;
+         
+            this.onClickDrinksMachine();
+        }
+    }
+
+
+    onDisable() {                
+        this.btnShengNiuPai.node.off(cc.Node.EventType.TOUCH_END, this.onClickShengNiuPai.bind(this), this);
+        this.btnYellowSouce.node.off(cc.Node.EventType.TOUCH_END, this.onClickYellowSouce.bind(this), this);
+        this.btnCocumber.node.off(cc.Node.EventType.TOUCH_END, this.onClickCocumber.bind(this), this);
+        this.btnTomato.node.off(cc.Node.EventType.TOUCH_END, this.onClickTomato.bind(this), this);
+        this.btnRedSouce.node.off(cc.Node.EventType.TOUCH_END, this.onClickRedSouce.bind(this), this);
+    }
+
+
+
+
+
+
+    // 找到点这个食物剩余时间最少的人
+    findFoodPos(foodt: FoodType): cc.Vec3 {
+
+        let curPerson = null;
+        let personIndex = -1;
+        let lessLeftTime = 100;
+
+        for (let i = 0; i < this.maxSitPersonNum; i++) {
+            if(this.personList[i] && this.personList[i].getComponent(Person).m_state == PersonState.Waite){
+                // 点餐种类
+                let fTypelist = this.personList[i].getComponent(Person).foodTypeList;
+                let time = this.personList[i].getComponent(Person).leftTime;
+                for (let j = 0; j < fTypelist.length; j++) {
+                    if(foodt == fTypelist[j] && lessLeftTime > time){
+                        lessLeftTime = time;
+                        personIndex = i;
+                        curPerson = this.personList[i];                        
+                    }                    
+                }
+            }
+        }
+
+        if(curPerson){
+
+            let worldPos = curPerson.getComponent(Person).getFoodWorldPos(foodt);
+
+            if(curPerson.getComponent(Person).judgeFoodFull()){
+                                
+                this.fullPersonNum++;
+                let smallLevel = App.DataManager.PassProgress[App.DataManager.CurrentIntoLevel];
+                if(this.fullPersonNum == App.DataManager.personCount[App.DataManager.CurrentIntoLevel - 1][smallLevel - 1]){
+                    // GameSuccess
+                    this.personList[personIndex] = null;
+                    let rand = Math.round(Math.random());                  
+
+                    cc.tween(curPerson).delay(0.6).call(()=>{
+                        curPerson.getComponent(Person).setState(PersonState.FullOut);
+                        if(rand == 1){
+                            curPerson.getChildByName("renwu").scaleX = -0.5;
+                        }
+
+                    }).to( this.personWalkTime,  {position: this.bornPos[rand]}).call(()=>{                                         
+                        curPerson.removeFromParent();                                        
+                    }).start();
+                    
+                    gameScene.instance.GameSuccess();
+
+                }
+                else{
+                    let rand = Math.round(Math.random());                                    
+                    this.personList[personIndex] = null
+
+                    cc.tween(curPerson).delay(0.6).call(()=>{
+
+                        curPerson.getComponent(Person).setState(PersonState.FullOut);
+                        if(rand == 1){
+                            curPerson.getChildByName("renwu").scaleX = -0.5;
+                        }
+
+                    }).to( this.personWalkTime,  {position: this.bornPos[rand]}).call(()=>{                                         
+                        curPerson.removeFromParent();                                        
+                    }).start();
+                }
+            }
+
+            return worldPos;
+        }
+
+        return null;
+    }
+
+
+    update (dt) {
+        if (!gameScene.instance.GameStutas) return;
+
+        this.passTime+=dt;
+        let smallLevel = App.DataManager.PassProgress[App.DataManager.CurrentIntoLevel];
+        if(this.passTime >= this.fixTime && this.createpPersonNum < App.DataManager.personCount[App.DataManager.CurrentIntoLevel - 1][smallLevel - 1]){
+            this.passTime = 0;
+            this.fixTime = 1;
+
+            console.log("aaa-------randomIndex---------", smallLevel);
+
+            for (let i = 0; i < this.maxSitPersonNum; i++) {
+                if(!this.personList[i]){
+
+                    let randomIndex = Math.floor(Math.random() * this.renwuPerfabList.length);                                        
+                    let person = cc.instantiate(this.renwuPerfabList[randomIndex]) 
+                    person.getComponent(Person).setState(PersonState.Comming);
+                    person.zIndex = -1;
+                    this.node.addChild(person);
+                    this.personList[i] = person;                                        
+
+                    let rand = Math.round(Math.random());
+                    person.setPosition(this.bornPos[rand]);
+                    if(rand == 0){     
+                        person.getChildByName("renwu").scaleX = -0.5;
+                    }
+
+                    App.SpinManager.PlaySpinAnimation(person.getChildByName("renwu"), "newAnimation", true);
+                    cc.tween(person).to(this.personWalkTime, {position: this.personPos[i]}).call(()=>{
+                        person.getChildByName("renwu").scaleX = 0.5;
+                        person.getComponent(Person).setState(PersonState.Waite);
+                    }).start();
+
+                    this.createpPersonNum++;
+                    let smallLevel = App.DataManager.PassProgress[App.DataManager.CurrentIntoLevel];
+                    gameScene.instance.updateLeftPeople(App.DataManager.personCount[App.DataManager.CurrentIntoLevel - 1][smallLevel - 1] - this.createpPersonNum);
+                    break;
+                }
+            }
+        }
+    }    
+}

+ 9 - 0
assets/Script/Table.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "3c877c8f-8ef6-4543-9246-a2f90fe634cf",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 111 - 0
assets/Script/TimeControl.ts

@@ -0,0 +1,111 @@
+import { App } from "./Manager/App";
+import hallModel from "./model/hallModel";
+
+const { ccclass, property } = cc._decorator;
+
+@ccclass
+export default class TimeControl extends cc.Component {
+
+    public static _instance;
+    private currentTimeCount = 60;//_当前倒计时秒数
+    private timeCount = 60;//体力倒计时长
+    private consumeTili = -1;// 每局消耗体力
+    private tiliMax: number = 10;//体力最大值
+    private currentTili: number = 10;//当前体力
+    public static get instance() {
+        return TimeControl._instance;
+    }
+    public static set instance(value) {
+        TimeControl._instance = value
+    }
+
+    onLoad(): void {
+        TimeControl.instance = this;
+        App.Facade.registerModel(hallModel);
+        this.InitTimeLocal();
+    }
+
+    /**
+     * 初始化当前缓存
+     */
+    InitTimeLocal(): void {
+        var SausageCountTime = App.LocalStorageUtil.getNumber(App.LocalStorageUtil.lst_CountTime);
+        if (!SausageCountTime) App.LocalStorageUtil.setNumber(App.LocalStorageUtil.lst_CountTime, Date.parse(new Date().toString()));
+        var SausageCountSecond = App.LocalStorageUtil.getNumber(App.LocalStorageUtil.lst_CountSecond);
+        if (!SausageCountSecond) App.LocalStorageUtil.setNumber(App.LocalStorageUtil.lst_CountSecond, 0);
+
+        var SausageTili = App.LocalStorageUtil.getNumber(App.LocalStorageUtil.lst_Tili);
+        if (!SausageTili) App.LocalStorageUtil.setNumber(App.LocalStorageUtil.lst_Tili, TimeControl.instance.currentTili);
+        else this.currentTili = Number(SausageTili);
+
+    }
+
+    private CountTili() {//倒计时体力
+        App.Facade.getModel(hallModel).updateTiliNumber();
+        if (App.DataManager.TimeFlag) return;
+        App.DataManager.TimeFlag = true;
+        this.schedule(this.CountFunc, 1);
+    }
+    private CountFunc() {
+        if (this.currentTili >= this.tiliMax) {
+            this.StopCount();
+            return;
+        }
+
+        this.currentTimeCount -= 1;
+        App.Facade.getModel(hallModel).updateTiliJishi(true, App.DataManager.TimeChange(this.currentTimeCount));
+        if (this.currentTimeCount <= 0) {
+            this.currentTimeCount = this.timeCount;
+            App.DataManager.UpdateTili(1);
+            App.Facade.getModel(hallModel).updateTiliNumber();
+        }
+    }
+
+
+    private OfflineTime() {
+
+        var _currentTime = Date.parse(new Date().toString());
+        var _lastTime = App.LocalStorageUtil.getNumber(App.LocalStorageUtil.lst_CountTime);
+        var _miaoshu = App.LocalStorageUtil.getNumber(App.LocalStorageUtil.lst_CountSecond);
+        this.currentTimeCount = Number(_miaoshu);
+        var timeInterval = (_currentTime - Number(_lastTime)) / 1000;
+        var _temp = timeInterval - this.currentTimeCount;
+        if (_temp < 0) {
+            this.currentTimeCount = Math.abs(_temp);
+        } else {
+            if (_temp < this.timeCount) {
+                App.DataManager.UpdateTili(1);
+                this.currentTimeCount = this.timeCount - _temp;
+            } else {
+                var _temp2 = Math.floor(_temp / this.timeCount);
+                var _temp3 = Math.floor(_temp % this.timeCount);
+                var tempTili = this.currentTili + _temp2;
+                if (tempTili >= this.tiliMax) {
+                    this.currentTili = this.tiliMax;
+                    App.DataManager.SaveMessage();
+                } else {
+                    App.DataManager.UpdateTili(_temp2);
+                }
+                App.Facade.getModel(hallModel).updateTiliNumber();
+                this.currentTimeCount = this.timeCount - _temp3;
+            }
+            if (this.currentTili >= this.tiliMax) {
+                this.StopCount();
+            }
+        }
+
+        // console.log('OfflineTime:this.currentTimeCount', this.currentTimeCount, typeof (this.currentTimeCount));
+    }
+
+
+    private StopCount() {
+        this.currentTimeCount = this.timeCount;
+        this.unschedule(this.CountFunc);
+        App.Facade.getModel(hallModel).updateTiliJishi(false);
+        App.DataManager.TimeFlag = false;
+        console.log('StopCount:隐藏倒计时文本********************', App.DataManager.TimeFlag);
+    }
+
+
+
+}

+ 9 - 0
assets/Script/TimeControl.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "ca2e5557-7917-4e8b-a455-edd649a68d62",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 12 - 0
assets/Script/command.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "1e711d58-53ce-46d5-8ffb-eb605d7108ee",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 15 - 0
assets/Script/endPoint.ts

@@ -0,0 +1,15 @@
+
+import gameScene from "./gameScene";
+
+const { ccclass, property } = cc._decorator;
+
+@ccclass
+export default class endPoint extends cc.Component {
+
+    start() {//  onEnable() {
+        console.log('endPoint………………………………………………………………')
+        gameScene.instance.node.emit('SetSceneProgerss', this.node.y);
+    }
+
+    // update (dt) {}
+}

+ 9 - 0
assets/Script/endPoint.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "b7473ab0-0ff1-4985-9af6-feb93442a86c",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 328 - 0
assets/Script/gameScene.ts

@@ -0,0 +1,328 @@
+import { App } from "./Manager/App";
+import player from "./player";
+import FailPanelMediator from "./view/failPanel/FailPanelMediator";
+import FailPanel from "./view/failPanel/FailPanel";
+import SuccessPanelMediator from "./view/successPanel/SuccessPanelMediator";
+import SuccessPanel from "./view/successPanel/SuccessPanel";
+import InsufficientPanelMediator from "./view/insufficientPanel/InsufficientPanelMediator";
+import InsufficientPanel from "./view/insufficientPanel/InsufficientPanel";
+import TimeControl from "./TimeControl";
+import TipPanelMediator from "./view/tipPanel/TipPanelMediator";
+import TipPanel from "./view/tipPanel/TipPanel";
+import { SoundManager } from "./Manager/SoundManager";
+import SDK from "./sdk/SDK";
+import ChooseSkinPanel from "./view/chooseSkin/ChooseSkinPanel";
+import ChooseSkinPanelMediator from "./view/chooseSkin/ChooseSkinPanelMediator";
+import Enemy from "./Enemy";
+import ShopPanel from "./view/shopView/ShopPanel";
+import ShopPanelMediator from "./view/shopView/ShopPanelMediator";
+import SetNormalPanel from "./view/setNormal/SetNormalPanel";
+import SetNormalPanelMediator from "./view/setNormal/SetNormalPanelMediator";
+import { InterstitialType } from "./sdk/vivo/Interstitial";
+
+const { ccclass, property } = cc._decorator;
+
+@ccclass
+export default class gameScene extends cc.Component {
+
+    public static _instance;
+    
+
+    @property(cc.Node)
+    public bg: cc.Node = null;
+
+    @property([cc.SpriteFrame])
+    private bgSpriteFrame: cc.SpriteFrame[] = [];    
+
+    @property(cc.Node)
+    public levelParent: cc.Node = null;
+
+    @property(cc.Node)
+    public mainCamera: cc.Node = null;
+
+    @property(cc.Node)
+    public btnPause: cc.Node = null;    
+
+    @property(cc.Label)
+    public labelPersonNum: cc.Label = null;
+
+    @property(cc.Label)
+    public labelWinCoin: cc.Label = null;
+
+    public curLevelWinCoin = 0;
+
+
+    private GameStutas: boolean = false;
+    private mainSceneName: string = "hallScene";
+    private currentSceneName: string = "gameScene";
+
+
+public static get instance() {
+        return gameScene._instance;
+    }
+    public static set instance(value) {
+        gameScene._instance = value
+    }
+    onLoad() {
+        gameScene.instance = this;
+        this.GameStutas = false;
+
+        //开启触发功能
+        // var manager = cc.director.getCollisionManager();
+        // manager.enabled = true;
+        // manager.enabledDebugDraw = true;
+
+        // let phyManager = cc.director.getPhysicsManager();
+        // phyManager.enabled = true;
+
+        // var Bits = cc.PhysicsManager.DrawBits;
+        // phyManager.debugDrawFlags = Bits.e_aabbBit | Bits.e_shapeBit;
+
+        this.btnPause.on(cc.Node.EventType.TOUCH_END, this.ClickPause.bind(this), this);      
+        SDK.Instance.showInterstitial(InterstitialType.INTERSTITIAL_GAME_STARE);
+    }
+
+    start() {
+
+        let smallLevel = App.DataManager.PassProgress[App.DataManager.CurrentIntoLevel];
+        this.updateLeftPeople(App.DataManager.personCount[App.DataManager.CurrentIntoLevel - 1][smallLevel - 1]);
+        this.updateWinCoin();
+
+        // this.levelLabel.string = App.DataManager.CurrentIntoLevel.toString();        
+        this.bg.getComponent(cc.Sprite).spriteFrame = this.bgSpriteFrame[0]; 
+
+        // this.InstantLevel();
+        App.DataManager.resetFlag = false;
+
+        this.StartGame();
+    }
+
+
+    private SaveLevelData(nodes: any) {
+        let saves: any = [];
+        nodes.children.forEach(child => {
+            let childData = {
+                'name': child.name,
+                'x': child.x.toFixed(1),
+                'y': child.y.toFixed(1)
+            };
+            saves.push(childData);
+        });
+        let readLevel = '9';
+        App.LocalStorageUtil.setJsonObj('Stupid_' + readLevel, saves);
+        console.log('关卡号:', readLevel);
+        console.log('关卡数据:', saves);
+    }
+
+    /**   生成关卡数据   */
+    private InstantLevel(): void {
+        // if (App.DataManager.Configs.length < App.DataManager.CurrentIntoLevel) {
+        //     if (App.DataManager.InfiniteLevelDate[App.DataManager.CurrentIntoLevel]) {
+        //         this.InitLevel(App.DataManager.InfiniteLevelDate[App.DataManager.CurrentIntoLevel]);
+        //         return;
+        //     }
+        //     let value = App.DataManager.CurrentIntoLevel - App.DataManager.Configs.length;
+        //     let randomListLen = App.DataManager.RandomLevelList.length;
+        //     let yushu = value % randomListLen;
+        //     let randomArea = (yushu == 0) ? App.DataManager.RandomLevelList[randomListLen - 1] : App.DataManager.RandomLevelList[yushu - 1];
+        //     let levelValue = Math.round(Math.random() * (randomArea.endLevel - randomArea.startLevel)) + randomArea.startLevel;
+        //     this.InitLevel(levelValue);
+        //     App.DataManager.InfiniteLevelDate[App.DataManager.CurrentIntoLevel] = levelValue;
+        //     App.LocalStorageUtil.setJsonObj(App.LocalStorageUtil.lst_InfiniteLevelDate, App.DataManager.InfiniteLevelDate);
+        // } else {
+            this.InitLevel(App.DataManager.CurrentIntoLevel);
+        // }
+    }
+
+    // 初始化关卡
+    private InitLevel(index: number): void {
+        // let datas = App.DataManager.Configs[index].json;
+        // datas.forEach(element => {
+        //     var nodes = cc.instantiate(App.DataManager.PropPrefabs[element.name]);
+        //     this.levelParent.addChild(nodes);
+        //     nodes.x = Number(element.x);
+        //     nodes.y = Number(element.y);
+        // });
+
+        var level = cc.instantiate(App.DataManager.PropPrefabs[ "level" + index ]);
+        this.levelParent.addChild(level);
+    }    
+
+    /** 开始游戏 */
+    public StartGame(): void {
+        this.GameStutas = true;
+        App.SoundManager.playEffect(SoundManager.start);
+        App.SoundManager.playBGM(SoundManager.hallBgm[2]);
+    }
+
+    public updateLeftPeople(peopleNum: number){
+        this.labelPersonNum.string = peopleNum + "";
+    }
+
+    public updateWinCoin(){
+        this.labelWinCoin.string = this.curLevelWinCoin + "";
+    }
+
+    private ClickPause(): void {                
+        App.Facade.popView(SetNormalPanelMediator, SetNormalPanel, "设置",  false);
+        cc.director.pause();
+    }   
+
+    private ClickGoOn(): void {
+        
+    }
+
+    public ClickRestart(): void {
+        App.DataManager.resetFlag = true;
+        this.LoadLevel();
+    }
+
+    /**
+     * 点击返回主页
+     */
+     private ClickBackMain(): void {
+        cc.director.loadScene(this.mainSceneName);
+    }
+
+
+    /**
+     * 跳关
+     */
+    private JumpLevel(): void {
+        console.log('观看视频后跳关~');
+        this.JumpNextLevel();
+    }
+
+    // 
+    private replay(): void{
+        cc.director.loadScene(this.currentSceneName);
+    }
+
+    /**
+     * 加载关卡
+     */
+    private LoadLevel(): void {
+        App.DataManager.UpdateTili(TimeControl.instance.consumeTili, (success) => {
+            if (success) cc.director.loadScene(this.currentSceneName);
+            else App.Facade.popView(InsufficientPanelMediator, InsufficientPanel, "体力不足", false);
+        });
+    }
+
+
+    /**
+     * 下一关
+     */
+    private JumpNextLevel(): void {
+        this.NextLevelDateUpdate();
+        this.LoadLevel();
+    }
+
+    /**
+     * 点击下一关后数据更新
+     */
+    private NextLevelDateUpdate(): void {
+
+        if(App.DataManager.PassProgress[App.DataManager.CurrentIntoLevel] > 3){
+
+            App.DataManager.CurrentIntoLevel++;
+            App.DataManager.PlayLevel = App.DataManager.CurrentIntoLevel;    
+            App.LocalStorageUtil.setNumber(App.LocalStorageUtil.lst_playLevel, App.DataManager.PlayLevel);
+        } 
+        
+        while(App.DataManager.PassProgress[App.DataManager.CurrentIntoLevel] > 3){
+            App.DataManager.CurrentIntoLevel++;
+            App.DataManager.PlayLevel = App.DataManager.CurrentIntoLevel;    
+            App.LocalStorageUtil.setNumber(App.LocalStorageUtil.lst_playLevel, App.DataManager.PlayLevel);
+        }
+    }
+
+
+    /**
+     * 更新通关数
+     */
+    private UpdateLocalLevel() {
+        var current = Number(App.DataManager.CurrentIntoLevel);        
+        console.log('UpdateLocalLevel', current, App.DataManager.PassProgress[current])
+        
+        if(App.DataManager.PassProgress[current]){
+            App.DataManager.PassProgress[current]++;
+        }
+
+        if (!App.DataManager.PassProgress[current + 1]) {
+            App.DataManager.PassProgress[current + 1] = 1;
+        }
+        App.LocalStorageUtil.setJsonObj(App.LocalStorageUtil.lst_passProgress, App.DataManager.PassProgress);
+        // this.UpdateGetSkin();
+    }
+
+    private OpenChooseSkin() {
+        App.Facade.popView(ChooseSkinPanelMediator, ChooseSkinPanel, '皮肤界面', false);
+    }
+
+    private UpdateGetSkin() {
+        let passLevelCount = Object.keys(App.DataManager.PassProgress).length - 1;
+        App.DataManager.MissionDataList.forEach(element => {
+            let pass = element.passLevel;
+            let hasGetSkin = (passLevelCount >= pass) ? true : false;
+            if (hasGetSkin) {
+                let hasSave = App.DataManager.GetSkins.indexOf(element.getSkin);
+                if (hasSave == -1) {
+                    App.DataManager.GetSkins.push(element.getSkin);
+                    App.LocalStorageUtil.setJsonObj(App.LocalStorageUtil.lst_getSkin, App.DataManager.GetSkins);
+                    console.log('通关获得新皮肤')
+                    // this.newSkinTips.active = true;
+                    App.DataManager.NewSkinName = element.getSkin;
+                    App.DataManager.GetNewSkinFlag = true;
+                    this.scheduleOnce(() => { App.Facade.popView(TipPanelMediator, TipPanel, "通关获得新皮肤~", false); }, 0);
+                }
+            }
+        });
+    }
+
+    /**
+     * 游戏成功
+     */
+     private GameSuccess(): void {
+
+        console.log('游戏成功***********');
+        this.GameComplete();
+        App.SoundManager.playEffect(SoundManager.success[Math.floor(Math.random() * 2)]);
+        this.UpdateLocalLevel();
+
+        this.scheduleOnce(() => {
+            App.Facade.popView(SuccessPanelMediator, SuccessPanel, "游戏成功弹窗", false);
+        },  1);
+    }
+
+    /**
+     * 游戏失败
+     */
+    private GameFail(huoFlag: boolean = false): void {
+        if(!this.GameStutas)
+            return;
+
+        this.GameComplete();
+
+        App.SoundManager.playEffect(SoundManager.fail);
+        
+        this.scheduleOnce(() => {
+            App.Facade.popView(FailPanelMediator, FailPanel, "游戏失败弹窗", false);
+        },  2);
+    }
+    
+
+    /**
+     * 游戏结束
+     */
+    private GameComplete(): void {
+        this.GameStutas = false;
+    }
+
+    onDisable() {        
+        this.btnPause.off(cc.Node.EventType.TOUCH_END, this.ClickPause.bind(this), this);  
+    }
+
+    onDestroy(){
+        gameScene.instance = null;
+    }
+}

+ 9 - 0
assets/Script/gameScene.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "fbe6e314-42b2-4a51-a663-0571e147429e",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 12 - 0
assets/Script/guide.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "5eb47292-9d65-4e4a-bca4-9e32cd433259",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 40 - 0
assets/Script/guide/guidePanel.ts

@@ -0,0 +1,40 @@
+import { App } from "../Manager/App";
+
+
+const {ccclass, property} = cc._decorator;
+
+@ccclass
+export default class guidePanel extends cc.Component {
+    private static _instance: guidePanel = null;
+
+    // LIFE-CYCLE CALLBACKS:
+    public static getInstance(): any {
+        if (this._instance == null) {
+            this._instance = new guidePanel();
+        }
+        return this._instance;
+    }
+
+    onLoad () {
+        guidePanel._instance = this;
+    }
+
+    start () {
+        
+    }
+
+    public showCurGuide(){
+        for (let i = 0; i < 5; i++) {
+            this.node.children[i].active = false;            
+        }        
+        this.node.children[App.DataManager.guideStep].active = true; 
+    }
+
+    public hideGuideStep(){
+        for (let i = 0; i < 5; i++) {
+            this.node.children[i].active = false;           
+        }
+    }
+
+    // update (dt) {}
+}

+ 9 - 0
assets/Script/guide/guidePanel.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "be19dfed-3fa6-4435-bc2e-9b082d723958",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 256 - 0
assets/Script/hallScene.ts

@@ -0,0 +1,256 @@
+import { BaseView } from "../lightMVC/core/base/BaseView";
+import SDK from "./sdk/SDK";
+import hallSceneMediator from "./hallSceneMediator";
+import { App } from "./Manager/App";
+import { SoundManager } from "./Manager/SoundManager";
+import TimeControl from "./TimeControl";
+import ChooseLevelPanel from "./view/chooseLevel/ChooseLevelPanel";
+import ChooseLevelPanelMediator from "./view/chooseLevel/ChooseLevelPanelMediator";
+import ChooseSkinPanel from "./view/chooseSkin/ChooseSkinPanel";
+import ChooseSkinPanelMediator from "./view/chooseSkin/ChooseSkinPanelMediator";
+import InsufficientPanel from "./view/insufficientPanel/InsufficientPanel";
+import InsufficientPanelMediator from "./view/insufficientPanel/InsufficientPanelMediator";
+import MissionPanel from "./view/missionPanel/MissionPanel";
+import MissionPanelMediator from "./view/missionPanel/MissionPanelMediator";
+import SetNormalPanel from "./view/setNormal/SetNormalPanel";
+import SetNormalPanelMediator from "./view/setNormal/SetNormalPanelMediator";
+import ShopPanel from "./view/shopView/ShopPanel";
+import ShopPanelMediator from "./view/shopView/ShopPanelMediator";
+import TipPanel from "./view/tipPanel/TipPanel";
+import TipPanelMediator from "./view/tipPanel/TipPanelMediator";
+
+const { ccclass, property } = cc._decorator;
+
+@ccclass
+export default class hallScene extends BaseView {
+
+    public static _instance;
+    @property(cc.Button)
+    public startGameBtn: cc.Button = null;
+
+    @property(cc.Button)
+    public setNormalBtn: cc.Button = null;    
+
+    // @property(cc.Button)
+    // public chooseSkinBtn: cc.Button = null;
+
+    @property(cc.Button)
+    public missionBtn: cc.Button = null;
+
+    // @property(cc.Button)
+    // public btnVideo: cc.Button = null;
+
+    // @property(cc.Button)
+    // public btnShop: cc.Button = null;    
+
+    @property(cc.Button)
+    public btnLeft: cc.Button = null;
+
+    @property(cc.Button)
+    public btnRight: cc.Button = null;    
+
+    @property(cc.PageView)
+    public pageView: cc.PageView = null;
+
+    @property(cc.Label)
+    public labelTili: cc.Label = null;
+
+    @property(cc.Label)
+    public physicalTime: cc.Label = null;
+    
+    @property(cc.Label)
+    public labelCoin: cc.Label = null;    
+
+    @property(cc.Label)
+    public labelDiamond: cc.Label = null;    
+
+
+    private loadSceneName: string = "gameScene";
+    private currientView = 0;
+
+    public static get instance() {
+        return hallScene._instance;
+    }
+    public static set instance(value) {
+        hallScene._instance = value;
+    }
+    onLoad() {
+        // cc.sys.localStorage.clear();
+
+        hallScene.instance = this;
+        this.registerMediator(hallSceneMediator, this, "主界面");
+        SDK.Instance.showBanner();
+    }
+
+    start() {        
+    
+        this.startGameBtn.node.on(cc.Node.EventType.TOUCH_END, this.ClickStartGame, this);
+        this.setNormalBtn.node.on(cc.Node.EventType.TOUCH_END, this.ClickSetNormal, this);
+        this.btnLeft.node.on(cc.Node.EventType.TOUCH_END, this.ClickLeft, this);
+        this.btnRight.node.on(cc.Node.EventType.TOUCH_END, this.ClickRight, this);
+
+
+        // this.btnVideo.node.on(cc.Node.EventType.TOUCH_END, this.ClickAddTili, this);        
+        this.missionBtn.node.on(cc.Node.EventType.TOUCH_END, this.ClickOpenMission, this);
+        // this.chooseSkinBtn.node.on(cc.Node.EventType.TOUCH_END, this.ClickChooseSkin, this);
+        // this.btnShop.node.on(cc.Node.EventType.TOUCH_END, this.ClickShop, this);
+        
+        
+
+        // console.log('----------', TimeControl.instance.currentTili);
+
+        // App.DataManager.TimeCountJudge();//全局倒计时判断        
+        // if (App.DataManager.TimeFlag) {
+        //     let data = { "isShow": true, 'timeStr': App.DataManager.TimeChange(TimeControl.instance.currentTimeCount) };
+        //     this.TiliCountShow(data);
+        // }
+        
+
+        this.ShowPhysicalValue();
+        this.ShowUserCoinValue();
+        this.ShowUserDiamondValue();
+        App.SoundManager.playBGM(SoundManager.hallBgm[0]);
+    }
+
+
+    public ClickOpenMission() {
+        App.Facade.popView(MissionPanelMediator, MissionPanel, "打开任务界面", false);
+    }
+
+    /**
+     * 体力显示设置
+     */
+    public ShowPhysicalValue(): void {
+        console.log('############', TimeControl.instance.currentTili)
+        if(hallScene.instance.labelTili){
+            hallScene.instance.labelTili.string = TimeControl.instance.currentTili + "/" + TimeControl.instance.tiliMax;
+        }   
+    }
+
+    // 显示玩家金币
+    public ShowUserCoinValue(): void {
+        if(hallScene.instance.labelCoin){
+            hallScene.instance.labelCoin.string = App.DataManager.UserCoin.toString();
+        }
+    }
+
+    // 钻石
+    public ShowUserDiamondValue(): void {
+        if(hallScene.instance.labelDiamond){
+            hallScene.instance.labelDiamond.string = App.DataManager.UserDiamond.toString();
+        }
+    }
+
+    /**
+    * 体力倒计时显示设置
+    */
+    public TiliCountShow(data: any): void {
+        if (!this.physicalTime) return;
+        this.physicalTime.node.active = data.isShow;
+        if (data.timeStr) this.physicalTime.string = data.timeStr;
+    }
+
+    
+    /**
+     * 开始游戏
+     */
+    public StartGame(intoLevel: number) {
+
+        console.log("aaa--------intoLevel----------", intoLevel);
+
+        App.DataManager.UpdateTili(TimeControl.instance.consumeTili, (success) => {
+            App.DataManager.CurrentIntoLevel = intoLevel;
+            App.DataManager.PlayLevel = App.DataManager.CurrentIntoLevel;
+            App.LocalStorageUtil.setNumber(App.LocalStorageUtil.lst_playLevel, App.DataManager.PlayLevel);
+            if (success) App.Facade.runBundleScene("gameScene",this.loadSceneName);
+            else App.Facade.popView(InsufficientPanelMediator, InsufficientPanel, "体力不足", false);
+        });
+    }
+
+
+    /**
+     * 点击开始游戏按钮直接开始
+     */
+    private ClickStartGame() {
+        if(this.pageView.getCurrentPageIndex() == 1){
+            App.Facade.popView(TipPanelMediator, TipPanel, "敬请期待!", false);
+        }
+        else{
+            App.Facade.popView(ChooseLevelPanelMediator, ChooseLevelPanel, "关卡选择", false);
+        }
+    }
+
+    /**
+     * 点击观看视频加体力
+     */
+    private ClickAddTili() {
+        console.log('点击观看视频加体力~');
+        SoundManager.getInstance().VideoStartStop();
+        SDK.Instance.showRewardVideo(() => {
+            
+            TimeControl.instance.currentTili = TimeControl.instance.tiliMax;
+            this.ShowPhysicalValue();
+            App.LocalStorageUtil.setNumber(App.LocalStorageUtil.lst_Tili, TimeControl.instance.currentTili);
+
+            SoundManager.getInstance().VideoEndOpen();
+        }, () => {
+            SoundManager.getInstance().VideoEndOpen();
+        }, () => {
+            SoundManager.getInstance().VideoEndOpen();
+        });
+
+    }
+
+    // 商城
+    private ClickShop() {
+        App.Facade.popView(ShopPanelMediator, ShopPanel, "商城", false);
+    }
+
+    /**
+     * 打开关卡选择界面
+     */
+    private ClickChooseLevel() {
+        App.Facade.popView(ChooseLevelPanelMediator, ChooseLevelPanel, "关卡选择", true);
+    }
+
+    /**
+     * 打开选择皮肤界面
+     */
+    private ClickChooseSkin() {
+        App.Facade.popView(ChooseSkinPanelMediator, ChooseSkinPanel, "皮肤选择", false);
+    }
+
+    /**
+     * 打开设置界面
+     */
+    private ClickSetNormal() {
+        App.Facade.popView(SetNormalPanelMediator, SetNormalPanel, "设置",  false);
+    }
+
+
+    private ClickLeft(){
+        this.currientView = this.pageView.getCurrentPageIndex() == 0 ? 1 : 0;
+        this.pageView.scrollToPage(this.currientView, 0.5); 
+    }
+
+    private ClickRight(){
+        this.currientView = this.pageView.getCurrentPageIndex() == 0 ? 1 : 0;
+        this.pageView.scrollToPage(this.currientView, 0.5);
+    }
+
+
+    onDisable() {
+        this.startGameBtn.node.off(cc.Node.EventType.TOUCH_END, this.ClickStartGame, this);        
+        this.setNormalBtn.node.off(cc.Node.EventType.TOUCH_END, this.ClickSetNormal, this);    
+        this.btnLeft.node.off(cc.Node.EventType.TOUCH_END, this.ClickLeft, this);
+        this.btnRight.node.off(cc.Node.EventType.TOUCH_END, this.ClickRight, this);
+        this.missionBtn.node.off(cc.Node.EventType.TOUCH_END, this.ClickOpenMission, this);
+
+        // this.btnVideo.node.off(cc.Node.EventType.TOUCH_END, this.ClickAddTili, this);
+        // this.btnShop.node.off(cc.Node.EventType.TOUCH_END, this.ClickShop, this);
+        
+        // this.chooseSkinBtn.node.off(cc.Node.EventType.TOUCH_END, this.ClickChooseSkin, this);
+    }
+
+    // update (dt) {}
+}

+ 9 - 0
assets/Script/hallScene.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "3c95264d-4690-4645-8a3f-b6019256b2c0",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 43 - 0
assets/Script/hallSceneMediator.ts

@@ -0,0 +1,43 @@
+import BaseMediator from "../lightMVC/core/base/BaseMediator";
+import Notification from "./Notification";
+import { ViewManager } from "../lightMVC/core/manager/ViewManager";
+import hallScene from "./hallScene";
+
+export default class hallSceneMediator extends BaseMediator {
+
+    public view: hallScene;
+
+    public init(data?: any): void {
+        //将mediator添加到了layer数组中
+        ViewManager.getInstance().pushLayerList(this);
+        this.registerNoti("UPDATE_TILI", () => {
+            console.log('UPDATE_TILI**************')
+            this.view.ShowPhysicalValue();
+        }, this);
+        this.registerNoti("UPDATE_COIN", () => {
+            console.log('UPDATE_TILI**************')
+            this.view.ShowUserCoinValue();
+        }, this);
+
+        this.registerNoti("UPDATE_DIAMOND", () => {
+            console.log('UPDATE_DIAMOND**************')
+            this.view.ShowUserDiamondValue();
+        }, this);
+
+        this.registerNoti("UPDATE_TILI_JISHI", (data) => {
+            this.view.TiliCountShow(data);
+        }, this);
+
+    }
+
+    public viewDidAppear(): void {
+
+    }
+
+    public destroy(): void {
+
+    }
+
+
+
+}

+ 9 - 0
assets/Script/hallSceneMediator.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "d5262b1c-cfb2-4837-95d3-7ad6651cbf7e",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 12 - 0
assets/Script/model.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "c46f9bd8-8430-47f9-81ba-48f8192775ce",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 19 - 0
assets/Script/model/NotifyModel.ts

@@ -0,0 +1,19 @@
+import BaseModel from "../../lightMVC/core/base/BaseModel";
+import Notification from "../Notification";
+
+export default class NotifyModel extends BaseModel {
+
+    public init(): void {
+
+    }
+
+    public sendNotify(notify: string, data?: any): void {
+        this.sendNoti(notify,data);
+    }
+
+    public clear(): void {
+
+    }
+}
+
+

+ 9 - 0
assets/Script/model/NotifyModel.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "8e1e5f4c-3de7-4e81-b69a-47027bb6149b",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 45 - 0
assets/Script/model/hallModel.ts

@@ -0,0 +1,45 @@
+import BaseModel from "../../lightMVC/core/base/BaseModel";
+import Notification from "../Notification";
+
+export default class hallModel extends BaseModel {
+
+    public init(): void {
+
+    }
+
+    public sendNotify(notify: string, data?: any): void {
+        this.sendNoti(notify, data);
+    }
+
+    /**
+     * 更新金币
+     */
+    public updateCoinNumber(): void {
+        this.sendNoti('UPDATE_COIN', '更新金币');
+    }
+
+    public updateDiamond(): void {
+        this.sendNoti('UPDATE_DIAMOND', '更新体力');
+    }
+
+    /**
+     * 更新体力
+     */
+    public updateTiliNumber(): void {
+        this.sendNoti('UPDATE_TILI', '更新体力');
+    }
+
+    /**
+     * 更新体力倒计时
+     */
+    public updateTiliJishi(isShow: boolean, timeStr?: string): void {
+        let data = { "isShow": isShow };
+        if (timeStr) data['timeStr'] = timeStr;
+        this.sendNoti('UPDATE_TILI_JISHI', data);
+    }
+    public clear(): void {
+
+    }
+}
+
+

Some files were not shown because too many files changed in this diff