浏览代码

添加钻石兑换种子界面

Sunny 3 年之前
父节点
当前提交
cefb30e002

文件差异内容过多而无法显示
+ 1646 - 85
assets/Scene/MyCityScene - 004.fire


+ 375 - 248
assets/Script/UI/ManageWorker.js

@@ -1,253 +1,380 @@
 cc.Class({
-    extends: cc.Component,
-
-    properties: {
-        ManageAI: cc.Node,
-
-        GoldLabel: cc.Node,
-        DiamondLabel: cc.Node,
-
-        LV: cc.Node,
-        MaxWorkLV: cc.Node,
-        WorkerNum: cc.Node,
-        WorkerCapacity: cc.Node,
-        PhysicalStrength: cc.Node,
-        Labor: cc.Node,
-        Wages: cc.Node,
-        RecruitCost: cc.Node,
-        UpGradeCost: cc.Node,
-        // //工人容量值
-        // workerCapacity: { default: 32, type: cc.Integer, tooltip: '可招聘工人最大值' },
-        //“管理”界面的招聘进度条 Recruit
-        ManagementProgressBar_Recruit: {
-            default: null,
-            type: cc.Node,
-        },
-        //“管理”界面的培训进度条
-        ManagementProgressBar_Train: {
-            default: null,
-            type: cc.Node,
-        },
-        AlertUIView: cc.Node
+  extends: cc.Component,
+
+  properties: {
+    ManageAI: cc.Node,
+
+    GoldLabel: cc.Node,
+    DiamondLabel: cc.Node,
+
+    LV: cc.Node,
+    MaxWorkLV: cc.Node,
+    WorkerNum: cc.Node,
+    WorkerCapacity: cc.Node,
+    PhysicalStrength: cc.Node,
+    Labor: cc.Node,
+    Wages: cc.Node,
+    RecruitCost: cc.Node,
+    UpGradeCost: cc.Node,
+    // //工人容量值
+    // workerCapacity: { default: 32, type: cc.Integer, tooltip: '可招聘工人最大值' },
+    //“管理”界面的招聘进度条 Recruit
+    ManagementProgressBar_Recruit: {
+      default: null,
+      type: cc.Node,
     },
-    start() {
-
-        // this.InitWorkerAI();
-    },
-    InitWorkerAI: function () {
-
-        //体力 劳动力 薪资 培训费用
-        this.WorkerLVPropertyJSON = [
-            { "PhysicalStrength": "50", "Labor": "5", "Wages": "50", "UpgradeCost": "20", "MoveSpeed": "100" },
-            { "PhysicalStrength": "55", "Labor": "7", "Wages": "100", "UpgradeCost": "50", "MoveSpeed": "120" },
-            { "PhysicalStrength": "60", "Labor": "9", "Wages": "200", "UpgradeCost": "100", "MoveSpeed": "140" },
-            { "PhysicalStrength": "65", "Labor": "11", "Wages": "300", "UpgradeCost": "500", "MoveSpeed": "160" },
-            { "PhysicalStrength": "70", "Labor": "13", "Wages": "400", "UpgradeCost": "1000", "MoveSpeed": "180" },
-            { "PhysicalStrength": "75", "Labor": "15", "Wages": "500", "UpgradeCost": "1500", "MoveSpeed": "200" },
-            { "PhysicalStrength": "80", "Labor": "17", "Wages": "600", "UpgradeCost": "2000", "MoveSpeed": "220" },
-            { "PhysicalStrength": "85", "Labor": "18", "Wages": "700", "UpgradeCost": "2500", "MoveSpeed": "240" },
-            { "PhysicalStrength": "90", "Labor": "19", "Wages": "800", "UpgradeCost": "3000", "MoveSpeed": "260" },
-            { "PhysicalStrength": "100", "Labor": "20", "Wages": "900", "UpgradeCost": "0", "MoveSpeed": "280" },
-        ];
-        this.WorkerNum.getComponent(cc.Label).string = GlobalD.GameData.GetWorkerNum();
-        //容量是定死的值,不用存储,也不用读取
-        this.WorkerCapacity.getComponent(cc.Label).string = GlobalD.GameData.GetWorkerCapacity();
-        this.SetBar_RecruitLength(GlobalD.GameData.GetWorkerNum() / GlobalD.GameData.GetWorkerCapacity());
-
-        this.LV.getComponent(cc.Label).string = GlobalD.GameData.GetWorkerLV() + 1;
-        this.MaxWorkLV.getComponent(cc.Label).string = this.WorkerLVPropertyJSON.length;
-        this.SetBar_TrainLength((GlobalD.GameData.GetWorkerLV() + 1) / this.WorkerLVPropertyJSON.length);
-
-        let CurrentGradeJson = this.WorkerLVPropertyJSON[GlobalD.GameData.GetWorkerLV()];
-        this.PhysicalStrength.getComponent(cc.Label).string = CurrentGradeJson.PhysicalStrength;
-        this.Labor.getComponent(cc.Label).string = CurrentGradeJson.Labor;
-        this.Wages.getComponent(cc.Label).string = CurrentGradeJson.Wages;
-        this.RecruitCost.getComponent(cc.Label).string = CurrentGradeJson.Wages;
-        this.UpGradeCost.getComponent(cc.Label).string = CurrentGradeJson.UpgradeCost;
-
-        this._ManageAI = this.ManageAI.getComponent('ManageAI');
-        this._ManageAI.InitCurrentGradeJson = CurrentGradeJson;
-        //生成存储的工人数据
-        this._ManageAI.onSpawnWorkerAIFromStoredData();
-
-        // cc.log('工人');
+    //“管理”界面的培训进度条
+    ManagementProgressBar_Train: {
+      default: null,
+      type: cc.Node,
     },
-    //招聘
-    onRecruit: function () {
-        if (task.TaskIconCountClick == 1) {
-
-            //现在关掉招聘的 页面 弹出对话框 提示 要点击建造
-            task.managerUi.onButtonEvent_Personnel_Close();
-            task.showManagerhide();
-            var Canvas = cc.find("Canvas/UICamera");
-            //移动camera 对应位置
-            cc.find('GameNode/ManageTask').getComponent('ManageTask').onMoveToTiledTile(16, 16);
-           
-            //招聘了人马上设置对应的数
-            task.TaskIconCountClick = -1;
-            dialogmanager.init(Canvas, function () {
-                dialogmanager.pickUp(dialogmanager.dialogue[30]);
-            }.bind(this));
-            dialogmanager.setOnCloseDialog(function () {
-                task.removeTaskNode(task.taskCursorName[3]);
-                // task._setTaskIconCountClick(12);
-                // task._setTaskIconCountClick(13);
-
-                // setTimeout(() => {
-                //     task.taskCallBack();
-
-                // }, 500);
-
-                //建房子
-                GlobalD.ManageTask.onInitGameStartTask();
-                
-            }.bind(this));
-        }
-
-        if (GlobalD.GameData.GetWorkerNum() + 1 > GlobalD.GameData.GetWorkerCapacity()) {
-            cc.loader.loadRes('resUI/ShowNotEnoughMoney', function (err, texture) {
-                var prefab = cc.instantiate(texture);
-                prefab.getComponent('ShowNotEnoughMoney').Text('超员了!!');
-                this.AlertUIView.addChild(prefab);
-            }.bind(this));
-            return;
-        }
-        if (GlobalD.GameData.GetGolden() < parseInt(this.WorkerLVPropertyJSON[GlobalD.GameData.GetWorkerLV()].Wages)) {
-
-            cc.loader.loadRes('resUI/ShowNotEnoughMoney', function (err, texture) {
-                var prefab = cc.instantiate(texture);
-                prefab.getComponent('ShowNotEnoughMoney').Text('金币不足!!');
-                this.AlertUIView.addChild(prefab);
-            }.bind(this));
-            return;
-        }
-
-        GlobalD.GameData.PlusGolden(-parseInt(this.WorkerLVPropertyJSON[GlobalD.GameData.GetWorkerLV()].Wages));
-        GlobalD.GameData.PlusWorkerNum(1);
-        this.WorkerNum.getComponent(cc.Label).string = GlobalD.GameData.GetWorkerNum();
-        this._ManageAI.onSpawnWorkerAI();
-        this.SetBar_RecruitLength(GlobalD.GameData.GetWorkerNum() / GlobalD.GameData.GetWorkerCapacity());
-    },
-
-    Building_t: function () {
-        var Canvas = cc.find("Canvas/UICamera");
-        var Building = cc.find("Canvas/UICamera/BelowTheMask/Building");
-        task.addTaskTips(Canvas, task.taskPrefab[6], 0, 0, task.taskCursorName[1], function (nodePrefabs1) {
-            UtilsPrefabs.setOn(nodePrefabs1.getChildByName("SureBtn"), function () {
-                task.removeTaskNode(task.taskCursorName[1]);
-                task.addTaskTips(Building, task.taskPrefab[1], -50, -50, task.taskCursorName[0], function (nodePrefabs) {
-
-                }.bind(this));
-            }.bind(this))
-        }.bind(this));
-    },
-    //解雇
-    onFire: function () {
-        if (GlobalD.GameData.GetWorkerNum() - 1 < 0) return;
-
+    AlertUIView: cc.Node,
+  },
+  start() {
+    // this.InitWorkerAI();
+  },
+  InitWorkerAI: function () {
+    //体力 劳动力 薪资 培训费用
+    this.WorkerLVPropertyJSON = [
+      {
+        PhysicalStrength: '50',
+        Labor: '5',
+        Wages: '50',
+        UpgradeCost: '20',
+        MoveSpeed: '100',
+      },
+      {
+        PhysicalStrength: '55',
+        Labor: '7',
+        Wages: '100',
+        UpgradeCost: '50',
+        MoveSpeed: '120',
+      },
+      {
+        PhysicalStrength: '60',
+        Labor: '9',
+        Wages: '200',
+        UpgradeCost: '100',
+        MoveSpeed: '140',
+      },
+      {
+        PhysicalStrength: '65',
+        Labor: '11',
+        Wages: '300',
+        UpgradeCost: '500',
+        MoveSpeed: '160',
+      },
+      {
+        PhysicalStrength: '70',
+        Labor: '13',
+        Wages: '400',
+        UpgradeCost: '1000',
+        MoveSpeed: '180',
+      },
+      {
+        PhysicalStrength: '75',
+        Labor: '15',
+        Wages: '500',
+        UpgradeCost: '1500',
+        MoveSpeed: '200',
+      },
+      {
+        PhysicalStrength: '80',
+        Labor: '17',
+        Wages: '600',
+        UpgradeCost: '2000',
+        MoveSpeed: '220',
+      },
+      {
+        PhysicalStrength: '85',
+        Labor: '18',
+        Wages: '700',
+        UpgradeCost: '2500',
+        MoveSpeed: '240',
+      },
+      {
+        PhysicalStrength: '90',
+        Labor: '19',
+        Wages: '800',
+        UpgradeCost: '3000',
+        MoveSpeed: '260',
+      },
+      {
+        PhysicalStrength: '100',
+        Labor: '20',
+        Wages: '900',
+        UpgradeCost: '0',
+        MoveSpeed: '280',
+      },
+    ]
+    this.WorkerNum.getComponent(cc.Label).string =
+      GlobalD.GameData.GetWorkerNum()
+    //容量是定死的值,不用存储,也不用读取
+    this.WorkerCapacity.getComponent(cc.Label).string =
+      GlobalD.GameData.GetWorkerCapacity()
+    this.SetBar_RecruitLength(
+      GlobalD.GameData.GetWorkerNum() / GlobalD.GameData.GetWorkerCapacity()
+    )
+
+    this.LV.getComponent(cc.Label).string = GlobalD.GameData.GetWorkerLV() + 1
+    this.MaxWorkLV.getComponent(cc.Label).string =
+      this.WorkerLVPropertyJSON.length
+    this.SetBar_TrainLength(
+      (GlobalD.GameData.GetWorkerLV() + 1) / this.WorkerLVPropertyJSON.length
+    )
+
+    let CurrentGradeJson =
+      this.WorkerLVPropertyJSON[GlobalD.GameData.GetWorkerLV()]
+    this.PhysicalStrength.getComponent(cc.Label).string =
+      CurrentGradeJson.PhysicalStrength
+    this.Labor.getComponent(cc.Label).string = CurrentGradeJson.Labor
+    this.Wages.getComponent(cc.Label).string = CurrentGradeJson.Wages
+    this.RecruitCost.getComponent(cc.Label).string = CurrentGradeJson.Wages
+    this.UpGradeCost.getComponent(cc.Label).string =
+      CurrentGradeJson.UpgradeCost
+
+    this._ManageAI = this.ManageAI.getComponent('ManageAI')
+    this._ManageAI.InitCurrentGradeJson = CurrentGradeJson
+    //生成存储的工人数据
+    this._ManageAI.onSpawnWorkerAIFromStoredData()
+
+    // cc.log('工人');
+  },
+  //招聘
+  onRecruit: function () {
+    if (task.TaskIconCountClick == 1) {
+      //现在关掉招聘的 页面 弹出对话框 提示 要点击建造
+      task.managerUi.onButtonEvent_Personnel_Close()
+      task.showManagerhide()
+      var Canvas = cc.find('Canvas/UICamera')
+      //移动camera 对应位置
+      cc.find('GameNode/ManageTask')
+        .getComponent('ManageTask')
+        .onMoveToTiledTile(16, 16)
+
+      //招聘了人马上设置对应的数
+      task.TaskIconCountClick = -1
+      dialogmanager.init(
+        Canvas,
+        function () {
+          dialogmanager.pickUp(dialogmanager.dialogue[30])
+        }.bind(this)
+      )
+      dialogmanager.setOnCloseDialog(
+        function () {
+          task.removeTaskNode(task.taskCursorName[3])
+          // task._setTaskIconCountClick(12);
+          // task._setTaskIconCountClick(13);
+
+          // setTimeout(() => {
+          //     task.taskCallBack();
+
+          // }, 500);
+
+          //建房子
+          GlobalD.ManageTask.onInitGameStartTask()
+        }.bind(this)
+      )
+    }
+
+    if (
+      GlobalD.GameData.GetWorkerNum() + 1 >
+      GlobalD.GameData.GetWorkerCapacity()
+    ) {
+      cc.loader.loadRes(
+        'resUI/ShowNotEnoughMoney',
+        function (err, texture) {
+          var prefab = cc.instantiate(texture)
+          prefab.getComponent('ShowNotEnoughMoney').Text('超员了!!')
+          this.AlertUIView.addChild(prefab)
+        }.bind(this)
+      )
+      return
+    }
+    if (
+      GlobalD.GameData.GetGolden() <
+      parseInt(this.WorkerLVPropertyJSON[GlobalD.GameData.GetWorkerLV()].Wages)
+    ) {
+      cc.loader.loadRes(
+        'resUI/ShowNotEnoughMoney',
+        function (err, texture) {
+          var prefab = cc.instantiate(texture)
+          prefab.getComponent('ShowNotEnoughMoney').Text('金币不足!!')
+          this.AlertUIView.addChild(prefab)
+        }.bind(this)
+      )
+      return
+    }
+
+    GlobalD.GameData.PlusGolden(
+      -parseInt(this.WorkerLVPropertyJSON[GlobalD.GameData.GetWorkerLV()].Wages)
+    )
+    GlobalD.GameData.PlusWorkerNum(1)
+    this.WorkerNum.getComponent(cc.Label).string =
+      GlobalD.GameData.GetWorkerNum()
+    this._ManageAI.onSpawnWorkerAI()
+    this.SetBar_RecruitLength(
+      GlobalD.GameData.GetWorkerNum() / GlobalD.GameData.GetWorkerCapacity()
+    )
+  },
+
+  Building_t: function () {
+    var Canvas = cc.find('Canvas/UICamera')
+    var Building = cc.find('Canvas/UICamera/BelowTheMask/Building')
+    task.addTaskTips(
+      Canvas,
+      task.taskPrefab[6],
+      0,
+      0,
+      task.taskCursorName[1],
+      function (nodePrefabs1) {
+        UtilsPrefabs.setOn(
+          nodePrefabs1.getChildByName('SureBtn'),
+          function () {
+            task.removeTaskNode(task.taskCursorName[1])
+            task.addTaskTips(
+              Building,
+              task.taskPrefab[1],
+              -50,
+              -50,
+              task.taskCursorName[0],
+              function (nodePrefabs) {}.bind(this)
+            )
+          }.bind(this)
+        )
+      }.bind(this)
+    )
+  },
+  //解雇
+  onFire: function () {
+    if (GlobalD.GameData.GetWorkerNum() - 1 < 0) return
+
+    if (this._ManageAI.onRemoveWorkerAI()) {
+      //如果成功删除AI
+      GlobalD.GameData.PlusWorkerNum(-1)
+      this.WorkerNum.getComponent(cc.Label).string =
+        GlobalD.GameData.GetWorkerNum()
+    }
+  },
+  onFireNum() {
+    this.FirePerson(5)
+  },
+
+  FirePerson: function (num) {
+    if (GlobalD.GameData.GetWorkerNum() - num < 0) {
+      num = GlobalD.GameData.GetWorkerNum()
+    }
+    //不需要解雇
+    if (num <= 0) return
+
+    if (this.AutoFireWorker) this.unschedule(this.AutoFireWorker)
+    //自动存储数据
+    this.AutoFireWorker = function () {
+      if (num <= 0) return
+      for (let i = 0; i < num; i++) {
+        //只能解雇可以解雇状态下的工人
         if (this._ManageAI.onRemoveWorkerAI()) {
-            //如果成功删除AI
-            GlobalD.GameData.PlusWorkerNum(-1);
-            this.WorkerNum.getComponent(cc.Label).string = GlobalD.GameData.GetWorkerNum();
-        }
-    },
-    onFireNum() {
-        this.FirePerson(5);
-    },
-
-    FirePerson: function (num) {
-        if (GlobalD.GameData.GetWorkerNum() - num < 0) {
-            num = GlobalD.GameData.GetWorkerNum();
-        }
-        //不需要解雇
-        if (num <= 0) return;
-
-        if (this.AutoFireWorker)
-            this.unschedule(this.AutoFireWorker);
-        //自动存储数据
-        this.AutoFireWorker = function () {
-            if (num <= 0) return;
-            for (let i = 0; i < num; i++) {
-                //只能解雇可以解雇状态下的工人
-                if (this._ManageAI.onRemoveWorkerAI()) {
-                    //如果成功删除AI
-                    GlobalD.GameData.PlusWorkerNum(-1);
-                    this.WorkerNum.getComponent(cc.Label).string = GlobalD.GameData.GetWorkerNum();
-                    num--;
-                }
-            }
-        }
-        this.schedule(this.AutoFireWorker, 0.5);
-
-    },
-    //培训
-    onUpgrade: function () {
-        if (this.WorkerLVPropertyJSON.length - 2 < GlobalD.GameData.GetWorkerLV()) return;
-
-        let CurrentGradeJson = this.WorkerLVPropertyJSON[GlobalD.GameData.GetWorkerLV()];
-        let UpgradeCost = CurrentGradeJson.UpgradeCost;
-
-        if (GlobalD.GameData.GetDiamond() < UpgradeCost) {
-            cc.loader.loadRes('resUI/ShowNotEnoughMoney', function (err, texture) {
-                var prefab = cc.instantiate(texture);
-                prefab.getComponent('ShowNotEnoughMoney').Text('钻石不足!!');
-                this.AlertUIView.addChild(prefab);
-            }.bind(this));
-            return;
+          //如果成功删除AI
+          GlobalD.GameData.PlusWorkerNum(-1)
+          this.WorkerNum.getComponent(cc.Label).string =
+            GlobalD.GameData.GetWorkerNum()
+          num--
         }
-
-        GlobalD.GameData.PlusDiamond(-UpgradeCost);
-        // this.GoldLabel.getComponent(cc.Label).string = GlobalD.GameData.GetDiamond();
-        this.DiamondLabel.getComponent(cc.Label).string = GlobalD.GameData.GetDiamond();
-
-        GlobalD.GameData.PlusWorkerLV(1);
-        this.LV.getComponent(cc.Label).string = GlobalD.GameData.GetWorkerLV() + 1;
-
-        CurrentGradeJson = this.WorkerLVPropertyJSON[GlobalD.GameData.GetWorkerLV()];
-        this.PhysicalStrength.getComponent(cc.Label).string = CurrentGradeJson.PhysicalStrength;
-        this.Labor.getComponent(cc.Label).string = CurrentGradeJson.Labor;
-        this.Wages.getComponent(cc.Label).string = CurrentGradeJson.Wages;
-        GlobalD.GameData.SetWorkerCapacity(CurrentGradeJson.Labor);
-        this.WorkerCapacity.getComponent(cc.Label).string = CurrentGradeJson.Labor;
-
-        //修改全体人物属性
-        this._ManageAI.InitCurrentGradeJson = CurrentGradeJson;
-        this._ManageAI.onUpgradeAllWorker();
-
-        this.SetBar_TrainLength((GlobalD.GameData.GetWorkerLV() + 1) / this.WorkerLVPropertyJSON.length);
-        this.SetBar_RecruitLength(GlobalD.GameData.GetWorkerNum() / GlobalD.GameData.GetWorkerCapacity());
-
-        this.RecruitCost.getComponent(cc.Label).string = CurrentGradeJson.Wages;
-        this.UpGradeCost.getComponent(cc.Label).string = CurrentGradeJson.UpgradeCost;
-    },
-    onDegrade: function () {
-        if (GlobalD.GameData.GetWorkerLV() - 1 < 0) return;
-
-        GlobalD.GameData.PlusWorkerLV(-1);
-        this.LV.getComponent(cc.Label).string = GlobalD.GameData.GetWorkerLV() + 1;
-
-        let CurrentGradeJson = this.WorkerLVPropertyJSON[GlobalD.GameData.GetWorkerLV()];
-
-        CurrentGradeJson = this.WorkerLVPropertyJSON[GlobalD.GameData.GetWorkerLV()];
-        this.PhysicalStrength.getComponent(cc.Label).string = CurrentGradeJson.PhysicalStrength;
-        this.Labor.getComponent(cc.Label).string = CurrentGradeJson.Labor;
-        this.Wages.getComponent(cc.Label).string = CurrentGradeJson.Wages;
-        GlobalD.GameData.SetWorkerCapacity(CurrentGradeJson.Labor);
-        this.WorkerCapacity.getComponent(cc.Label).string = CurrentGradeJson.Labor;
-
-        //修改全体人物属性
-        this._ManageAI.InitCurrentGradeJson = CurrentGradeJson;
-        this._ManageAI.onUpgradeAllWorker();
-
-        this.SetBar_TrainLength((GlobalD.GameData.GetWorkerLV() + 1) / this.WorkerLVPropertyJSON.length);
-        this.SetBar_RecruitLength(GlobalD.GameData.GetWorkerNum() / GlobalD.GameData.GetWorkerCapacity());
-    },
-    //招聘进度条
-    SetBar_RecruitLength: function (BarLength) {//BarLength(0~1,float)
-        this.ManagementProgressBar_Recruit.getComponent(cc.ProgressBar).progress = BarLength;
-    },
-    //培训进度条
-    SetBar_TrainLength: function (BarLength) {//BarLength(0~1,float)
-        this.ManagementProgressBar_Train.getComponent(cc.ProgressBar).progress = BarLength;
-    },
-});
+      }
+    }
+    this.schedule(this.AutoFireWorker, 0.5)
+  },
+  //培训
+  onUpgrade: function () {
+    if (this.WorkerLVPropertyJSON.length - 2 < GlobalD.GameData.GetWorkerLV())
+      return
+
+    let CurrentGradeJson =
+      this.WorkerLVPropertyJSON[GlobalD.GameData.GetWorkerLV()]
+    let UpgradeCost = CurrentGradeJson.UpgradeCost
+
+    if (GlobalD.GameData.GetDiamond() < UpgradeCost) {
+      cc.loader.loadRes(
+        'resUI/ShowNotEnoughMoney',
+        function (err, texture) {
+          var prefab = cc.instantiate(texture)
+          prefab.getComponent('ShowNotEnoughMoney').Text('钻石不足!!')
+          this.AlertUIView.addChild(prefab)
+        }.bind(this)
+      )
+      return
+    }
+
+    GlobalD.GameData.PlusDiamond(-UpgradeCost)
+    // this.GoldLabel.getComponent(cc.Label).string = GlobalD.GameData.GetDiamond();
+    this.DiamondNowlabel.string = result + '/30000'
+    this.DiamondLabel.getComponent(cc.Label).string =
+      GlobalD.GameData.GetDiamond()
+
+    GlobalD.GameData.PlusWorkerLV(1)
+    this.LV.getComponent(cc.Label).string = GlobalD.GameData.GetWorkerLV() + 1
+
+    CurrentGradeJson = this.WorkerLVPropertyJSON[GlobalD.GameData.GetWorkerLV()]
+    this.PhysicalStrength.getComponent(cc.Label).string =
+      CurrentGradeJson.PhysicalStrength
+    this.Labor.getComponent(cc.Label).string = CurrentGradeJson.Labor
+    this.Wages.getComponent(cc.Label).string = CurrentGradeJson.Wages
+    GlobalD.GameData.SetWorkerCapacity(CurrentGradeJson.Labor)
+    this.WorkerCapacity.getComponent(cc.Label).string = CurrentGradeJson.Labor
+
+    //修改全体人物属性
+    this._ManageAI.InitCurrentGradeJson = CurrentGradeJson
+    this._ManageAI.onUpgradeAllWorker()
+
+    this.SetBar_TrainLength(
+      (GlobalD.GameData.GetWorkerLV() + 1) / this.WorkerLVPropertyJSON.length
+    )
+    this.SetBar_RecruitLength(
+      GlobalD.GameData.GetWorkerNum() / GlobalD.GameData.GetWorkerCapacity()
+    )
+
+    this.RecruitCost.getComponent(cc.Label).string = CurrentGradeJson.Wages
+    this.UpGradeCost.getComponent(cc.Label).string =
+      CurrentGradeJson.UpgradeCost
+  },
+  onDegrade: function () {
+    if (GlobalD.GameData.GetWorkerLV() - 1 < 0) return
+
+    GlobalD.GameData.PlusWorkerLV(-1)
+    this.LV.getComponent(cc.Label).string = GlobalD.GameData.GetWorkerLV() + 1
+
+    let CurrentGradeJson =
+      this.WorkerLVPropertyJSON[GlobalD.GameData.GetWorkerLV()]
+
+    CurrentGradeJson = this.WorkerLVPropertyJSON[GlobalD.GameData.GetWorkerLV()]
+    this.PhysicalStrength.getComponent(cc.Label).string =
+      CurrentGradeJson.PhysicalStrength
+    this.Labor.getComponent(cc.Label).string = CurrentGradeJson.Labor
+    this.Wages.getComponent(cc.Label).string = CurrentGradeJson.Wages
+    GlobalD.GameData.SetWorkerCapacity(CurrentGradeJson.Labor)
+    this.WorkerCapacity.getComponent(cc.Label).string = CurrentGradeJson.Labor
+
+    //修改全体人物属性
+    this._ManageAI.InitCurrentGradeJson = CurrentGradeJson
+    this._ManageAI.onUpgradeAllWorker()
+
+    this.SetBar_TrainLength(
+      (GlobalD.GameData.GetWorkerLV() + 1) / this.WorkerLVPropertyJSON.length
+    )
+    this.SetBar_RecruitLength(
+      GlobalD.GameData.GetWorkerNum() / GlobalD.GameData.GetWorkerCapacity()
+    )
+  },
+  //招聘进度条
+  SetBar_RecruitLength: function (BarLength) {
+    //BarLength(0~1,float)
+    this.ManagementProgressBar_Recruit.getComponent(cc.ProgressBar).progress =
+      BarLength
+  },
+  //培训进度条
+  SetBar_TrainLength: function (BarLength) {
+    //BarLength(0~1,float)
+    this.ManagementProgressBar_Train.getComponent(cc.ProgressBar).progress =
+      BarLength
+  },
+})

+ 1344 - 1278
assets/Script/public/GameData.js

@@ -1,1328 +1,1394 @@
-var reGameStates = require('GameStates');
-var AConfig = require('../Config');
+var reGameStates = require('GameStates')
+var AConfig = require('../Config')
 
-import utils from "../Network/netUtils";
-import GameNet from "../Network/GameNet"
-import gameToast from "../Network/gameToast"
+import utils from '../Network/netUtils'
+import GameNet from '../Network/GameNet'
+import gameToast from '../Network/gameToast'
 
 //全局数据类
 cc.Class({
-    extends: cc.Component,
-    properties: {
-        //记录全部道路的index
-        GameData_highwayIndex: {
-            default: [],
-            type: [cc.Integer],
-            visible: false,
-            serializable: false,
-        },
-
-        //记录建筑物存储的信息
-        GameData_buildings: {
-            default: [],
-            visible: false,
-            serializable: false,
-        },
-        HighWayPrefabs: cc.Prefab,
-        //MyMapNode
-        //建筑物的节点
-        BuildingsParent: {
-            default: null,
-            type: cc.Node,
-        },
-        ManageUI: {
-            default: null,
-            type: cc.Node,
-        },
-
-        GameVersion: {
-            default: -1,
-            type: cc.Integer,
-        },
-
-        //读取数据
-        readData: {
-            default: null,
-            visible: false,
-        },
-
-        /**
-         * 接口
-         * todo cnt和snb 由钱包读取
-         */
-        CNT: {
-            default: 0,
-            visible: false,
-        },
-        SNB: {
-            default: 0,
-            visible: false,
-        },
-        //站内收益
-        CNTDrawBalance: {
-            default: 0,
-            visible: false,
-        },
-
-        //读取的土地文件
-        ConfigLand: {
-            default: null,
-            visible: false
-        },
-
-
-
-        toast: null,
-        scheduleObj: null,
-        toastCallback: null,
-        isStart: true,
-        isInit: false,
-
-        /**
-         * 限制重复触发支付, 正在支付中转态,
-         */
-        isPlayingCnt: false,
-        isPlayingSnb: false,
-
-
-        /**
-         * 处理请求
-         */
-        //现在多次触发
-        isOnAddFruit: false,
-        isOnSaleFruit: false,
-        isOnGrantFruit: false
-
-    },
-    onLoad() {
-        //初始化GameData全局变量
-        GlobalD.GameData = this;
-        this.GameConfig();
+  extends: cc.Component,
+  properties: {
+    //记录全部道路的index
+    GameData_highwayIndex: {
+      default: [],
+      type: [cc.Integer],
+      visible: false,
+      serializable: false,
     },
-    GameConfig() {
-        this.AddBuildingCost = 5;
-        this.RemoveBuildingCost = 5;
 
-        //
-        this.Dapp = {
-            UserInfo: null
-        }
-    },
-    start() {
-        cc.loader.loadRes("prefab/gameToast", function (err, texture) {
-            this.toast = cc.instantiate(texture);
-            this.toast.parent = cc.find("Canvas/UICamera");
-            this.toast.zIndex = 999;
-            this.toast.active = false;
-            this.scheduleObj = this.schedule(() => {
-                this.updateToast();
-            }, 1);
-        }.bind(this));
-
-        this._tiledMap = GlobalD.TiledMap._tiledMap;
-        //调用初始化dapp
-        this.isDebugMode(GlobalD.dapp);
+    //记录建筑物存储的信息
+    GameData_buildings: {
+      default: [],
+      visible: false,
+      serializable: false,
     },
-    /**
-     * 根据 不存在dapp 的话,使用本地测试
-     * @param {*} bInit 
-     */
-    isDebugMode: function (bInit) {
-        if (bInit) {
-            //读取网络数据
-            try {
-                GlobalD.dapp.cntBalance().then((cntBalance) => {
-                    //会延迟返回
-                    // console.log("获取cnt:" + cntBalance) // string, 精度18,需要自行处理省略几位小数
-                    GlobalD.GameData.SetCNT(cntBalance);
-                });
-            } catch (err) {
-                console.error(err) // 初始化失败,运行环境不是钱包环境
-            }
-            //登录时候已经初始化好snb了
-            this.SNB = GlobalD.UserInfo.snb;
-
-            this.readData = userData.readData;
-            // cc.log('playerPullInfo 读取到数据?:', this.readData)
-            this.InitNextworkData();
-            this.InitSceneInfo();
-
-            // 自动存储数据
-            /**
-             * todo 如果退出游戏,触发一次存储。
-             */
-            this.AutoSaveData = function () {
-                this.pushData(true);
-            };
-            this.schedule(this.AutoSaveData, 20);
-        } else {
-            // 清除
-            cc.log("本地数据重新开始,并且不初始化");
-            // this.onClearAllData();
-            this.Init();
-            this.InitSceneInfo();
-            this.AutoSaveData = function () {
-                this.pushData(false);
-            };
-            this.schedule(this.AutoSaveData, 20);
-        }
+    HighWayPrefabs: cc.Prefab,
+    //MyMapNode
+    //建筑物的节点
+    BuildingsParent: {
+      default: null,
+      type: cc.Node,
     },
-
-    getData: function () {
-        //如果开局没有读取到网络数据,就这里初始化
-        if (userData.readData == null) {
-            cc.log("本地数据:", cc.sys.localStorage.getItem('userdata'));
-            let userdata = cc.sys.localStorage.getItem('userdata');
-            if (userdata) {
-                this.readData = JSON.parse(userdata);
-            }
-            this.Init();
-            this.InitSceneInfo();
-        } else {
-            this.readData = userData.readData;
-            cc.log('读取到数据?:', this.readData)
-            this.Init();
-            this.InitSceneInfo();
-        }
-
+    ManageUI: {
+      default: null,
+      type: cc.Node,
     },
 
-    InitSceneInfo() {
-        //根据顺序生成
-        //初始化时间ui
-        cc.find("GameNode/ManageTimer").getComponent('ManageTimer').Init();
-        //初始化金钱ui,gold,diamond, cnt,snb,
-        cc.find("GameNode/ManageGolden").getComponent('ManageGolden').InitManageGlodenUI();
-        // //初始化地图物件
-        // cc.find("GameNode/ManageMap").getComponent('ManageMap').InitManageMap();
-        GlobalD.TiledMap.onInitSolid();
-
-        //初始化生成房屋 
-        /**
-         * dapp设定: 如果固定土地冲突,删除冲突的建筑和回收仓库
-         */
-        this.ManageUI.getComponent('ManageBuildings').InitBuildings();
-
-        //初始化道路
-        /**
-         * 原本游戏设定是先生产道路,现在为了方便处理等房屋生产后,再处理公路
-         * dapp设定: 如果固定土地冲突,删除对应的公路
-         */
-        this.onSpawnHighway();
-
-        //初始化生成人物
-        /**
-        * dapp设定: 如果固定土地位置冲突,把人物生成位置放置到主路
-        * onSpawnWorkerAIFromStoredData 此函数处理
-        */
-        cc.find('GameNode/ManageWorker').getComponent('ManageWorker').InitWorkerAI();
-
-        let _BFirstLoadGame = this.readData ? this.readData.BFirstLoadGame : 0;
-        //初始化新手教学
-        GlobalD.ManageTask.InitTask(_BFirstLoadGame);
-
-        this.ManageUI.getComponent('ManageUI').Init();
-
-    },
-    InitNextworkData() {
-        // console.log("this.readData", this.readData);
-        this.Golden = this.readData.Golden;
-        this.Diamond = this.readData.Diamond;
-        this.shareGive = this.readData.shareGive;
-        //签到分享给钻石金币
-        this.signInGive = this.readData.signInGive;
-        //每个月 给的 低保
-        this.EveryGive = this.readData.EveryGive;
-        //公共分享
-        this.publicGive = this.readData.publicGive;
-
-        // cc.log('初始化网络数据');
-        //读取日期数据
-        this.GameYear = this.readData.GameYear;
-        this.GameMonth = this.readData.GameMonth;
-        this.GameDay = this.readData.GameDay;
-
-        //读取金币
-        this.Golden = this.readData.Golden;
-        //读取钻石
-        this.Diamond = this.readData.Diamond;
-        // cc.log('this.readData.Diamond', this.readData.Diamond);
-        //读取工人等级
-        this.WorkerLV = this.readData.WorkerLV;
-        //工人数量
-        this.WorkerNum = this.readData.WorkerNum;
-        //工人容量
-        this.WorkerCapacity = this.readData.WorkerCapacity;
-        this.GameDate = this.readData.GameDate;
-        this.LastTimeEveryDayRewardsDate = this.readData.LastTimeEveryDayRewardsDate;
-        this.LastTimeLuckDate = this.readData.LastTimeLuckDate;
-        this.EveryDayRewardsArray = this.readData.EveryDayRewardsArray;//.split('_');
-        this.TerritoryStateArray = this.readData.TerritoryStateArray;//.split('_');
-        //面板状态
-        this.BuildingStateArray = this.readData.BuildingStateArray;//.split('_');
-
-        //解锁设置为 不用解锁
-        // this.BuildingLockStateArray.forEach((value, index, array) => {
-        //     array[index] = 1;
-        // })
-        this.BuildingLockStateArray = this.readData.BuildingLockStateArray;//.split('_');
-        this.BuildingNumArray = this.readData.BuildingNumArray;//.split('_');
-        this.DiamondNumArray = this.readData.DiamondNumArray;//.split('_');
-        this.FoodTradeState = this.readData.FoodTradeState;
-        this.WoodTradeState = this.readData.WoodTradeState;
-        this.MineralTradeState = this.readData.MineralTradeState;
-        //工人工作信息
-        if (this.readData.characterInfoArray) {
-            this.CharacterInfoArray = this.readData.characterInfoArray;
-        } else {
-            this.CharacterInfoArray = [];
-        }
-        //道路数据
-        if (this.readData.highwayIndex)
-            this.GameData_highwayIndex = this.readData.highwayIndex;
-
-        //建筑物数据
-        if (this.readData.buildingsInfo)
-            this.GameData_buildings = this.readData.buildingsInfo;
-
-        this.LotteryTimes = this.readData.LotteryTimes;
-        //任务
-        if (this.readData.TaskIconCountClick)
-            task.TaskIconCountClick = this.readData.TaskIconCountClick;
-    },
-    /**
-     * 初始化
-     */
-    Init: function () {
-        let _BFirstLoadGame = false;//  this.readData ? this.readData.BFirstLoadGame : 0;
-        //date
-        this.GameYear = 0;
-        this.GameMonth = 0;
-        this.GameDay = 0;
-        this.GameDate = '0000/00/01';
-        /**
-         * 新增 CNT 和 SNB
-         */
-        this.CNT = 0;
-        this.SNB = 0;
-        this.Golden = 2000;
-        this.Diamond = 100;
-        this.WorkerLV = 0;
-        this.WorkerNum = 0;
-        this.CharacterInfoArray = [];
-        this.WorkerCapacity = 5;
-        this.TerritoryStateArray = [1, 1, 1, 1, 1, 1, 1, 1];//测试,全开地图
-        /**
-         * 添加建筑往后添加,到时候ManageBuildings 脚本 会初始化根据顺序
-         * BuildingStateArray---相关 GetBuildingStateArray 获取建筑状态
-         * BuildingNumArray  ---相关 GetBuildingNumArray 获取建筑数量
-         * BuildingFrameArray ---相关 ManageUI  添加面板是否解锁之类的相关预制  
-         */
-        this.BuildingStateArray = [
-            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, //Holy Farmland
-            1 //Holy Farmland seed
-        ];
-        this.BuildingLockStateArray = [
-            1, //公路
-            1,  //路铲
-            1,  //拆迁
-            1,  //农舍
-            0,  //单元楼
-            0,  //别墅
-            1, //农田
-            0,//伐木场
-            0, //矿坑
-            1, //加工厂
-            0,//冷饮摊
-            0,//贩卖机
-            0,//面包房
-            0,//早餐车
-            0, //饮茶店
-            0,//点心店
-            0, //美食店
-            0,//西餐厅
-            0, //花店
-            0, //美发店
-            0,//洋装店
-            0, //珠宝店
-            0, //电影院
-            1,//路灯
-            1, //绿化带
-            1, //花坛
-            0,//喷泉
-            0, //警察局
-            0,//游乐场
-            0,  //蓝色城堡
-            0, //粉色城堡
-            1, //Holy Farmland
-            1, //Holy Farmland seed
-        ];
-        //建筑物数量
-        this.BuildingNumArray = [
-            0, //公路
-            0,  //路铲
-            0,  //拆迁
-            4,  //农舍
-            1,  //单元楼
-            1,  //别墅
-            4, //农田
-            1,//伐木场
-            1, //矿坑
-            2, //加工厂
-            2,//冷饮摊
-            1,//贩卖机
-            1,//面包房
-            1,//早餐车
-            1, //饮茶店
-            1,//点心店
-            1, //美食店
-            1,//西餐厅
-            1, //花店
-            1, //美发店
-            1,//洋装店
-            1, //珠宝店
-            1, //电影院
-            1,//路灯
-            1, //绿化带
-            1, //花坛
-            1,//喷泉
-            1, //警察局
-            1,//游乐场
-            1,  //蓝色城堡
-            1,  //粉色城堡
-            1, //Holy Farmland
-            1, //Holy Farmland seed
-        ];
-
-        this.DiamondNumArray = AConfig.DiamondArray;
-        //todo 钻石消耗默认值
-        this.DiamondNumArray.forEach((value, index, array) => {
-            array[index] = 0;
-        })
-        cc.log('钻石消耗默认值', this.DiamondNumArray);
-        this.EveryDayRewardsArray = [0, 0, 0, 0, 0, 0, 0];
-
-        this.LastTimeEveryDayRewardsDate = '0000/00/00';
-        this.LastTimeLuckDate = '0000/00/00';
-
-        this.FoodTradeState = 1;
-        this.WoodTradeState = 1;
-        this.MineralTradeState = 1;
-        //转盘分享给钻石金币
-        this.shareGive = [200, 5];
-        //签到分享给钻石金币
-        this.signInGive = [200, 5];
-        //每个月 给的 低保
-        this.EveryGive = [500, 10];
-        //公共分享
-        this.publicGive = [200, 50];
-        //每天抽奖次数
-        this.LotteryTimes = 10;
-
-        // 1 === _BFirstLoadGame
-        if (_BFirstLoadGame) {
-            console.log("this.readData", this.readData);
-            // cc.log('初始化网络数据');
-            //读取日期数据
-            this.GameYear = this.readData.GameYear;
-            this.GameMonth = this.readData.GameMonth;
-            this.GameDay = this.readData.GameDay;
-
-            /**
-             * 接口
-             * todo cnt和snb 由钱包读取
-             */
-            this.CNT = 0;
-            this.SNB = 0;
-
-            //读取金币
-            this.Golden = this.readData.Golden;
-            //读取钻石
-            this.Diamond = this.readData.Diamond;
-            // cc.log('this.readData.Diamond', this.readData.Diamond);
-            //读取工人等级
-            this.WorkerLV = this.readData.WorkerLV;
-            //工人数量
-            this.WorkerNum = this.readData.WorkerNum;
-            //工人容量
-            this.WorkerCapacity = this.readData.WorkerCapacity;
-            this.GameDate = this.readData.GameDate;
-            this.LastTimeEveryDayRewardsDate = this.readData.LastTimeEveryDayRewardsDate;
-            this.LastTimeLuckDate = this.readData.LastTimeLuckDate;
-            this.EveryDayRewardsArray = this.readData.EveryDayRewardsArray;//.split('_');
-            this.TerritoryStateArray = this.readData.TerritoryStateArray;//.split('_');
-            //面板状态
-            this.BuildingStateArray = this.readData.BuildingStateArray;//.split('_');
-
-            //解锁设置为 不用解锁
-            this.BuildingLockStateArray.forEach((value, index, array) => {
-                array[index] = 1;
-            })
-            // this.BuildingLockStateArray = this.readData.BuildingLockStateArray.split('_');
-            this.BuildingNumArray = this.readData.BuildingNumArray;//.split('_');
-            this.DiamondNumArray = this.readData.DiamondNumArray;//.split('_');
-            this.FoodTradeState = this.readData.FoodTradeState;
-            this.WoodTradeState = this.readData.WoodTradeState;
-            this.MineralTradeState = this.readData.MineralTradeState;
-
-            //工人工作信息
-            if (this.readData.characterInfoArray)
-                this.CharacterInfoArray = this.readData.characterInfoArray;
-            //道路数据
-            if (this.readData.highwayIndex)
-                this.GameData_highwayIndex = this.readData.highwayIndex;
-
-            //建筑物数据
-            if (this.readData.buildingsInfo)
-                this.GameData_buildings = this.readData.buildingsInfo;
-
-            this.LotteryTimes = this.readData.LotteryTimes;
-            //任务
-            if (this.readData.TaskIconCountClick)
-                task.TaskIconCountClick = this.readData.TaskIconCountClick;
-            //测试5W
-            // this.PlusDiamond(50000);
-        }
+    GameVersion: {
+      default: -1,
+      type: cc.Integer,
     },
 
-    //GET / SET /Plus
-    GetGameDate: function () {
-        return this.GameDate;
-    },
-    SetGameDate: function (num) {
-        this.GameDate = num;
-    },
-    PlusGameDate: function (num) {
-        this.GameDate += num;
-    },
-    GetGolden: function () {
-        return parseInt(this.Golden);
-    },
-    GetGoldenCallBack(_CallBack) {
-        if (_CallBack)
-            _CallBack({ resGolden: parseInt(this.Golden) });
-    },
-    SetGolden: function (Num) {
-        let LastMoney = this.Golden;
-        this.Golden = Num;
-        let CurrentMoney = Num;
-        this.ManageUI.getComponent('ManageUI').GoldenChangeCallBack(this.GetGolden(), LastMoney, CurrentMoney);
-    },
-    PlusGolden: function (Num) {
-        if (this.Golden + Num < 0) {
-            this.SetGolden(0);
-        }
-        else {
-            this.SetGolden(this.Golden + Num);
-        }
-        // task.task50W();
-    },
-    GetDiamond: function () {
-        return parseInt(this.Diamond);
-    },
-    SetDiamond: function (num) {
-        let LastMoney = this.Diamond;
-        this.Diamond = num;
-        let CurrentMoney = num;
-        this.ManageUI.getComponent('ManageUI').DiamondChangeCallBack(this.GetDiamond(), LastMoney, CurrentMoney);
-    },
-    PlusDiamond: function (num) {
-        if (this.Diamond + num < 0) {
-            this.SetDiamond(0);
-        }
-        else {
-            this.SetDiamond(this.Diamond + num);
-        }
+    //读取数据
+    readData: {
+      default: null,
+      visible: false,
     },
 
     /**
-     * 游戏里面的cnt 和神农呗
+     * 接口
+     * todo cnt和snb 由钱包读取
      */
-    GetCNT: function () {
-        return parseFloat(this.CNT);
+    CNT: {
+      default: 0,
+      visible: false,
     },
-    SetCNT: function (Num) {
-        this.CNT = Num;
-        this.ManageUI.getComponent('ManageUI').CNTChangeCallBack(this.CNT);
+    SNB: {
+      default: 0,
+      visible: false,
     },
-    GetSNB: function () {
-        return parseFloat(this.SNB);
-    },
-    SetSNB: function (Num) {
-        this.SNB = Num;
-        this.ManageUI.getComponent('ManageUI').SNBChangeCallBack(this.SNB);
-    },
-
-
-    GetWorkerLV: function () {
-        return parseInt(this.WorkerLV);
-    },
-    SetWorkerLV: function (num) {
-        this.WorkerLV = num;
-    },
-    PlusWorkerLV: function (num) {
-        this.WorkerLV += num;
-    },
-    GetWorkerNum: function () {
-        return parseInt(this.WorkerNum);
-    },
-    SetWorkerNum: function (num) {
-        this.WorkerNum = num;
-    },
-    PlusWorkerNum: function (num) {
-        this.WorkerNum += num;
-    },
-    GetLastTimeEveryDayRewardsDate: function () {
-        return this.LastTimeEveryDayRewardsDate;
-    },
-    //获取转盘 时间
-    GetLastTimeLuckDate: function () {
-        return this.LastTimeLuckDate;
-    },
-    //设置转盘时间
-    SetLastTimeLuckDate: function (DateString) {
-        this.LastTimeLuckDate = DateString;
-    },
-    SetLastTimeEveryDayRewardsDate: function (DateString) {
-        this.LastTimeEveryDayRewardsDate = DateString;
+    //站内收益
+    CNTDrawBalance: {
+      default: 0,
+      visible: false,
     },
 
-    //工人信息数组
-    GetWorkerCharacterInfoArray: function () {
-        return this.CharacterInfoArray;
-    },
-    SetWorkerCharacterInfoArray: function (item) {
-        this.CharacterInfoArray = item;
+    //读取的土地文件
+    ConfigLand: {
+      default: null,
+      visible: false,
     },
 
-    /*** */
-    GetWorkerCapacity: function () {
-        return parseInt((this.WorkerCapacity));
-    },
-    SetWorkerCapacity: function (num) {
-        this.WorkerCapacity = num;
-    },
-    PlusWorkerCapacity: function (num) {
-        this.WorkerCapacity += num;
-    },
-    GetTerritoryStateArray: function () {
-        return this.TerritoryStateArray;
-    },
-    SetTerritoryStateArray: function (aTerritoryStateArray) {
-        this.TerritoryStateArray = aTerritoryStateArray;
-    },
-    PlusTerritoryStateArray: function (Item) {
-        this.TerritoryStateArray.push(Item);
-    },
-    GetBuildingStateArray: function () {
-        return this.BuildingStateArray;
-    },
-    SetBuildingStateArray: function (aBuildingStateArray) {
-        this.BuildingStateArray = aBuildingStateArray;
-    },
-    PlusBuildingStateArray: function (Item) {
-        this.BuildingStateArray.push(Item);
-    },
-    GetBuildingLockStateArray: function () {
-        return this.BuildingLockStateArray;
-    },
-    SetBuildingLockStateArray: function (aArray) {
-        this.BuildingLockStateArray = aArray;
-    },
-    PlusBuildingLockStateArray: function (Item) {
-        this.BuildingLockStateArray.push(Item);
-    },
+    toast: null,
+    scheduleObj: null,
+    toastCallback: null,
+    isStart: true,
+    isInit: false,
 
-    GetBuildingNumArray: function () {
-        return this.BuildingNumArray;
-    },
-    SetBuildingNumArray: function (aBuildingNumArray) {
-        this.BuildingNumArray = aBuildingNumArray;
-    },
-    PlusBuildingNumArray: function (Item) {
-        this.BuildingNumArray.push(Item);
-    },
-    //操作钻石数据
-    GetDiamondNumArray: function () {
-        return this.DiamondNumArray;
-    },
-    SetDiamondNumArray: function (aDiamondNumArray) {
-        this.DiamondNumArray = aDiamondNumArray;
-    },
-    GetEveryDayRewardsArray: function () {
-        return this.EveryDayRewardsArray;
-    },
-    SetEveryDayRewardsArray: function (aArray) {
-        this.EveryDayRewardsArray = aArray;
-    },
-    PlusEveryDayRewardsArray: function (Item) {
-        this.EveryDayRewardsArray.push(Item);
-    },
-    GetFoodTradeState: function () {
-        return parseInt((this.FoodTradeState));
-    },
-    SetFoodTradeState: function (num) {
-        this.FoodTradeState = num;
-    },
-    PlusFoodTradeState: function (num) {
-        this.FoodTradeState += num;
-    },
-    GetWoodTradeState: function () {
-        return parseInt((this.WoodTradeState));
-    },
-    SetWoodTradeState: function (num) {
-        this.WoodTradeState = num;
-    },
-    PlusWoodTradeState: function (num) {
-        this.WoodTradeState += num;
-    },
-    GetMineralTradeState: function () {
-        return parseInt((this.MineralTradeState));
-    },
-    SetMineralTradeState: function (num) {
-        this.MineralTradeState = num;
-    },
-    PlusMineralTradeState: function (num) {
-        this.MineralTradeState += num;
-    },
-    GetLotteryTimes: function () {
-        return parseInt((this.LotteryTimes));
-    },
-    SetLotteryTimes: function (num) {
-        this.LotteryTimes = num;
-    },
-    PlusLotteryTimes: function (num) {
-        this.LotteryTimes += num;
-    },
-
-
-    //初始化道路
-    onSpawnHighway() {
-        // 获取InitPoint层
-        let InitPos = this._tiledMap.getLayer('InitPoint');
-        InitPos.enabled = false;
-
-        //创建公路数据
-        if (this.readData && this.readData.allHighwayStylesAndIndex) {
-            //保存到内存中
-            this.GameData_highwayIndex = this.readData.highwayIndex;
-            //先赋值道路的对象数组
-            let _AllHighwayAIndex = Object.assign([], this.readData.allHighwayStylesAndIndex);
-            //获取最后建造公路的层级
-            this.HighwayLayer = this._tiledMap.getLayer('Highway');
-            for (let i = 0; i < _AllHighwayAIndex.length; i++) {
-                let _tiledPos = GlobalD.TiledMap.analyticalIndexData(_AllHighwayAIndex[i].highwayInfoIndex);
-                /**
-                 * 解决固定土地时候,道路 和房子 冲突
-                 * 
-                 */
-                if (GlobalD.game.getManageGameIndexArrayAt(cc.v2(_tiledPos.x, _tiledPos.y))) {
-                    continue;
-                }
-                let highwayTemp = cc.instantiate(this.HighWayPrefabs);
-                highwayTemp.parent = this.HighwayLayer.node;
-                let tiledTile = highwayTemp.addComponent('TiledTile');
-                tiledTile.x = _tiledPos.x;
-                tiledTile.y = _tiledPos.y;
-                //地图设置可行走区域公路设置
-                AStar.setMapSolid(_tiledPos.x, _tiledPos.y, 0);
-                // _buildId ==0 是公路
-                let _buildId = 0;
-                let occupyTemp = cc.v2(_buildId, _AllHighwayAIndex[i].highwayInfoIndex);
-                GlobalD.game.OccupyArray.push(occupyTemp);
-                highwayTemp.getComponent('HighwayInfo').onChangeHighwayStyles(_AllHighwayAIndex[i].highwayInfoType);
-
-                GlobalD.game.AllHighwayStylesAndIndex.push(_AllHighwayAIndex[i]);
-
-            }
-            // console.log("end");
-        } else {
-            //如果用户没有存储数据
-            //根据InitPoint 的数据,创建初始化的地图数据 的初始化数据
-
-            this.HighwayLayer = this._tiledMap.getLayer('Highway');
-            for (var i = 0; i < 32; i++) {
-                //去除中间两条路
-                if (i == 16 || i == 17) continue;
-                for (var j = 0; j < 32; j++) {
-                    let tilesPos = cc.v2(i, j);
-
-                    if (InitPos.getTileGIDAt(tilesPos)) {
-
-
-                        let index = GlobalD.TiledMap.getIndex(tilesPos);
-                        this.GameData_highwayIndex.push(index);
-
-                        let highwayTemp = cc.instantiate(this.HighWayPrefabs);
-                        highwayTemp.parent = this.HighwayLayer.node;
-                        let tiledTile = highwayTemp.addComponent('TiledTile');
-                        tiledTile.x = tilesPos.x;
-                        tiledTile.y = tilesPos.y;
-                        // cc.log('onSpawnHighway2');
-                        //地图设置可行走区域公路设置
-                        AStar.setMapSolid(tilesPos.x, tilesPos.y, 0);
-                        // _buildId ==0 是公路
-                        let _buildId = 0;
-                        let occupyTemp = cc.v2(_buildId, index);
-                        GlobalD.game.OccupyArray.push(occupyTemp);
-
-                        let tile = InitPos.getTiledTileAt(tilesPos.x, tilesPos.y, true);
-
-                        let _MoveType = reGameStates.HighwayType.moveX;
-                        // if (tile.gid == 15) {
-                        //     _MoveType = reGameStates.HighwayType.moveX;
-                        // } else 
-                        if (tile.gid == 16) {
-                            _MoveType = reGameStates.HighwayType.moveY;
-                        } else if (tile.gid == 11) {
-                            _MoveType = reGameStates.HighwayType.ZebraCrossingX;
-                        } else if (tile.gid == 12) {
-                            _MoveType = reGameStates.HighwayType.ZebraCrossingY;
-                        }
-                        // return;
-                        //更换公路样式
-                        GlobalD.game.onCreateDifferentRoadStyles({
-                            _buildId: _buildId,
-                            _highwayType: _MoveType,
-                            _roadIndex: index,
-                            _hightwayNode: highwayTemp
-                        });
-                    }
-                }
-            }
-        }
-        //外面的两条路
-        let initRoad = this._tiledMap.getLayer('Road');
-        initRoad.enabled = false;
-        for (var i = 16; i < 18; i++) {
-            for (var j = 0; j < 32; j++) {
-                let tilesPos = cc.v2(i, j);
-                // cc.log('road tilesPos',tilesPos)
-                if (initRoad.getTileGIDAt(tilesPos)) {
-                    let index = GlobalD.TiledMap.getIndex(tilesPos);
-                    this.GameData_highwayIndex.push(index);
-                    let highwayTemp = cc.instantiate(this.HighWayPrefabs);
-                    highwayTemp.parent = this.HighwayLayer.node;
-                    let tiledTile = highwayTemp.addComponent('TiledTile');
-                    tiledTile.x = tilesPos.x;
-                    tiledTile.y = tilesPos.y;
-                    // cc.log('initRoad');
-                    //地图设置可行走区域公路设置
-                    AStar.setMapSolid(tilesPos.x, tilesPos.y, 0);
-                    let _buildId = 0;
-                    let occupyTemp = cc.v2(_buildId, index);
-                    GlobalD.game.OccupyArray.push(occupyTemp);
-                    //更换公路样式
-                    // if (j >= 25 && j <= 27 || j >= 19 && j <= 21 || j >= 9 && j <= 11)
-                    //     highwayTemp.getComponent('HighwayInfo').onChangeHighwayStyles(reGameStates.HighwayType.none);
-                    // else
-                    //     highwayTemp.getComponent('HighwayInfo').onChangeHighwayStyles(reGameStates.HighwayType.moveY);
-
-                }
-            }
-        }
-    },
-
-    //清除所有的数据
-    onClearAllData() {
-        this.unschedule(this.AutoSaveData);
-        //任务索引
-        cc.sys.localStorage.removeItem('userdata');
-        //跳回登录场景
-        // cc.director.loadScene('Login');
-    },
-    //保存数据请求
     /**
-     * 
-     * 现在转服务器存储,原本所有相关操作通过服务器计算。
-     * 一、目前涉及到的是 SNT 和 SNB 两个货币相关,和买田地操作 (可以理解为租聘,三种类型)
-     * 
-     * isNetwork:true,上传到网络
-     * 
+     * 限制重复触发支付, 正在支付中转态,
      */
-    pushData: function (isNetwork) {
-        // cc.log(this.EveryDayRewardsArray);
-        // console.log(this.readData.BFirstLoadGame);
-        var datas = {
-            version: this.GameVersion,
-            // 转后台处理
-            BFirstLoadGame: 1,//只要push数据,就证明已经开始第一次游戏了
-
-            /**游戏不修改,默认值 start */
-            shareGive: this.shareGive,
-            //签到分享给钻石金币
-            signInGive: this.signInGive,
-            //每个月 给的 低保
-            EveryGive: this.EveryGive,
-            //公共分享
-            publicGive: this.publicGive,
-            /**游戏不修改,默认值 end */
-
-            //时间
-            GameYear: this.GameYear,
-            GameMonth: this.GameMonth,
-            GameDay: this.GameDay,
-
-            //这里只是单纯的存储起来
-            CNT: this.CNT,
-            SNB: this.SNB,
-
-            Golden: this.Golden,
-            Diamond: this.Diamond,
-            WorkerLV: this.WorkerLV,
-            WorkerNum: this.WorkerNum,
-            WorkerCapacity: this.WorkerCapacity,
-            GameDate: this.GameDate,
-            LastTimeEveryDayRewardsDate: this.LastTimeEveryDayRewardsDate,
-            LastTimeLuckDate: this.LastTimeLuckDate,
-            EveryDayRewardsArray: this.EveryDayRewardsArray,//.join('_'),
-            TerritoryStateArray: this.TerritoryStateArray,//.join('_'),
-            //面板状态
-            BuildingStateArray: this.BuildingStateArray,//.join('_'),
-            BuildingLockStateArray: this.BuildingLockStateArray,//.join('_'),
-
-            /**
-             * SNB和CNT相关,需要后台筛选 田地 和 种子。单独处理
-             */
-            BuildingNumArray: this.BuildingNumArray,//.join('_'),
-            DiamondNumArray: this.DiamondNumArray,//.join('_'),
-            FoodTradeState: this.FoodTradeState,
-            WoodTradeState: this.WoodTradeState,
-            MineralTradeState: this.MineralTradeState,
-
-            LotteryTimes: this.LotteryTimes,
-
-            /**
-             * 这些数据不用服务器初始化
-             */
-            //工人工作信息
-            characterInfoArray: this.CharacterInfoArray,
-            //道路数据
-            highwayIndex: this.GameData_highwayIndex,
-            allHighwayStylesAndIndex: GlobalD.game.AllHighwayStylesAndIndex,
-            //建筑物数据
-            buildingsInfo: this.GameData_buildings,
-            //任务
-            TaskIconCountClick: task.TaskIconCountClick
-        }
-
-        if (isNetwork) {
-            var data = [];
-            // data["openid"] = userData.openId;
-            // data["userdata"] = JSON.stringify(datas);
-            data["playerData"] = JSON.stringify(datas);
-
-            /** 推送信息 */
-            utils.post(utils.api.playerPushInfo, data, (res, playerPushInfoTemp) => {
-                // console.log('playerPushInfoTemp', playerPushInfoTemp);
-            })
-        } else {
-            console.log("存储本地:" + isNetwork);
-            //保存用户数据到本地
-            cc.sys.localStorage.setItem('userdata', JSON.stringify(datas));
-        }
-
-
-    },
+    isPlayingCnt: false,
+    isPlayingSnb: false,
 
     /**
-     * 暂时不需要从这里读取
+     * 处理请求
      */
-    getLandConfig() {
-        utils.get(utils.api.landConfig, {}, (res, value) => {
-            if (0 === value.code) {
-                this.ConfigLand = value.data;
-            } else {
-                console.warn("未能读取到config土地?");
-            }
-        })
-    },
-    //获取用户全部租赁土地
-    getUserLandList() {
-        utils.get(utils.api.userLandList, {}, (res, vaule) => {
-
-        })
-    },
-    //获取用户已租赁土地的状态
-    getLandState(context) {
-        let { landId, callback } = context;
-        utils.get(utils.api.landState, { landId: landId }, (res, vaule) => {
-            callback(res, vaule);
-        })
-    },
-    //获取商城种子
-    getMallSeed(callback) {
-        utils.get(utils.api.mallSeed, {}, (res, vaule) => {
-            callback(res, vaule);
-        })
-    },
-
-    getWarehouseSeedAndFruit(callback) {
-        utils.get(utils.api.getSeedAndFruit, {}, (res, vaule) => {
-            callback(res, vaule);
-        })
-    },
-    //获取种子状态
-    onGetSeedState(data, callback) {
-        utils.get(utils.api.getSeedState, data, (res, vaule) => {
-            callback(res, vaule);
-        })
-    },
-
-    //种植种子
-    // data:{landId:1,seedId:1}
-    onPlant(data, callback) {
-        utils.get(utils.api.plant, data, (res, vaule) => {
-            callback(res, vaule);
-        })
-    },
-
-    //收取果实
-    onAddFruit(data, callback) {
-        if (this.isOnAddFruit) {
-            console.log("收取果实过快!");
-            return;
-        }
-        this.isOnAddFruit = true;
-        utils.post(utils.api.addFruit, data, (res, vaule) => {
-            this.isOnAddFruit = false;
-            callback(res, vaule);
-        })
-    },
-
-    //出售果实
-    onSaleFruit(data, callback) {
-        if (this.isOnSaleFruit) {
-            console.log("出售果实过快!");
-            return;
-        }
-        this.isOnSaleFruit = true;
-        utils.post(utils.api.saleFruit, data, (res, vaule) => {
-            this.isOnSaleFruit = false;
-            callback(res, vaule);
-        })
-    },
-
-    //赠送果实
-    onGrantFruit(data, callback) {
-        if(this.isOnGrantFruit){
-            console.log("赠送果实过快!");
-            return;
-        }
-        this.isOnGrantFruit = true;
-        utils.post(utils.api.grantFruit, data, (res, vaule) => {
-            this.isOnGrantFruit = false;
-            callback(res, vaule);
-        })
-    },
-
-    //神农呗购买种子
-    onBuySeedsWithSNB(snbAmount, seedId, callback) {
-        utils.post(utils.api.snbBuySeeds, { payAmount: snbAmount, seedId: seedId }, (res, vaule) => {
-            callback(res, vaule);
-        })
-    },
-
-    //获取用户的snb
-    onGetUserSnb(callback) {
-        utils.get(utils.api.userSnbInfo, {}, (res, value) => {
-            GlobalD.GameData.SetSNB(value.data.SNB);
-            if (callback)
-                callback(res, value);
+    //现在多次触发
+    isOnAddFruit: false,
+    isOnSaleFruit: false,
+    isOnGrantFruit: false,
+  },
+  onLoad() {
+    //初始化GameData全局变量
+    GlobalD.GameData = this
+    this.GameConfig()
+  },
+  GameConfig() {
+    this.AddBuildingCost = 5
+    this.RemoveBuildingCost = 5
+
+    //
+    this.Dapp = {
+      UserInfo: null,
+    }
+  },
+  start() {
+    cc.loader.loadRes(
+      'prefab/gameToast',
+      function (err, texture) {
+        this.toast = cc.instantiate(texture)
+        this.toast.parent = cc.find('Canvas/UICamera')
+        this.toast.zIndex = 999
+        this.toast.active = false
+        this.scheduleObj = this.schedule(() => {
+          this.updateToast()
+        }, 1)
+      }.bind(this)
+    )
+
+    this._tiledMap = GlobalD.TiledMap._tiledMap
+    //调用初始化dapp
+    this.isDebugMode(GlobalD.dapp)
+  },
+  /**
+   * 根据 不存在dapp 的话,使用本地测试
+   * @param {*} bInit
+   */
+  isDebugMode: function (bInit) {
+    if (bInit) {
+      //读取网络数据
+      try {
+        GlobalD.dapp.cntBalance().then((cntBalance) => {
+          //会延迟返回
+          // console.log("获取cnt:" + cntBalance) // string, 精度18,需要自行处理省略几位小数
+          GlobalD.GameData.SetCNT(cntBalance)
         })
-    },
-
+      } catch (err) {
+        console.error(err) // 初始化失败,运行环境不是钱包环境
+      }
+      //登录时候已经初始化好snb了
+      this.SNB = GlobalD.UserInfo.snb
+
+      this.readData = userData.readData
+      // cc.log('playerPullInfo 读取到数据?:', this.readData)
+      this.InitNextworkData()
+      this.InitSceneInfo()
+
+      // 自动存储数据
+      /**
+       * todo 如果退出游戏,触发一次存储。
+       */
+      this.AutoSaveData = function () {
+        this.pushData(true)
+      }
+      this.schedule(this.AutoSaveData, 20)
+    } else {
+      // 清除
+      cc.log('本地数据重新开始,并且不初始化')
+      // this.onClearAllData();
+      this.Init()
+      this.InitSceneInfo()
+      this.AutoSaveData = function () {
+        this.pushData(false)
+      }
+      this.schedule(this.AutoSaveData, 20)
+    }
+  },
+
+  getData: function () {
+    //如果开局没有读取到网络数据,就这里初始化
+    if (userData.readData == null) {
+      cc.log('本地数据:', cc.sys.localStorage.getItem('userdata'))
+      let userdata = cc.sys.localStorage.getItem('userdata')
+      if (userdata) {
+        this.readData = JSON.parse(userdata)
+      }
+      this.Init()
+      this.InitSceneInfo()
+    } else {
+      this.readData = userData.readData
+      cc.log('读取到数据?:', this.readData)
+      this.Init()
+      this.InitSceneInfo()
+    }
+  },
+
+  InitSceneInfo() {
+    //根据顺序生成
+    //初始化时间ui
+    cc.find('GameNode/ManageTimer').getComponent('ManageTimer').Init()
+    //初始化金钱ui,gold,diamond, cnt,snb,
+    cc.find('GameNode/ManageGolden')
+      .getComponent('ManageGolden')
+      .InitManageGlodenUI()
+    // //初始化地图物件
+    // cc.find("GameNode/ManageMap").getComponent('ManageMap').InitManageMap();
+    GlobalD.TiledMap.onInitSolid()
+
+    //初始化生成房屋
     /**
-     * 支付cnt操作
-     * @param {*} amount // 需支付金额
-     * @param {*} payType 支付类型,1购买土地租凭, 2自然灾害防护,3野兽防护
-     * @param {*} itemType 操作物品的id 字符串
+     * dapp设定: 如果固定土地冲突,删除冲突的建筑和回收仓库
      */
-    payCNT(cntAmount, payType, itemType, callback) {
-        console.log("购买金额:" + cntAmount + "购买类型PlayType:" + payType + "购买物品的id:" + itemType);
-        if (!GlobalD.dapp) {
-            console.warn("GlobalD.dapp未初始化,不能payCNT!");
-            return;
-        }
-        //
-        if (this.isPlayingCnt) {
-            console.warn("同时触发支付CNT过快!");
-            return;
-        }
-        if (GlobalD.GameData.GetCNT() < cntAmount) {
-            console.log("cnt 不足,GetCNT:" + GlobalD.GameData.GetCNT() + "消费的cntAmount" + cntAmount);
-            GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), "CNT不足!", 2, () => {
-                console.log("finish toast! CNT不足!");
-            });
-            return;
-        }
-        this.isPlayingCnt = true;
-        GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), "支付处理中...", 5, () => {
-            console.log("finish toast!支付处理中...");
-        });
-
-        GlobalD.dapp.payCnt(cntAmount, payType, itemType).then((data) => {
-            const [err, tx] = data;
-            this.isPlayingCnt = false;
-            if (err === null) {
-                // TODO 成功, 支付为链上操作,需要提供回调接口给这边服务端确认交易成功后修改购买订单结果
-                console.log(tx) // 交易hash,唯一标识符
-
-                GlobalD.dapp.cntBalance().then((cntBalance) => {
-                    //会延迟返回
-                    // console.log("更新cnt:" + cntBalance) // string, 精度18,需要自行处理省略几位小数
-                    GlobalD.GameData.SetCNT(cntBalance);
-                });
-                GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), "支付成功!", 5, () => {
-                    GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), "区块确认中,请耐心等待!", 120);
-                });
-
-
-            } else {
-                console.log(err)
-                GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), err, 2, () => {
-                    console.log("finish toast!");
-                });
-            }
-
-            if (callback) {
-                callback(data);
-            }
-        });
-    },
+    this.ManageUI.getComponent('ManageBuildings').InitBuildings()
 
+    //初始化道路
     /**
-     * 神农呗转换CNT ,比例是5:1
-     * @param {*} snbAmount 
-     * @param {*} callback 
-     * @returns 
+     * 原本游戏设定是先生产道路,现在为了方便处理等房屋生产后,再处理公路
+     * dapp设定: 如果固定土地冲突,删除对应的公路
      */
-    onSnbToCnt(snbAmount, callback) {
-        if (!GlobalD.dapp) {
-            console.warn("GlobalD.dapp未初始化,不能onSnbToCnt!");
-            return;
-        }
-        // GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), "暂不支持兑换CNT!", 2, () => {
-        //     console.log("finish toast!");
-        // });
-        // return;
-        if (this.isPlayingSnb) {
-            console.warn("同时触发支付SNB过快!");
-            return;
-        }
-        if (GlobalD.GameData.GetSNB() <= 0) {
-            console.log("神农呗数量GetSNB:", GlobalD.GameData.GetSNB(), "替换snbAmount:", snbAmount);
-            GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), "神农呗数量不足!", 2, () => {
-                console.log("finish toast!");
-            });
-            return;
-        }
+    this.onSpawnHighway()
 
-        GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), "已发起兑换!", 5, () => {
-            console.log("finish toast!");
-        });
-        this.isPlayingSnb = true;
-        GlobalD.dapp.snbToCnt(snbAmount).then((data) => {
-            //更新日志数据
-            cc.find("GameNode/ManageDapp").getComponent("ManageDapp").onUpdateSnbList();
-            const [err, tx] = data;
-            this.isPlayingSnb = false;
-            if (err === null) {
-                // TODO 成功, 兑换为链上操作,需要提供回调接口给这边服务端确认交易成功后修改扣除SNB数量
-                console.log(tx) // 交易hash,唯一标识符
-                //扣除对应的神农呗,本地修改显示
-                GlobalD.GameData.SetSNB(GlobalD.GameData.GetSNB() - snbAmount);
-
-                GlobalD.dapp.cntBalance().then((cntBalance) => {
-                    //会延迟返回
-                    // console.log("更新cnt:" + cntBalance) // string, 精度18,需要自行处理省略几位小数
-                    GlobalD.GameData.SetCNT(cntBalance);
-                });
-
-
-                GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), "区块确认中,请耐心等待!", 5, () => {
-                    console.log("finish toast!");
-                });
-
-            } else {
-                console.log(err)
-                GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), err, 2, () => {
-                    console.log("finish toast!");
-                });
-            }
+    //初始化生成人物
+    /**
+     * dapp设定: 如果固定土地位置冲突,把人物生成位置放置到主路
+     * onSpawnWorkerAIFromStoredData 此函数处理
+     */
+    cc.find('GameNode/ManageWorker').getComponent('ManageWorker').InitWorkerAI()
+
+    let _BFirstLoadGame = this.readData ? this.readData.BFirstLoadGame : 0
+    //初始化新手教学
+    GlobalD.ManageTask.InitTask(_BFirstLoadGame)
+
+    this.ManageUI.getComponent('ManageUI').Init()
+  },
+  InitNextworkData() {
+    // console.log("this.readData", this.readData);
+    this.Golden = this.readData.Golden
+    this.Diamond = this.readData.Diamond
+    this.shareGive = this.readData.shareGive
+    //签到分享给钻石金币
+    this.signInGive = this.readData.signInGive
+    //每个月 给的 低保
+    this.EveryGive = this.readData.EveryGive
+    //公共分享
+    this.publicGive = this.readData.publicGive
+
+    // cc.log('初始化网络数据');
+    //读取日期数据
+    this.GameYear = this.readData.GameYear
+    this.GameMonth = this.readData.GameMonth
+    this.GameDay = this.readData.GameDay
+
+    //读取金币
+    this.Golden = this.readData.Golden
+    //读取钻石
+    this.Diamond = this.readData.Diamond
+    // cc.log('this.readData.Diamond', this.readData.Diamond);
+    //读取工人等级
+    this.WorkerLV = this.readData.WorkerLV
+    //工人数量
+    this.WorkerNum = this.readData.WorkerNum
+    //工人容量
+    this.WorkerCapacity = this.readData.WorkerCapacity
+    this.GameDate = this.readData.GameDate
+    this.LastTimeEveryDayRewardsDate = this.readData.LastTimeEveryDayRewardsDate
+    this.LastTimeLuckDate = this.readData.LastTimeLuckDate
+    this.EveryDayRewardsArray = this.readData.EveryDayRewardsArray //.split('_');
+    this.TerritoryStateArray = this.readData.TerritoryStateArray //.split('_');
+    //面板状态
+    this.BuildingStateArray = this.readData.BuildingStateArray //.split('_');
+
+    //解锁设置为 不用解锁
+    // this.BuildingLockStateArray.forEach((value, index, array) => {
+    //     array[index] = 1;
+    // })
+    this.BuildingLockStateArray = this.readData.BuildingLockStateArray //.split('_');
+    this.BuildingNumArray = this.readData.BuildingNumArray //.split('_');
+    this.DiamondNumArray = this.readData.DiamondNumArray //.split('_');
+    this.FoodTradeState = this.readData.FoodTradeState
+    this.WoodTradeState = this.readData.WoodTradeState
+    this.MineralTradeState = this.readData.MineralTradeState
+    //工人工作信息
+    if (this.readData.characterInfoArray) {
+      this.CharacterInfoArray = this.readData.characterInfoArray
+    } else {
+      this.CharacterInfoArray = []
+    }
+    //道路数据
+    if (this.readData.highwayIndex)
+      this.GameData_highwayIndex = this.readData.highwayIndex
+
+    //建筑物数据
+    if (this.readData.buildingsInfo)
+      this.GameData_buildings = this.readData.buildingsInfo
+
+    this.LotteryTimes = this.readData.LotteryTimes
+    //任务
+    if (this.readData.TaskIconCountClick)
+      task.TaskIconCountClick = this.readData.TaskIconCountClick
+  },
+  /**
+   * 初始化
+   */
+  Init: function () {
+    let _BFirstLoadGame = false //  this.readData ? this.readData.BFirstLoadGame : 0;
+    //date
+    this.GameYear = 0
+    this.GameMonth = 0
+    this.GameDay = 0
+    this.GameDate = '0000/00/01'
+    /**
+     * 新增 CNT 和 SNB
+     */
+    this.CNT = 0
+    this.SNB = 0
+    this.Golden = 2000
+    this.Diamond = 100
+    this.WorkerLV = 0
+    this.WorkerNum = 0
+    this.CharacterInfoArray = []
+    this.WorkerCapacity = 5
+    this.TerritoryStateArray = [1, 1, 1, 1, 1, 1, 1, 1] //测试,全开地图
+    /**
+     * 添加建筑往后添加,到时候ManageBuildings 脚本 会初始化根据顺序
+     * BuildingStateArray---相关 GetBuildingStateArray 获取建筑状态
+     * BuildingNumArray  ---相关 GetBuildingNumArray 获取建筑数量
+     * BuildingFrameArray ---相关 ManageUI  添加面板是否解锁之类的相关预制
+     */
+    this.BuildingStateArray = [
+      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, //Holy Farmland
+      1, //Holy Farmland seed
+    ]
+    this.BuildingLockStateArray = [
+      1, //公路
+      1, //路铲
+      1, //拆迁
+      1, //农舍
+      0, //单元楼
+      0, //别墅
+      1, //农田
+      0, //伐木场
+      0, //矿坑
+      1, //加工厂
+      0, //冷饮摊
+      0, //贩卖机
+      0, //面包房
+      0, //早餐车
+      0, //饮茶店
+      0, //点心店
+      0, //美食店
+      0, //西餐厅
+      0, //花店
+      0, //美发店
+      0, //洋装店
+      0, //珠宝店
+      0, //电影院
+      1, //路灯
+      1, //绿化带
+      1, //花坛
+      0, //喷泉
+      0, //警察局
+      0, //游乐场
+      0, //蓝色城堡
+      0, //粉色城堡
+      1, //Holy Farmland
+      1, //Holy Farmland seed
+    ]
+    //建筑物数量
+    this.BuildingNumArray = [
+      0, //公路
+      0, //路铲
+      0, //拆迁
+      4, //农舍
+      1, //单元楼
+      1, //别墅
+      4, //农田
+      1, //伐木场
+      1, //矿坑
+      2, //加工厂
+      2, //冷饮摊
+      1, //贩卖机
+      1, //面包房
+      1, //早餐车
+      1, //饮茶店
+      1, //点心店
+      1, //美食店
+      1, //西餐厅
+      1, //花店
+      1, //美发店
+      1, //洋装店
+      1, //珠宝店
+      1, //电影院
+      1, //路灯
+      1, //绿化带
+      1, //花坛
+      1, //喷泉
+      1, //警察局
+      1, //游乐场
+      1, //蓝色城堡
+      1, //粉色城堡
+      1, //Holy Farmland
+      1, //Holy Farmland seed
+    ]
+
+    this.DiamondNumArray = AConfig.DiamondArray
+    //todo 钻石消耗默认值
+    this.DiamondNumArray.forEach((value, index, array) => {
+      array[index] = 0
+    })
+    cc.log('钻石消耗默认值', this.DiamondNumArray)
+    this.EveryDayRewardsArray = [0, 0, 0, 0, 0, 0, 0]
+
+    this.LastTimeEveryDayRewardsDate = '0000/00/00'
+    this.LastTimeLuckDate = '0000/00/00'
+
+    this.FoodTradeState = 1
+    this.WoodTradeState = 1
+    this.MineralTradeState = 1
+    //转盘分享给钻石金币
+    this.shareGive = [200, 5]
+    //签到分享给钻石金币
+    this.signInGive = [200, 5]
+    //每个月 给的 低保
+    this.EveryGive = [500, 10]
+    //公共分享
+    this.publicGive = [200, 50]
+    //每天抽奖次数
+    this.LotteryTimes = 10
+
+    // 1 === _BFirstLoadGame
+    if (_BFirstLoadGame) {
+      console.log('this.readData', this.readData)
+      // cc.log('初始化网络数据');
+      //读取日期数据
+      this.GameYear = this.readData.GameYear
+      this.GameMonth = this.readData.GameMonth
+      this.GameDay = this.readData.GameDay
+
+      /**
+       * 接口
+       * todo cnt和snb 由钱包读取
+       */
+      this.CNT = 0
+      this.SNB = 0
+
+      //读取金币
+      this.Golden = this.readData.Golden
+      //读取钻石
+      this.Diamond = this.readData.Diamond
+      // cc.log('this.readData.Diamond', this.readData.Diamond);
+      //读取工人等级
+      this.WorkerLV = this.readData.WorkerLV
+      //工人数量
+      this.WorkerNum = this.readData.WorkerNum
+      //工人容量
+      this.WorkerCapacity = this.readData.WorkerCapacity
+      this.GameDate = this.readData.GameDate
+      this.LastTimeEveryDayRewardsDate =
+        this.readData.LastTimeEveryDayRewardsDate
+      this.LastTimeLuckDate = this.readData.LastTimeLuckDate
+      this.EveryDayRewardsArray = this.readData.EveryDayRewardsArray //.split('_');
+      this.TerritoryStateArray = this.readData.TerritoryStateArray //.split('_');
+      //面板状态
+      this.BuildingStateArray = this.readData.BuildingStateArray //.split('_');
+
+      //解锁设置为 不用解锁
+      this.BuildingLockStateArray.forEach((value, index, array) => {
+        array[index] = 1
+      })
+      // this.BuildingLockStateArray = this.readData.BuildingLockStateArray.split('_');
+      this.BuildingNumArray = this.readData.BuildingNumArray //.split('_');
+      this.DiamondNumArray = this.readData.DiamondNumArray //.split('_');
+      this.FoodTradeState = this.readData.FoodTradeState
+      this.WoodTradeState = this.readData.WoodTradeState
+      this.MineralTradeState = this.readData.MineralTradeState
+
+      //工人工作信息
+      if (this.readData.characterInfoArray)
+        this.CharacterInfoArray = this.readData.characterInfoArray
+      //道路数据
+      if (this.readData.highwayIndex)
+        this.GameData_highwayIndex = this.readData.highwayIndex
+
+      //建筑物数据
+      if (this.readData.buildingsInfo)
+        this.GameData_buildings = this.readData.buildingsInfo
+
+      this.LotteryTimes = this.readData.LotteryTimes
+      //任务
+      if (this.readData.TaskIconCountClick)
+        task.TaskIconCountClick = this.readData.TaskIconCountClick
+      //测试5W
+      // this.PlusDiamond(50000);
+    }
 
-            if (callback) {
-                callback(data);
-            }
-        });
-    },
-    //站内收益
-    onCntCanWithdrawBalance(callback) {
-        if (!GlobalD.dapp) {
-            console.warn("GlobalD.dapp未初始化,不能onGetCNTRevenue!");
-            return;
+    //如果用户未租赁过土地且未用钻石兑换过种子,则显示
+    console.log('土地租赁情况' + GlobalD.UserLeaseLand)
+    if (GlobalD.UserLeaseLand == null) {
+      this.ManageUI.getComponent('ManageUI').DiamondGapViewShow()
+    }
+  },
+
+  //GET / SET /Plus
+  GetGameDate: function () {
+    return this.GameDate
+  },
+  SetGameDate: function (num) {
+    this.GameDate = num
+  },
+  PlusGameDate: function (num) {
+    this.GameDate += num
+  },
+  GetGolden: function () {
+    return parseInt(this.Golden)
+  },
+  GetGoldenCallBack(_CallBack) {
+    if (_CallBack) _CallBack({ resGolden: parseInt(this.Golden) })
+  },
+  SetGolden: function (Num) {
+    let LastMoney = this.Golden
+    this.Golden = Num
+    let CurrentMoney = Num
+    this.ManageUI.getComponent('ManageUI').GoldenChangeCallBack(
+      this.GetGolden(),
+      LastMoney,
+      CurrentMoney
+    )
+  },
+  PlusGolden: function (Num) {
+    if (this.Golden + Num < 0) {
+      this.SetGolden(0)
+    } else {
+      this.SetGolden(this.Golden + Num)
+    }
+    // task.task50W();
+  },
+  GetDiamond: function () {
+    return parseInt(this.Diamond)
+  },
+  SetDiamond: function (num) {
+    let LastMoney = this.Diamond
+    this.Diamond = num
+    let CurrentMoney = num
+    this.ManageUI.getComponent('ManageUI').DiamondChangeCallBack(
+      this.GetDiamond(),
+      LastMoney,
+      CurrentMoney
+    )
+  },
+  PlusDiamond: function (num) {
+    if (this.Diamond + num < 0) {
+      this.SetDiamond(0)
+    } else {
+      this.SetDiamond(this.Diamond + num)
+    }
+  },
+
+  /**
+   * 游戏里面的cnt 和神农呗
+   */
+  GetCNT: function () {
+    return parseFloat(this.CNT)
+  },
+  SetCNT: function (Num) {
+    this.CNT = Num
+    this.ManageUI.getComponent('ManageUI').CNTChangeCallBack(this.CNT)
+  },
+  GetSNB: function () {
+    return parseFloat(this.SNB)
+  },
+  SetSNB: function (Num) {
+    this.SNB = Num
+    this.ManageUI.getComponent('ManageUI').SNBChangeCallBack(this.SNB)
+  },
+
+  GetWorkerLV: function () {
+    return parseInt(this.WorkerLV)
+  },
+  SetWorkerLV: function (num) {
+    this.WorkerLV = num
+  },
+  PlusWorkerLV: function (num) {
+    this.WorkerLV += num
+  },
+  GetWorkerNum: function () {
+    return parseInt(this.WorkerNum)
+  },
+  SetWorkerNum: function (num) {
+    this.WorkerNum = num
+  },
+  PlusWorkerNum: function (num) {
+    this.WorkerNum += num
+  },
+  GetLastTimeEveryDayRewardsDate: function () {
+    return this.LastTimeEveryDayRewardsDate
+  },
+  //获取转盘 时间
+  GetLastTimeLuckDate: function () {
+    return this.LastTimeLuckDate
+  },
+  //设置转盘时间
+  SetLastTimeLuckDate: function (DateString) {
+    this.LastTimeLuckDate = DateString
+  },
+  SetLastTimeEveryDayRewardsDate: function (DateString) {
+    this.LastTimeEveryDayRewardsDate = DateString
+  },
+
+  //工人信息数组
+  GetWorkerCharacterInfoArray: function () {
+    return this.CharacterInfoArray
+  },
+  SetWorkerCharacterInfoArray: function (item) {
+    this.CharacterInfoArray = item
+  },
+
+  /*** */
+  GetWorkerCapacity: function () {
+    return parseInt(this.WorkerCapacity)
+  },
+  SetWorkerCapacity: function (num) {
+    this.WorkerCapacity = num
+  },
+  PlusWorkerCapacity: function (num) {
+    this.WorkerCapacity += num
+  },
+  GetTerritoryStateArray: function () {
+    return this.TerritoryStateArray
+  },
+  SetTerritoryStateArray: function (aTerritoryStateArray) {
+    this.TerritoryStateArray = aTerritoryStateArray
+  },
+  PlusTerritoryStateArray: function (Item) {
+    this.TerritoryStateArray.push(Item)
+  },
+  GetBuildingStateArray: function () {
+    return this.BuildingStateArray
+  },
+  SetBuildingStateArray: function (aBuildingStateArray) {
+    this.BuildingStateArray = aBuildingStateArray
+  },
+  PlusBuildingStateArray: function (Item) {
+    this.BuildingStateArray.push(Item)
+  },
+  GetBuildingLockStateArray: function () {
+    return this.BuildingLockStateArray
+  },
+  SetBuildingLockStateArray: function (aArray) {
+    this.BuildingLockStateArray = aArray
+  },
+  PlusBuildingLockStateArray: function (Item) {
+    this.BuildingLockStateArray.push(Item)
+  },
+
+  GetBuildingNumArray: function () {
+    return this.BuildingNumArray
+  },
+  SetBuildingNumArray: function (aBuildingNumArray) {
+    this.BuildingNumArray = aBuildingNumArray
+  },
+  PlusBuildingNumArray: function (Item) {
+    this.BuildingNumArray.push(Item)
+  },
+  //操作钻石数据
+  GetDiamondNumArray: function () {
+    return this.DiamondNumArray
+  },
+  SetDiamondNumArray: function (aDiamondNumArray) {
+    this.DiamondNumArray = aDiamondNumArray
+  },
+  GetEveryDayRewardsArray: function () {
+    return this.EveryDayRewardsArray
+  },
+  SetEveryDayRewardsArray: function (aArray) {
+    this.EveryDayRewardsArray = aArray
+  },
+  PlusEveryDayRewardsArray: function (Item) {
+    this.EveryDayRewardsArray.push(Item)
+  },
+  GetFoodTradeState: function () {
+    return parseInt(this.FoodTradeState)
+  },
+  SetFoodTradeState: function (num) {
+    this.FoodTradeState = num
+  },
+  PlusFoodTradeState: function (num) {
+    this.FoodTradeState += num
+  },
+  GetWoodTradeState: function () {
+    return parseInt(this.WoodTradeState)
+  },
+  SetWoodTradeState: function (num) {
+    this.WoodTradeState = num
+  },
+  PlusWoodTradeState: function (num) {
+    this.WoodTradeState += num
+  },
+  GetMineralTradeState: function () {
+    return parseInt(this.MineralTradeState)
+  },
+  SetMineralTradeState: function (num) {
+    this.MineralTradeState = num
+  },
+  PlusMineralTradeState: function (num) {
+    this.MineralTradeState += num
+  },
+  GetLotteryTimes: function () {
+    return parseInt(this.LotteryTimes)
+  },
+  SetLotteryTimes: function (num) {
+    this.LotteryTimes = num
+  },
+  PlusLotteryTimes: function (num) {
+    this.LotteryTimes += num
+  },
+
+  //初始化道路
+  onSpawnHighway() {
+    // 获取InitPoint层
+    let InitPos = this._tiledMap.getLayer('InitPoint')
+    InitPos.enabled = false
+
+    //创建公路数据
+    if (this.readData && this.readData.allHighwayStylesAndIndex) {
+      //保存到内存中
+      this.GameData_highwayIndex = this.readData.highwayIndex
+      //先赋值道路的对象数组
+      let _AllHighwayAIndex = Object.assign(
+        [],
+        this.readData.allHighwayStylesAndIndex
+      )
+      //获取最后建造公路的层级
+      this.HighwayLayer = this._tiledMap.getLayer('Highway')
+      for (let i = 0; i < _AllHighwayAIndex.length; i++) {
+        let _tiledPos = GlobalD.TiledMap.analyticalIndexData(
+          _AllHighwayAIndex[i].highwayInfoIndex
+        )
+        /**
+         * 解决固定土地时候,道路 和房子 冲突
+         *
+         */
+        if (
+          GlobalD.game.getManageGameIndexArrayAt(
+            cc.v2(_tiledPos.x, _tiledPos.y)
+          )
+        ) {
+          continue
         }
-        GlobalD.dapp.cntCanWithdrawBalance().then((data) => {
-            const { err, res } = data;
-            if (err === null) {
-                console.log(res) //Number 返回数字
-                GlobalD.GameData.CNTDrawBalance = res;
+        let highwayTemp = cc.instantiate(this.HighWayPrefabs)
+        highwayTemp.parent = this.HighwayLayer.node
+        let tiledTile = highwayTemp.addComponent('TiledTile')
+        tiledTile.x = _tiledPos.x
+        tiledTile.y = _tiledPos.y
+        //地图设置可行走区域公路设置
+        AStar.setMapSolid(_tiledPos.x, _tiledPos.y, 0)
+        // _buildId ==0 是公路
+        let _buildId = 0
+        let occupyTemp = cc.v2(_buildId, _AllHighwayAIndex[i].highwayInfoIndex)
+        GlobalD.game.OccupyArray.push(occupyTemp)
+        highwayTemp
+          .getComponent('HighwayInfo')
+          .onChangeHighwayStyles(_AllHighwayAIndex[i].highwayInfoType)
+
+        GlobalD.game.AllHighwayStylesAndIndex.push(_AllHighwayAIndex[i])
+      }
+      // console.log("end");
+    } else {
+      //如果用户没有存储数据
+      //根据InitPoint 的数据,创建初始化的地图数据 的初始化数据
+
+      this.HighwayLayer = this._tiledMap.getLayer('Highway')
+      for (var i = 0; i < 32; i++) {
+        //去除中间两条路
+        if (i == 16 || i == 17) continue
+        for (var j = 0; j < 32; j++) {
+          let tilesPos = cc.v2(i, j)
+
+          if (InitPos.getTileGIDAt(tilesPos)) {
+            let index = GlobalD.TiledMap.getIndex(tilesPos)
+            this.GameData_highwayIndex.push(index)
+
+            let highwayTemp = cc.instantiate(this.HighWayPrefabs)
+            highwayTemp.parent = this.HighwayLayer.node
+            let tiledTile = highwayTemp.addComponent('TiledTile')
+            tiledTile.x = tilesPos.x
+            tiledTile.y = tilesPos.y
+            // cc.log('onSpawnHighway2');
+            //地图设置可行走区域公路设置
+            AStar.setMapSolid(tilesPos.x, tilesPos.y, 0)
+            // _buildId ==0 是公路
+            let _buildId = 0
+            let occupyTemp = cc.v2(_buildId, index)
+            GlobalD.game.OccupyArray.push(occupyTemp)
+
+            let tile = InitPos.getTiledTileAt(tilesPos.x, tilesPos.y, true)
+
+            let _MoveType = reGameStates.HighwayType.moveX
+            // if (tile.gid == 15) {
+            //     _MoveType = reGameStates.HighwayType.moveX;
+            // } else
+            if (tile.gid == 16) {
+              _MoveType = reGameStates.HighwayType.moveY
+            } else if (tile.gid == 11) {
+              _MoveType = reGameStates.HighwayType.ZebraCrossingX
+            } else if (tile.gid == 12) {
+              _MoveType = reGameStates.HighwayType.ZebraCrossingY
             }
-            //todo ,记录一个信息
-            if (callback) {
-                callback(data);
-            }
-        });
-    },
-    //站内收益提现
-    onCntWithdraw(amount, callback) {
-        if (!GlobalD.dapp) {
-            console.warn("GlobalD.dapp未初始化,不能onCntWithdraw!");
-            return;
+            // return;
+            //更换公路样式
+            GlobalD.game.onCreateDifferentRoadStyles({
+              _buildId: _buildId,
+              _highwayType: _MoveType,
+              _roadIndex: index,
+              _hightwayNode: highwayTemp,
+            })
+          }
         }
-        GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), "收益正在提现中", 10, () => {
-            console.log("finish toast!");
-        });
-        GlobalD.dapp.cntWithdraw(amount).then((data) => {
-            const [err, tx] = data;
-            console.log("onCntWithdraw:", data);
-            if (err === null) {
-                console.log(tx) //String|null 交易唯一哈市
-                GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), "提现成功!", 1, () => {
-                    console.log("finish toast!");
-                });
-            } else {
-                GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), err, 1, () => {
-                    console.log("finish toast!");
-                });
-            }
-            if (callback) {
-                callback(data);
-            }
-        });
-    },
-
-    //获取账户站内CNT明细(村长和镇长才有)
-    onCntLog(page, limit, callback) {
-        if (!GlobalD.dapp) {
-            console.warn("GlobalD.dapp未初始化,不能onGetSnbToCntInfo!");
-            return;
+      }
+    }
+    //外面的两条路
+    let initRoad = this._tiledMap.getLayer('Road')
+    initRoad.enabled = false
+    for (var i = 16; i < 18; i++) {
+      for (var j = 0; j < 32; j++) {
+        let tilesPos = cc.v2(i, j)
+        // cc.log('road tilesPos',tilesPos)
+        if (initRoad.getTileGIDAt(tilesPos)) {
+          let index = GlobalD.TiledMap.getIndex(tilesPos)
+          this.GameData_highwayIndex.push(index)
+          let highwayTemp = cc.instantiate(this.HighWayPrefabs)
+          highwayTemp.parent = this.HighwayLayer.node
+          let tiledTile = highwayTemp.addComponent('TiledTile')
+          tiledTile.x = tilesPos.x
+          tiledTile.y = tilesPos.y
+          // cc.log('initRoad');
+          //地图设置可行走区域公路设置
+          AStar.setMapSolid(tilesPos.x, tilesPos.y, 0)
+          let _buildId = 0
+          let occupyTemp = cc.v2(_buildId, index)
+          GlobalD.game.OccupyArray.push(occupyTemp)
+          //更换公路样式
+          // if (j >= 25 && j <= 27 || j >= 19 && j <= 21 || j >= 9 && j <= 11)
+          //     highwayTemp.getComponent('HighwayInfo').onChangeHighwayStyles(reGameStates.HighwayType.none);
+          // else
+          //     highwayTemp.getComponent('HighwayInfo').onChangeHighwayStyles(reGameStates.HighwayType.moveY);
         }
-        GlobalD.dapp.cntLog(page, limit).then((data) => {
-            const { err, res } = data;
-            // if (err === null) {
-            //     console.log(res) //
-            // }
-            if (callback) {
-                callback(data);
-            }
-        });
-    },
+      }
+    }
+  },
+
+  //清除所有的数据
+  onClearAllData() {
+    this.unschedule(this.AutoSaveData)
+    //任务索引
+    cc.sys.localStorage.removeItem('userdata')
+    //跳回登录场景
+    // cc.director.loadScene('Login');
+  },
+  //保存数据请求
+  /**
+   *
+   * 现在转服务器存储,原本所有相关操作通过服务器计算。
+   * 一、目前涉及到的是 SNT 和 SNB 两个货币相关,和买田地操作 (可以理解为租聘,三种类型)
+   *
+   * isNetwork:true,上传到网络
+   *
+   */
+  pushData: function (isNetwork) {
+    // cc.log(this.EveryDayRewardsArray);
+    // console.log(this.readData.BFirstLoadGame);
+    var datas = {
+      version: this.GameVersion,
+      // 转后台处理
+      BFirstLoadGame: 1, //只要push数据,就证明已经开始第一次游戏了
+
+      /**游戏不修改,默认值 start */
+      shareGive: this.shareGive,
+      //签到分享给钻石金币
+      signInGive: this.signInGive,
+      //每个月 给的 低保
+      EveryGive: this.EveryGive,
+      //公共分享
+      publicGive: this.publicGive,
+      /**游戏不修改,默认值 end */
+
+      //时间
+      GameYear: this.GameYear,
+      GameMonth: this.GameMonth,
+      GameDay: this.GameDay,
+
+      //这里只是单纯的存储起来
+      CNT: this.CNT,
+      SNB: this.SNB,
+
+      Golden: this.Golden,
+      Diamond: this.Diamond,
+      WorkerLV: this.WorkerLV,
+      WorkerNum: this.WorkerNum,
+      WorkerCapacity: this.WorkerCapacity,
+      GameDate: this.GameDate,
+      LastTimeEveryDayRewardsDate: this.LastTimeEveryDayRewardsDate,
+      LastTimeLuckDate: this.LastTimeLuckDate,
+      EveryDayRewardsArray: this.EveryDayRewardsArray, //.join('_'),
+      TerritoryStateArray: this.TerritoryStateArray, //.join('_'),
+      //面板状态
+      BuildingStateArray: this.BuildingStateArray, //.join('_'),
+      BuildingLockStateArray: this.BuildingLockStateArray, //.join('_'),
+
+      /**
+       * SNB和CNT相关,需要后台筛选 田地 和 种子。单独处理
+       */
+      BuildingNumArray: this.BuildingNumArray, //.join('_'),
+      DiamondNumArray: this.DiamondNumArray, //.join('_'),
+      FoodTradeState: this.FoodTradeState,
+      WoodTradeState: this.WoodTradeState,
+      MineralTradeState: this.MineralTradeState,
+
+      LotteryTimes: this.LotteryTimes,
+
+      /**
+       * 这些数据不用服务器初始化
+       */
+      //工人工作信息
+      characterInfoArray: this.CharacterInfoArray,
+      //道路数据
+      highwayIndex: this.GameData_highwayIndex,
+      allHighwayStylesAndIndex: GlobalD.game.AllHighwayStylesAndIndex,
+      //建筑物数据
+      buildingsInfo: this.GameData_buildings,
+      //任务
+      TaskIconCountClick: task.TaskIconCountClick,
+    }
 
-    //获取 神农呗转 CNT 日志
-    onGetSnbToCntInfo(page, limit, callback) {
-        if (!GlobalD.dapp) {
-            console.warn("GlobalD.dapp未初始化,不能onGetSnbToCntInfo!");
-            return;
+    if (isNetwork) {
+      var data = []
+      // data["openid"] = userData.openId;
+      // data["userdata"] = JSON.stringify(datas);
+      data['playerData'] = JSON.stringify(datas)
+
+      /** 推送信息 */
+      utils.post(utils.api.playerPushInfo, data, (res, playerPushInfoTemp) => {
+        // console.log('playerPushInfoTemp', playerPushInfoTemp);
+      })
+    } else {
+      console.log('存储本地:' + isNetwork)
+      //保存用户数据到本地
+      cc.sys.localStorage.setItem('userdata', JSON.stringify(datas))
+    }
+  },
+
+  /**
+   * 暂时不需要从这里读取
+   */
+  getLandConfig() {
+    utils.get(utils.api.landConfig, {}, (res, value) => {
+      if (0 === value.code) {
+        this.ConfigLand = value.data
+      } else {
+        console.warn('未能读取到config土地?')
+      }
+    })
+  },
+  //获取用户全部租赁土地
+  getUserLandList() {
+    utils.get(utils.api.userLandList, {}, (res, vaule) => {})
+  },
+  //获取用户已租赁土地的状态
+  getLandState(context) {
+    let { landId, callback } = context
+    utils.get(utils.api.landState, { landId: landId }, (res, vaule) => {
+      callback(res, vaule)
+    })
+  },
+  //获取商城种子
+  getMallSeed(callback) {
+    utils.get(utils.api.mallSeed, {}, (res, vaule) => {
+      callback(res, vaule)
+    })
+  },
+
+  getWarehouseSeedAndFruit(callback) {
+    utils.get(utils.api.getSeedAndFruit, {}, (res, vaule) => {
+      callback(res, vaule)
+    })
+  },
+  //获取种子状态
+  onGetSeedState(data, callback) {
+    utils.get(utils.api.getSeedState, data, (res, vaule) => {
+      callback(res, vaule)
+    })
+  },
+
+  //种植种子
+  // data:{landId:1,seedId:1}
+  onPlant(data, callback) {
+    utils.get(utils.api.plant, data, (res, vaule) => {
+      callback(res, vaule)
+    })
+  },
+
+  //收取果实
+  onAddFruit(data, callback) {
+    if (this.isOnAddFruit) {
+      console.log('收取果实过快!')
+      return
+    }
+    this.isOnAddFruit = true
+    utils.post(utils.api.addFruit, data, (res, vaule) => {
+      this.isOnAddFruit = false
+      callback(res, vaule)
+    })
+  },
+
+  //出售果实
+  onSaleFruit(data, callback) {
+    if (this.isOnSaleFruit) {
+      console.log('出售果实过快!')
+      return
+    }
+    this.isOnSaleFruit = true
+    utils.post(utils.api.saleFruit, data, (res, vaule) => {
+      this.isOnSaleFruit = false
+      callback(res, vaule)
+    })
+  },
+
+  //赠送果实
+  onGrantFruit(data, callback) {
+    if (this.isOnGrantFruit) {
+      console.log('赠送果实过快!')
+      return
+    }
+    this.isOnGrantFruit = true
+    utils.post(utils.api.grantFruit, data, (res, vaule) => {
+      this.isOnGrantFruit = false
+      callback(res, vaule)
+    })
+  },
+
+  //神农呗购买种子
+  onBuySeedsWithSNB(snbAmount, seedId, callback) {
+    utils.post(
+      utils.api.snbBuySeeds,
+      { payAmount: snbAmount, seedId: seedId },
+      (res, vaule) => {
+        callback(res, vaule)
+      }
+    )
+  },
+
+  //获取用户的snb
+  onGetUserSnb(callback) {
+    utils.get(utils.api.userSnbInfo, {}, (res, value) => {
+      GlobalD.GameData.SetSNB(value.data.SNB)
+      if (callback) callback(res, value)
+    })
+  },
+
+  /**
+   * 支付cnt操作
+   * @param {*} amount // 需支付金额
+   * @param {*} payType 支付类型,1购买土地租凭, 2自然灾害防护,3野兽防护
+   * @param {*} itemType 操作物品的id 字符串
+   */
+  payCNT(cntAmount, payType, itemType, callback) {
+    console.log(
+      '购买金额:' +
+        cntAmount +
+        '购买类型PlayType:' +
+        payType +
+        '购买物品的id:' +
+        itemType
+    )
+    if (!GlobalD.dapp) {
+      console.warn('GlobalD.dapp未初始化,不能payCNT!')
+      return
+    }
+    //
+    if (this.isPlayingCnt) {
+      console.warn('同时触发支付CNT过快!')
+      return
+    }
+    if (GlobalD.GameData.GetCNT() < cntAmount) {
+      console.log(
+        'cnt 不足,GetCNT:' +
+          GlobalD.GameData.GetCNT() +
+          '消费的cntAmount' +
+          cntAmount
+      )
+      GlobalD.GameData.showToast(
+        cc.find('Canvas/UICamera'),
+        'CNT不足!',
+        2,
+        () => {
+          console.log('finish toast! CNT不足!')
         }
-        GlobalD.dapp.swapLog(page, limit).then((data) => {
-            const { err, res } = data;
-            if (err === null) {
-                console.log(res) //
-            }
-            if (callback) {
-                callback(data);
-            }
-        });
-    },
-
-    //获取 snb 流水日志
-    onGetSnbInfoList(page, limit, callback) {
-
-        utils.get(utils.api.snbList, { page: page, limit: limit }, (res, value) => {
-            // console.log("snb操作日志", value);
-            if (0 === value.code) {
-                if (callback)
-                    callback(value.data);
-            } else {
-                let mySnbList = [];
-                if (callback)
-                    callback(mySnbList);
-            }
-
+      )
+      return
+    }
+    this.isPlayingCnt = true
+    GlobalD.GameData.showToast(
+      cc.find('Canvas/UICamera'),
+      '支付处理中...',
+      5,
+      () => {
+        console.log('finish toast!支付处理中...')
+      }
+    )
+
+    GlobalD.dapp.payCnt(cntAmount, payType, itemType).then((data) => {
+      const [err, tx] = data
+      this.isPlayingCnt = false
+      if (err === null) {
+        // TODO 成功, 支付为链上操作,需要提供回调接口给这边服务端确认交易成功后修改购买订单结果
+        console.log(tx) // 交易hash,唯一标识符
+
+        GlobalD.dapp.cntBalance().then((cntBalance) => {
+          //会延迟返回
+          // console.log("更新cnt:" + cntBalance) // string, 精度18,需要自行处理省略几位小数
+          GlobalD.GameData.SetCNT(cntBalance)
         })
-    },
-
-
-
-    updateToast() {
-        if (this.toastEndTime <= 0) {
-            this.toast.active = false
-            if (this.isStart) {
-                if (this.toastCallback != null && this.toastCallback != undefined) {
-                    this.toastCallback();
-                    // console.log(this.toastCallback);
-                }
-                this.isStart = false;
-            }
-            // console.log("this.toast.active:" + this.toast.active);
+        GlobalD.GameData.showToast(
+          cc.find('Canvas/UICamera'),
+          '支付成功!',
+          5,
+          () => {
+            GlobalD.GameData.showToast(
+              cc.find('Canvas/UICamera'),
+              '区块确认中,请耐心等待!',
+              120
+            )
+          }
+        )
+      } else {
+        console.log(err)
+        GlobalD.GameData.showToast(cc.find('Canvas/UICamera'), err, 2, () => {
+          console.log('finish toast!')
+        })
+      }
+
+      if (callback) {
+        callback(data)
+      }
+    })
+  },
+
+  /**
+   * 神农呗转换CNT ,比例是5:1
+   * @param {*} snbAmount
+   * @param {*} callback
+   * @returns
+   */
+  onSnbToCnt(snbAmount, callback) {
+    if (!GlobalD.dapp) {
+      console.warn('GlobalD.dapp未初始化,不能onSnbToCnt!')
+      return
+    }
+    // GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), "暂不支持兑换CNT!", 2, () => {
+    //     console.log("finish toast!");
+    // });
+    // return;
+    if (this.isPlayingSnb) {
+      console.warn('同时触发支付SNB过快!')
+      return
+    }
+    if (GlobalD.GameData.GetSNB() <= 0) {
+      console.log(
+        '神农呗数量GetSNB:',
+        GlobalD.GameData.GetSNB(),
+        '替换snbAmount:',
+        snbAmount
+      )
+      GlobalD.GameData.showToast(
+        cc.find('Canvas/UICamera'),
+        '神农呗数量不足!',
+        2,
+        () => {
+          console.log('finish toast!')
         }
-        this.toastEndTime--;
-    },
+      )
+      return
+    }
 
-    showToast(parent, content, time, callback) {
-        if (callback) {
-            this.toastCallback = callback;
-        } else {
-            this.toastCallback = null;
-        }
+    GlobalD.GameData.showToast(
+      cc.find('Canvas/UICamera'),
+      '已发起兑换!',
+      5,
+      () => {
+        console.log('finish toast!')
+      }
+    )
+    this.isPlayingSnb = true
+    GlobalD.dapp.snbToCnt(snbAmount).then((data) => {
+      //更新日志数据
+      cc.find('GameNode/ManageDapp')
+        .getComponent('ManageDapp')
+        .onUpdateSnbList()
+      const [err, tx] = data
+      this.isPlayingSnb = false
+      if (err === null) {
+        // TODO 成功, 兑换为链上操作,需要提供回调接口给这边服务端确认交易成功后修改扣除SNB数量
+        console.log(tx) // 交易hash,唯一标识符
+        //扣除对应的神农呗,本地修改显示
+        GlobalD.GameData.SetSNB(GlobalD.GameData.GetSNB() - snbAmount)
+
+        GlobalD.dapp.cntBalance().then((cntBalance) => {
+          //会延迟返回
+          // console.log("更新cnt:" + cntBalance) // string, 精度18,需要自行处理省略几位小数
+          GlobalD.GameData.SetCNT(cntBalance)
+        })
 
-        this.isStart = true;
-        if (this.toast) {
-            // console.log(this.toast.active);
-            this.toast.active = true;
-            this.toast.parent = parent;
-            this.toast.zIndex = 999;
-            let DetailLabel = this.toast.getChildByName('DetailLabel');
-            DetailLabel.getComponent(cc.Label).string = content;
-            this.toastEndTime = time;
+        GlobalD.GameData.showToast(
+          cc.find('Canvas/UICamera'),
+          '区块确认中,请耐心等待!',
+          5,
+          () => {
+            console.log('finish toast!')
+          }
+        )
+      } else {
+        console.log(err)
+        GlobalD.GameData.showToast(cc.find('Canvas/UICamera'), err, 2, () => {
+          console.log('finish toast!')
+        })
+      }
+
+      if (callback) {
+        callback(data)
+      }
+    })
+  },
+  //站内收益
+  onCntCanWithdrawBalance(callback) {
+    if (!GlobalD.dapp) {
+      console.warn('GlobalD.dapp未初始化,不能onGetCNTRevenue!')
+      return
+    }
+    GlobalD.dapp.cntCanWithdrawBalance().then((data) => {
+      const { err, res } = data
+      if (err === null) {
+        console.log(res) //Number 返回数字
+        GlobalD.GameData.CNTDrawBalance = res
+      }
+      //todo ,记录一个信息
+      if (callback) {
+        callback(data)
+      }
+    })
+  },
+  //站内收益提现
+  onCntWithdraw(amount, callback) {
+    if (!GlobalD.dapp) {
+      console.warn('GlobalD.dapp未初始化,不能onCntWithdraw!')
+      return
+    }
+    GlobalD.GameData.showToast(
+      cc.find('Canvas/UICamera'),
+      '收益正在提现中',
+      10,
+      () => {
+        console.log('finish toast!')
+      }
+    )
+    GlobalD.dapp.cntWithdraw(amount).then((data) => {
+      const [err, tx] = data
+      console.log('onCntWithdraw:', data)
+      if (err === null) {
+        console.log(tx) //String|null 交易唯一哈市
+        GlobalD.GameData.showToast(
+          cc.find('Canvas/UICamera'),
+          '提现成功!',
+          1,
+          () => {
+            console.log('finish toast!')
+          }
+        )
+      } else {
+        GlobalD.GameData.showToast(cc.find('Canvas/UICamera'), err, 1, () => {
+          console.log('finish toast!')
+        })
+      }
+      if (callback) {
+        callback(data)
+      }
+    })
+  },
+
+  //获取账户站内CNT明细(村长和镇长才有)
+  onCntLog(page, limit, callback) {
+    if (!GlobalD.dapp) {
+      console.warn('GlobalD.dapp未初始化,不能onGetSnbToCntInfo!')
+      return
+    }
+    GlobalD.dapp.cntLog(page, limit).then((data) => {
+      const { err, res } = data
+      // if (err === null) {
+      //     console.log(res) //
+      // }
+      if (callback) {
+        callback(data)
+      }
+    })
+  },
+
+  //获取 神农呗转 CNT 日志
+  onGetSnbToCntInfo(page, limit, callback) {
+    if (!GlobalD.dapp) {
+      console.warn('GlobalD.dapp未初始化,不能onGetSnbToCntInfo!')
+      return
+    }
+    GlobalD.dapp.swapLog(page, limit).then((data) => {
+      const { err, res } = data
+      if (err === null) {
+        console.log(res) //
+      }
+      if (callback) {
+        callback(data)
+      }
+    })
+  },
+
+  //获取 snb 流水日志
+  onGetSnbInfoList(page, limit, callback) {
+    utils.get(utils.api.snbList, { page: page, limit: limit }, (res, value) => {
+      // console.log("snb操作日志", value);
+      if (0 === value.code) {
+        if (callback) callback(value.data)
+      } else {
+        let mySnbList = []
+        if (callback) callback(mySnbList)
+      }
+    })
+  },
+
+  updateToast() {
+    if (this.toastEndTime <= 0) {
+      this.toast.active = false
+      if (this.isStart) {
+        if (this.toastCallback != null && this.toastCallback != undefined) {
+          this.toastCallback()
+          // console.log(this.toastCallback);
         }
-    },
-
-    onTestToken(){
-        utils.onTestToken();
+        this.isStart = false
+      }
+      // console.log("this.toast.active:" + this.toast.active);
+    }
+    this.toastEndTime--
+  },
+
+  showToast(parent, content, time, callback) {
+    if (callback) {
+      this.toastCallback = callback
+    } else {
+      this.toastCallback = null
     }
 
+    this.isStart = true
+    if (this.toast) {
+      // console.log(this.toast.active);
+      this.toast.active = true
+      this.toast.parent = parent
+      this.toast.zIndex = 999
+      let DetailLabel = this.toast.getChildByName('DetailLabel')
+      DetailLabel.getComponent(cc.Label).string = content
+      this.toastEndTime = time
+    }
+  },
 
-});
+  onTestToken() {
+    utils.onTestToken()
+  },
+})

+ 43 - 36
assets/Script/public/ManageGolden.js

@@ -1,42 +1,49 @@
-
 cc.Class({
-    extends: cc.Component,
+  extends: cc.Component,
 
-    properties: {
-       GoldenLabel: cc.Node,
-        Diamondlabel: {
-            default: null,
-            type: cc.Node,
-        },
-        ManageUI: cc.Node,
+  properties: {
+    GoldenLabel: cc.Node,
+    Diamondlabel: {
+      default: null,
+      type: cc.Node,
+    },
+    ManageUI: cc.Node,
 
-        //5个神农呗兑1个cnt
-        CNTNode: {
-            default: null,
-            type: cc.Node,
-        },
-        SNBNode: {
-            default: null,
-            type: cc.Node,
-        },
+    //5个神农呗兑1个cnt
+    CNTNode: {
+      default: null,
+      type: cc.Node,
     },
-    InitManageGlodenUI(){
-        this.GoldenLabel.getComponent(cc.Label).string = this.FormatMoney(GlobalD.GameData.GetGolden().toString());
-        this.Diamondlabel.getComponent(cc.Label).string = this.FormatMoney(GlobalD.GameData.GetDiamond().toString());
-   
-        this.CNTNode.getComponent(cc.Label).string = this.FormatMoney(GlobalD.GameData.GetCNT().toString());
-        this.SNBNode.getComponent(cc.Label).string = this.FormatMoney(GlobalD.GameData.GetSNB().toString());
-   
+    SNBNode: {
+      default: null,
+      type: cc.Node,
     },
-    FormatMoney(s, n) {
-        n = n > 0 && n <= 20 ? n : 2;
-        s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + "";
-        var l = s.split(".")[0].split("").reverse(),
-            r = s.split(".")[1];
-        let t = "";
-        for (let i = 0; i < l.length; i++) {
-            t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "");
-        }
-        return t.split("").reverse().join(""); //+ "." + r;
+  },
+  InitManageGlodenUI() {
+    this.GoldenLabel.getComponent(cc.Label).string = this.FormatMoney(
+      GlobalD.GameData.GetGolden().toString()
+    )
+    this.DiamondNowlabel.string = result + '/30000'
+    this.Diamondlabel.getComponent(cc.Label).string = this.FormatMoney(
+      GlobalD.GameData.GetDiamond().toString()
+    )
+
+    this.CNTNode.getComponent(cc.Label).string = this.FormatMoney(
+      GlobalD.GameData.GetCNT().toString()
+    )
+    this.SNBNode.getComponent(cc.Label).string = this.FormatMoney(
+      GlobalD.GameData.GetSNB().toString()
+    )
+  },
+  FormatMoney(s, n) {
+    n = n > 0 && n <= 20 ? n : 2
+    s = parseFloat((s + '').replace(/[^\d\.-]/g, '')).toFixed(n) + ''
+    var l = s.split('.')[0].split('').reverse(),
+      r = s.split('.')[1]
+    let t = ''
+    for (let i = 0; i < l.length; i++) {
+      t += l[i] + ((i + 1) % 3 == 0 && i + 1 != l.length ? ',' : '')
     }
-});
+    return t.split('').reverse().join('') //+ "." + r;
+  },
+})

+ 1095 - 929
assets/Script/public/ManageUI.js

@@ -1,969 +1,1135 @@
 // const constants = require('Constants');
 // var reGameStates = require('GameStates');
-var AConfig = require('../Config');
+var AConfig = require('../Config')
 cc.Class({
-    extends: cc.Component,
-
-    properties: {
-        //左上角按钮列表
-        LeftMenu: cc.Node,
-        //编辑建筑物时候的ui显示
-        EditorialBuildings: cc.Node,
-        //记录编辑按钮的父对象
-        _thisEditBuildingsParent: cc.Node,
-        _Cancellation: cc.Button,
-        _Comfirmation: cc.Button,
-        _buildTarget: cc.Node,
-        //显示建筑的详细信息
-        //建筑面板
-        BuildingInfoView: cc.Node,
-        //ui Mask 对应的touch
-        UITouch: {
-            default: null,
-            type: cc.Node,
-        },
-        //设置面板
-        SettingInfoView: cc.Node,
-        //建筑面板
-        //建筑物列表.后面根据数据动态添加content的内容。
-        //todo..
-        BuildView: cc.Node,
-        StoreView: cc.Node,
-        BuildContent_Button: { default: null, type: cc.Button, visible: false },
-        BuildContent_OldButton: { default: null, type: cc.Button, visible: false },
-        BuildContent_Normal_Sprite: cc.SpriteFrame,
-        BuildContent_Pressed_Sprite: cc.SpriteFrame,
-        ButtonSelectedFrame: cc.Node,
-        //建筑版面的介绍模板
-        BuildContent_Name: cc.Label,
-        BuildContent_Price: cc.Label,
-        BuildContent_Synopsis: cc.Label,
-        //人才面板
-        PersonnelView: cc.Node,
-        //股票面板
-        StockView: cc.Node,
-        //幸运转盘
-        LuckView: cc.Node,
-        // 底部的菜单栏
-        BottomView: cc.Node,
-        Evn: cc.Node,
-        Seed: cc.Node,
-        EveryDaySignView: cc.Node,
-
-        //提示面板
-        TipView: cc.Node,
-        //提示面板预制
-        TipViewPrefab: cc.Prefab,
-        ShowRewards: cc.Node,
-        BuildingFrameArray: {
-            default: [],
-            type: [cc.Node],
-            serializable: true,
-        },
-        Goldenlabel: cc.Node,
-        Diamondlabel: cc.Node,
-        CNTlabel: cc.Node,
-        SNBlabel: cc.Node,
-
-        //显示的库存总量,人才界面
-        cropContent: cc.Label,
-        woodContent: cc.Label,
-        mineContent: cc.Label,
-
-        inviteNode: cc.Node,
-
-
-        //商店面的介绍模板
-        mallContent_Name: cc.Label,
-        mallContent_Price: cc.Label,
-        mallContent_Mature: cc.Label,
-        mallContent_Synopsis: cc.Label,
+  extends: cc.Component,
+
+  properties: {
+    //左上角按钮列表
+    LeftMenu: cc.Node,
+    //编辑建筑物时候的ui显示
+    EditorialBuildings: cc.Node,
+    //记录编辑按钮的父对象
+    _thisEditBuildingsParent: cc.Node,
+    _Cancellation: cc.Button,
+    _Comfirmation: cc.Button,
+    _buildTarget: cc.Node,
+    //显示建筑的详细信息
+    //建筑面板
+    BuildingInfoView: cc.Node,
+    //ui Mask 对应的touch
+    UITouch: {
+      default: null,
+      type: cc.Node,
     },
-    onLoad() {
-        cc.game.setFrameRate(30);
-        cc.director.preloadScene('Login', function () {
-        }.bind(this));
-        if (this.EditorialBuildings) {
-            this._thisEditBuildingsParent = this.EditorialBuildings.parent;
-            this._Cancellation = this.EditorialBuildings.getChildByName('Cancellation').getComponent(cc.Button);
-            this._Comfirmation = this.EditorialBuildings.getChildByName('Confirmation').getComponent(cc.Button);
-        }
-        task.managerUi = this;
-        var data1 = {
-            name: "Whoareyou",
-            openId: userData.openId,
-
-        }
-        UtilsWX.postMessage(data1);
-        UtilsWX.shareMenu();
-        UtilsWX.initWXSubContextView(cc.find("Canvas/UICamera/wx"));
-        UtilsWX.openWXSubContextView(false);
+    //设置面板
+    SettingInfoView: cc.Node,
+    //建筑面板
+    //建筑物列表.后面根据数据动态添加content的内容。
+    //todo..
+    BuildView: cc.Node,
+    StoreView: cc.Node,
+    BuildContent_Button: { default: null, type: cc.Button, visible: false },
+    BuildContent_OldButton: { default: null, type: cc.Button, visible: false },
+    BuildContent_Normal_Sprite: cc.SpriteFrame,
+    BuildContent_Pressed_Sprite: cc.SpriteFrame,
+    ButtonSelectedFrame: cc.Node,
+    //建筑版面的介绍模板
+    BuildContent_Name: cc.Label,
+    BuildContent_Price: cc.Label,
+    BuildContent_Synopsis: cc.Label,
+    //人才面板
+    PersonnelView: cc.Node,
+    //股票面板
+    StockView: cc.Node,
+    //幸运转盘
+    LuckView: cc.Node,
+    // 底部的菜单栏
+    BottomView: cc.Node,
+    Evn: cc.Node,
+    Seed: cc.Node,
+    EveryDaySignView: cc.Node,
+
+    //提示面板
+    TipView: cc.Node,
+    //提示面板预制
+    TipViewPrefab: cc.Prefab,
+    ShowRewards: cc.Node,
+    BuildingFrameArray: {
+      default: [],
+      type: [cc.Node],
+      serializable: true,
     },
+    Goldenlabel: cc.Node,
+    Diamondlabel: cc.Node,
+    CNTlabel: cc.Node,
+    SNBlabel: cc.Node,
+
+    //显示的库存总量,人才界面
+    cropContent: cc.Label,
+    woodContent: cc.Label,
+    mineContent: cc.Label,
+
+    //钻石兑换金币
+    DiamondGapView: cc.Node,
+    DiamondNowlabel: cc.Label,
+    ExchangeBtn: cc.Button,
+    //钻石足够获得种子
+    DiamondSeedsView: cc.Node,
+    DiamondSeeds_SureBtn: cc.Button,
+
+    inviteNode: cc.Node,
+
+    //商店面的介绍模板
+    mallContent_Name: cc.Label,
+    mallContent_Price: cc.Label,
+    mallContent_Mature: cc.Label,
+    mallContent_Synopsis: cc.Label,
+  },
+  onLoad() {
+    cc.game.setFrameRate(30)
+    cc.director.preloadScene('Login', function () {}.bind(this))
+    if (this.EditorialBuildings) {
+      this._thisEditBuildingsParent = this.EditorialBuildings.parent
+      this._Cancellation = this.EditorialBuildings.getChildByName(
+        'Cancellation'
+      ).getComponent(cc.Button)
+      this._Comfirmation = this.EditorialBuildings.getChildByName(
+        'Confirmation'
+      ).getComponent(cc.Button)
+    }
+    task.managerUi = this
+    var data1 = {
+      name: 'Whoareyou',
+      openId: userData.openId,
+    }
+    UtilsWX.postMessage(data1)
+    UtilsWX.shareMenu()
+    UtilsWX.initWXSubContextView(cc.find('Canvas/UICamera/wx'))
+    UtilsWX.openWXSubContextView(false)
+  },
+
+  isGame: function () {
+    this.times = 0
+    cc.game.on(
+      cc.game.EVENT_HIDE,
+      function () {
+        console.log('游戏进入后台', this.getTime())
+        if (UtilsWX.shareTag == 0) {
+          // this.onHideGame();//处理游戏切到后台时的事件
+          this.times = this.getTime()
+          task.onLoad()
+          // this.onShowGame();//处理游戏切回前台时的事件
+          cc.director.loadScene(
+            'Login',
+            function () {
+              task.showPointerNode = null
+            }.bind(this)
+          )
+        }
+      },
+      this
+    )
 
-    isGame: function () {
-        this.times = 0;
-        cc.game.on(cc.game.EVENT_HIDE, function () {
-            console.log("游戏进入后台", this.getTime());
-            if (UtilsWX.shareTag == 0) {
-
-                // this.onHideGame();//处理游戏切到后台时的事件
-                this.times = this.getTime();
-                task.onLoad();
-                // this.onShowGame();//处理游戏切回前台时的事件
-                cc.director.loadScene('Login', function () {
-                    task.showPointerNode = null;
-                }.bind(this));
-            }
-
-        }, this);
-
-        cc.game.on(cc.game.EVENT_SHOW, function () {
-            console.log("重新返回游戏", this.getTime());
-
-            // if (this.getTime()-this.times>=30000) {
-
-            if (UtilsWX.shareTag == 0) {
-
-            }
-            UtilsWX.setShareTag(0);
-
-            // }
-
-        }, this);
+    cc.game.on(
+      cc.game.EVENT_SHOW,
+      function () {
+        console.log('重新返回游戏', this.getTime())
 
-    },
+        // if (this.getTime()-this.times>=30000) {
 
-    getTime: function () {
-        return new Date().getTime();
-    },
+        if (UtilsWX.shareTag == 0) {
+        }
+        UtilsWX.setShareTag(0)
 
-    // InitTask(BFirstLoadGame) {
-    //     // todo 新手教学 初始化
-    //     console.log("初始化真的假的", BFirstLoadGame);
-    //     if (!BFirstLoadGame) {
-    //         //首次初始化
-    //         task.onLoad();
-    //         //创建员工
-    //         cc.find('GameNode/ManageWorker').getComponent('ManageWorker').onRecruit();
-    //         cc.find('GameNode/ManageWorker').getComponent('ManageWorker').onRecruit();
-
-    //     } else {
-    //         task._init();
-    //         task.addSeneceTaskIcon();
-    //         task.onLoadno();
-    //     }
-    //     this.Init();
-    // },
-
-    start() {
-        /*
+        // }
+      },
+      this
+    )
+  },
+
+  getTime: function () {
+    return new Date().getTime()
+  },
+
+  // InitTask(BFirstLoadGame) {
+  //     // todo 新手教学 初始化
+  //     console.log("初始化真的假的", BFirstLoadGame);
+  //     if (!BFirstLoadGame) {
+  //         //首次初始化
+  //         task.onLoad();
+  //         //创建员工
+  //         cc.find('GameNode/ManageWorker').getComponent('ManageWorker').onRecruit();
+  //         cc.find('GameNode/ManageWorker').getComponent('ManageWorker').onRecruit();
+
+  //     } else {
+  //         task._init();
+  //         task.addSeneceTaskIcon();
+  //         task.onLoadno();
+  //     }
+  //     this.Init();
+  // },
+
+  start() {
+    /*
           其中第一个参数为捕捉的时间名,在官方文档中给出了几个选择,我们主要列举下触碰时间
         cc.Node.EventType.TOUCH_START 当手按下时触发
         cc.Node.EventType.TOUCH_END 当手抬起时候
         cc.Node.EventType.TOUCH_MOVE 当手按下滑动时
         cc.Node.EventType.TOUCH_CANCEL 当手按下滑动后 抬起时
         */
-        if (this._Cancellation) this._Cancellation.node.on(cc.Node.EventType.TOUCH_END, this.onCancellationEditor, this);
-        if (this._Comfirmation) this._Comfirmation.node.on(cc.Node.EventType.TOUCH_END, this.onConfirmationEditor, this);
-    },
-    Init() {
-        this._setLockBuildingColor();
-
-        let BuildingStateArray = GlobalD.GameData.GetBuildingLockStateArray();
-        for (let i = 0; i < BuildingStateArray.length; i++) {
-            if (BuildingStateArray[i] == 1) {
-                if (this.BuildingFrameArray[i])
-                    this.OpenBuildingUILock(i, false);
-            }
-            if (this.BuildingFrameArray[i])
-                this.BuildingFrameArray[i].getChildByName('Lock').getChildByName('PriceBG').getChildByName('label').getComponent(cc.Label).string = this.FormatMoney(AConfig.BuildingUnlockMoneyArray[i]);
-        }
-
-        // *********** todo *************
-        //初始化,面板信息
-        //运营费用数组
-        let _runningCostArray = AConfig.RunningCostArray;
-        for (let i = 0; i < _runningCostArray.length; i++) {
-            if (this.BuildingFrameArray[i]) {
-                let _contentButton = this.BuildingFrameArray[i].getComponent('Content_Button');
-                _contentButton.Price = AConfig.RunningCostArray[i];    //运营费用
-                //设置新的钻石价格
-                let _DiamondNumArray = GlobalD.GameData.GetDiamondNumArray();
-                _contentButton.DiamondPrice = _DiamondNumArray[i];   //钻石费用
-            }
-
-        }
-    },
-    _setLockBuildingColor() {
-        let BuildingStateArray = GlobalD.GameData.GetBuildingLockStateArray();
-
-        for (let index = 0; index < BuildingStateArray.length; index++) {
-            if (this.BuildingFrameArray[index] && BuildingStateArray[index] == 0) {
-                this.BuildingFrameArray[index].color = new cc.Color(150, 150, 150, 150);
-                this.BuildingFrameArray[index].getChildByName('New Sprite(Splash)').color = new cc.Color(0, 0, 0, 255);
-                this.BuildingFrameArray[index].getChildByName('Name').active = false;
-            }
-
-        }
-
-    },
-    OpenBuildingUILock(Index, BLock) {
-
-        let Lock = this.BuildingFrameArray[Index].getChildByName('Lock').active = BLock;
-
-        let BuildingStateArray = GlobalD.GameData.GetBuildingLockStateArray();
-        if (!BLock && BuildingStateArray[Index] == 0) {
-            BuildingStateArray[Index] = 1;
-            this.BuildingFrameArray[Index].color = new cc.Color(255, 255, 255, 255);
-            this.BuildingFrameArray[Index].getChildByName('New Sprite(Splash)').color = new cc.Color(255, 255, 255, 255);
-            this.BuildingFrameArray[Index].getChildByName('Name').active = true;
-            GlobalD.GameData.SetBuildingLockStateArray(BuildingStateArray);
-        }
-
-    },
-    OnUnLockBuilding(event, CustomEventData, callback) {
-        cc.loader.loadRes("prefab/UnlockBuiding", function (err, texture) {
-            this.UnlockBuildingDialogView = cc.instantiate(texture);
-            this.BuildView.addChild(this.UnlockBuildingDialogView);
-
-            {
-                //CloseBtn
-                let close = this.UnlockBuildingDialogView.getChildByName("close");
-                let clickEventHandler = new cc.Component.EventHandler();
-                clickEventHandler.target = this.node;
-                clickEventHandler.component = "ManageUI";
-                clickEventHandler.handler = "onClickCloseInUnlockBuilding";
-                let button = close.getComponent(cc.Button);
-                button.clickEvents.push(clickEventHandler);
-            }
-            {
-                //NoBtn
-                let NoBTN = this.UnlockBuildingDialogView.getChildByName("NoBTN");
-                let clickEventHandler = new cc.Component.EventHandler();
-                clickEventHandler.target = this.node;
-                clickEventHandler.component = "ManageUI";
-                clickEventHandler.handler = "onClickNoBTNInUnlockBuilding";
-                let button = NoBTN.getComponent(cc.Button);
-                button.clickEvents.push(clickEventHandler);
-            }
-            {
-                //YesBtn
-                let YesBTN = this.UnlockBuildingDialogView.getChildByName("YesBTN");
-                let clickEventHandler = new cc.Component.EventHandler();
-                clickEventHandler.target = this.node;
-                clickEventHandler.component = "ManageUI";
-                clickEventHandler.handler = "onClickYesBTNInUnlockBuilding";
-                clickEventHandler.customEventData = CustomEventData;
-                let button = YesBTN.getComponent(cc.Button);
-                button.clickEvents.push(clickEventHandler);
-            }
-
-            //Close
-            if (callback != null) {
-                callback(this.UnlockBuildingDialogView);
-            }
-        }.bind(this));
-    },
-    onClickCloseInUnlockBuilding(event) {
-        this.UnlockBuildingDialogView.destroy();
-    },
-    onClickNoBTNInUnlockBuilding(event) {
-        this.UnlockBuildingDialogView.destroy();
-    },
-    onClickYesBTNInUnlockBuilding(event, CustomEventData) {
-        this.UnlockBuildingDialogView.destroy();
-
-        let Index = parseInt(CustomEventData);
-        let CostCoin = AConfig.BuildingUnlockMoneyArray[Index];
-        if (GlobalD.GameData.GetDiamond() > CostCoin || GlobalD.GameData.GetDiamond() == CostCoin) {
-            GlobalD.GameData.PlusDiamond(-CostCoin);
-            this.OpenBuildingUILock(Index, false);
-
-            cc.loader.loadRes("prefab/show", function (err, texture) {
-                this.ShowRewardsView = cc.instantiate(texture);
-                this.BuildView.addChild(this.ShowRewardsView);
-                let Rewards = this.ShowRewardsView.getChildByName('GivePrize').getChildByName('Rewards');
-                Rewards.getComponent(cc.Sprite).spriteFrame = this.BuildingFrameArray[Index].getChildByName('New Sprite(Splash)').getComponent(cc.Sprite).spriteFrame;
-
-
-                var Sunshine = this.ShowRewardsView.getChildByName('GivePrize').getChildByName('Sunshine');
-                var GivePrize = this.ShowRewardsView.getChildByName('GivePrize');
-                Sunshine.scaleX = 0;
-                Sunshine.scaleY = 0;
-                GivePrize.scaleX = 0;
-                GivePrize.scaleY = 0;
-                Sunshine.stopAllActions();
-                GivePrize.stopAllActions();
-                this.scheduleOnce(function () {
-                    var sc2 = cc.scaleTo(0.5, 0.8, 0.8);
-                    Sunshine.runAction(sc2);
-                    var sc3 = cc.scaleTo(0.5, 1.3, 1.3);
-                    GivePrize.runAction(sc3);
-
-
-                    var repeat = cc.repeatForever(cc.rotateBy(5.0, 360));
-                    Sunshine.runAction(repeat);
-                }, 0.1);
-
-
-                //CloseBtn
-                let close = this.ShowRewardsView.getChildByName("close");
-                let clickEventHandler = new cc.Component.EventHandler();
-                clickEventHandler.target = this.node;
-                clickEventHandler.component = "ManageUI";
-                clickEventHandler.handler = "OnShowRewardsViewClose";
-                let button = close.getComponent(cc.Button);
-                button.clickEvents.push(clickEventHandler);
-            }.bind(this));
-
-            return;
-        }
-        //No Enough Diamond
-        cc.loader.loadRes("prefab/ShowNoMoney", function (err, texture) {
-            this.ShowNoMoneyView = cc.instantiate(texture);
-            this.BuildView.addChild(this.ShowNoMoneyView);
-            let DetailLabel = this.ShowNoMoneyView.getChildByName('DetailLabel');
-            DetailLabel.getComponent(cc.Label).string = '钻石不够!'
-
-            this.scheduleOnce(function () {
-                this.ShowNoMoneyView.destroy();
-            }.bind(this), 1);
-        }.bind(this));
-    },
-    OnShowRewardsViewClose(event, CustomEventData) {
-        this.ShowRewardsView.destroy();
-    },
-
-    //弹出购买提示
-    onPurchaseTips(_contentButton) {
-
-        // cc.log('是否用钻石购买建筑', _contentButton.node.name);
-
-        if (this.TipViewPrefab) {
-            let _TipView;
-            _TipView = cc.instantiate(this.TipViewPrefab);
-            _TipView.parent = this.TipView;
-            _TipView.setPosition(cc.v2(0, 0));
-            _TipView.getComponent('TipView').onShowTip({ ContentButton: _contentButton, TipViewNode: this.TipView });
-            // cc.log(_TipView.name);
-        }
-    },
-    //点击了建造列表里面的按钮时候改变样式
-    onSetButtonState(Data, Synopsis) {
-        cc.Component.EventHandler.emitEvents(Data.Target.clickEvents);
-    },
-    onSetButtonInfoState(Data, Synopsis) {
-        if (Synopsis) {
-            this.onSetButtonInfo(Synopsis.Name, Synopsis.Price, Synopsis.Synopsis)
-        }
-    },
-    //设置介绍信息
-    onSetButtonInfo(_Name, _Price, _Synopsis) {
-        this.BuildContent_Name.string = _Name;
-        this.BuildContent_Price.string = _Price;
-        this.BuildContent_Synopsis.string = _Synopsis.replace(/\n|\r/g,"");
-    },
+    if (this._Cancellation)
+      this._Cancellation.node.on(
+        cc.Node.EventType.TOUCH_END,
+        this.onCancellationEditor,
+        this
+      )
+    if (this._Comfirmation)
+      this._Comfirmation.node.on(
+        cc.Node.EventType.TOUCH_END,
+        this.onConfirmationEditor,
+        this
+      )
+  },
+  Init() {
+    this._setLockBuildingColor()
+
+    let BuildingStateArray = GlobalD.GameData.GetBuildingLockStateArray()
+    for (let i = 0; i < BuildingStateArray.length; i++) {
+      if (BuildingStateArray[i] == 1) {
+        if (this.BuildingFrameArray[i]) this.OpenBuildingUILock(i, false)
+      }
+      if (this.BuildingFrameArray[i])
+        this.BuildingFrameArray[i]
+          .getChildByName('Lock')
+          .getChildByName('PriceBG')
+          .getChildByName('label')
+          .getComponent(cc.Label).string = this.FormatMoney(
+          AConfig.BuildingUnlockMoneyArray[i]
+        )
+    }
 
-    /**
-     * 设置商城信息
-     * @param {}} Data 
-     * @param {*} Synopsis 
-     */
-    onSetMallInfoState(Data, Synopsis) {
-        if (Synopsis) {
-            this.onSetMallInfo(Synopsis.Name, Synopsis.Mature, Synopsis.Price, Synopsis.Synopsis)
-        }
-    },
-    //设置介绍信息
-    onSetMallInfo(_Name, _mature, _Price, _Synopsis) {
-        this.mallContent_Name.string = _Name;
-        this.mallContent_Price.string = _Price;
-        this.mallContent_Mature.string = _mature;
-        this.mallContent_Synopsis.string = _Synopsis.replace(/\n|\r/g,"");
-    },
-    //编辑对应的建筑
-    onEditorialBuildings(mUI_buildTarget) {
-        if (!this.EditorialBuildings) {
-            cc.warn('EditorialBuildings is Null!')
-            return;
+    // *********** todo *************
+    //初始化,面板信息
+    //运营费用数组
+    let _runningCostArray = AConfig.RunningCostArray
+    for (let i = 0; i < _runningCostArray.length; i++) {
+      if (this.BuildingFrameArray[i]) {
+        let _contentButton =
+          this.BuildingFrameArray[i].getComponent('Content_Button')
+        _contentButton.Price = AConfig.RunningCostArray[i] //运营费用
+        //设置新的钻石价格
+        let _DiamondNumArray = GlobalD.GameData.GetDiamondNumArray()
+        _contentButton.DiamondPrice = _DiamondNumArray[i] //钻石费用
+      }
+    }
+  },
+  _setLockBuildingColor() {
+    let BuildingStateArray = GlobalD.GameData.GetBuildingLockStateArray()
+
+    for (let index = 0; index < BuildingStateArray.length; index++) {
+      if (this.BuildingFrameArray[index] && BuildingStateArray[index] == 0) {
+        this.BuildingFrameArray[index].color = new cc.Color(150, 150, 150, 150)
+        this.BuildingFrameArray[index].getChildByName(
+          'New Sprite(Splash)'
+        ).color = new cc.Color(0, 0, 0, 255)
+        this.BuildingFrameArray[index].getChildByName('Name').active = false
+      }
+    }
+  },
+  OpenBuildingUILock(Index, BLock) {
+    let Lock = (this.BuildingFrameArray[Index].getChildByName('Lock').active =
+      BLock)
+
+    let BuildingStateArray = GlobalD.GameData.GetBuildingLockStateArray()
+    if (!BLock && BuildingStateArray[Index] == 0) {
+      BuildingStateArray[Index] = 1
+      this.BuildingFrameArray[Index].color = new cc.Color(255, 255, 255, 255)
+      this.BuildingFrameArray[Index].getChildByName(
+        'New Sprite(Splash)'
+      ).color = new cc.Color(255, 255, 255, 255)
+      this.BuildingFrameArray[Index].getChildByName('Name').active = true
+      GlobalD.GameData.SetBuildingLockStateArray(BuildingStateArray)
+    }
+  },
+  OnUnLockBuilding(event, CustomEventData, callback) {
+    cc.loader.loadRes(
+      'prefab/UnlockBuiding',
+      function (err, texture) {
+        this.UnlockBuildingDialogView = cc.instantiate(texture)
+        this.BuildView.addChild(this.UnlockBuildingDialogView)
+
+        {
+          //CloseBtn
+          let close = this.UnlockBuildingDialogView.getChildByName('close')
+          let clickEventHandler = new cc.Component.EventHandler()
+          clickEventHandler.target = this.node
+          clickEventHandler.component = 'ManageUI'
+          clickEventHandler.handler = 'onClickCloseInUnlockBuilding'
+          let button = close.getComponent(cc.Button)
+          button.clickEvents.push(clickEventHandler)
         }
-        this.EditorialBuildings.active = true;
-        //重置上一个编辑建筑的状态
-        if (this._buildTarget && this._buildTarget.getComponent('buildingsTouch')) {
-            this._buildTarget.getComponent('buildingsTouch').onCancelEdit();
+        {
+          //NoBtn
+          let NoBTN = this.UnlockBuildingDialogView.getChildByName('NoBTN')
+          let clickEventHandler = new cc.Component.EventHandler()
+          clickEventHandler.target = this.node
+          clickEventHandler.component = 'ManageUI'
+          clickEventHandler.handler = 'onClickNoBTNInUnlockBuilding'
+          let button = NoBTN.getComponent(cc.Button)
+          button.clickEvents.push(clickEventHandler)
         }
-        this._buildTarget = mUI_buildTarget;
-        this.EditorialBuildings.parent = mUI_buildTarget;
-        this.EditorialBuildings.setPosition(cc.v2(0, 0));
-
-    },
-    //取消编辑
-    onCancellationEditor() {
-        //获取建筑物上的组件
-        let buildTouch = this._buildTarget.getComponent('buildingsTouch');
-        let isTaskNext = buildTouch.onTaskBuild();
-        if (!isTaskNext) return;
-        if (task.isMushBuildState) {
-            cc.loader.loadRes('resUI/ShowNotEnoughMoney', function (err, texture) {
-                var prefab = cc.instantiate(texture);
-                prefab.getComponent('ShowNotEnoughMoney').Text("请点击'√'号");
-                this._buildTarget.addChild(prefab);
-            }.bind(this));
-            return;
+        {
+          //YesBtn
+          let YesBTN = this.UnlockBuildingDialogView.getChildByName('YesBTN')
+          let clickEventHandler = new cc.Component.EventHandler()
+          clickEventHandler.target = this.node
+          clickEventHandler.component = 'ManageUI'
+          clickEventHandler.handler = 'onClickYesBTNInUnlockBuilding'
+          clickEventHandler.customEventData = CustomEventData
+          let button = YesBTN.getComponent(cc.Button)
+          button.clickEvents.push(clickEventHandler)
         }
-        // if (buildTouch) {
-        buildTouch.onCancelEdit();
-        // }
-
-
-        this.EditorialBuildings.active = false;
-        this.EditorialBuildings.parent = this._thisEditBuildingsParent;
-        this.EditorialBuildings.setPosition(cc.v2(10000, 100));
-        this._buildTarget = null;
-    },
-    //确定编辑(创建建筑物 对号)
-    onConfirmationEditor() {
-        //获取建筑物上的组件
-        let buildTouch = this._buildTarget.getComponent('buildingsTouch');
-        let isTaskNext = buildTouch.onTaskBuild();
-        if (!isTaskNext) return;
-        // if (buildTouch) {
-        buildTouch.onFinishEdit();
-        // }
-
 
-        this.EditorialBuildings.active = false;
-        this.EditorialBuildings.parent = this._thisEditBuildingsParent;
-        this.EditorialBuildings.setPosition(cc.v2(10000, 100));
-
-
-        this._buildTarget = null;
-    },
-
-    //如果相等的话返回true
-    verctor3IsEqual(vector1, vector2) {
-        let isEqual = false;
-        let out = new cc.Vec3();
-        out.x = vector2.x - vector1.x;
-        out.y = vector2.y - vector1.y;
-        out.z = vector2.z - vector1.z;
-        if (out.x == 0 && out.y == 0 && out.z == 0) {
-            isEqual = true;
+        //Close
+        if (callback != null) {
+          callback(this.UnlockBuildingDialogView)
         }
-        return isEqual;
-    },
-    //收起全部菜单
-    onHideMenu() {
-        // if (this.BuildView) {
-        //     this.BuildView.active = false;
-        // }
-        //音效设置界面
-        if (this.SettingInfoView.active)
-            this.onSetTouchStatus(this.SettingInfoView, false);
-        //建造界面
-        if (this.BuildView.active)
-            this.onSetTouchStatus(this.BuildView, false);
-        //人才界面
-        if (this.PersonnelView.active)
-            this.onSetTouchStatus(this.PersonnelView, false);
-        //股票界面
-        if (this.StockView.active)
-            this.onSetTouchStatus(this.StockView, false);
-        //转盘界面
-        if (this.LuckView.active)
-            this.onSetTouchStatus(this.LuckView, false);
-        //商城界面
-        if (this.StoreView.active)
-            this.onSetTouchStatus(this.StoreView, false);
-    },
-    //底部菜单栏
-    onBottomMenuView(isActive) {
-        if (this.BottomView) {
-            this.BottomView.active = isActive;
-        }
-
-
-        // cc.log('不能显示面板信息:');
-        GlobalD.GameControl._isBuildingCanEdit = !isActive;
-    },
-    //开启信息显示
-    onShowBuildingInfo(buildingInfo) {
-        this.BuildingInfoView.active = true;
-        if (!this._buildingInfoViewScript)
-            this._buildingInfoViewScript = this.BuildingInfoView.getComponent('buildingInfoView');
-
-        //显示房屋信息
-        this._buildingInfoViewScript.onSetBuildingInfoView(buildingInfo);
-
-    },
-    //关闭信息显示
-    onCloseBuildingInfo() {
-        this.BuildingInfoView.active = false;
-    },
-    //进入编辑模式,
-    onEnterEditing() {
-    },
-    onSetTouchStatus(target, isActive) {
-        target.active = isActive;
-        if (this.UITouch) {
-            this.UITouch.active = isActive;
-        }
-    },
-
-    /**
-     * 绑定邀请
-     */
-    onInvite_Open() {
-        this.inviteNode.getComponent("inviteInfo").onOpenInviteInfo();
-    },
-
+      }.bind(this)
+    )
+  },
+  onClickCloseInUnlockBuilding(event) {
+    this.UnlockBuildingDialogView.destroy()
+  },
+  onClickNoBTNInUnlockBuilding(event) {
+    this.UnlockBuildingDialogView.destroy()
+  },
+  onClickYesBTNInUnlockBuilding(event, CustomEventData) {
+    this.UnlockBuildingDialogView.destroy()
+
+    let Index = parseInt(CustomEventData)
+    let CostCoin = AConfig.BuildingUnlockMoneyArray[Index]
+    if (
+      GlobalD.GameData.GetDiamond() > CostCoin ||
+      GlobalD.GameData.GetDiamond() == CostCoin
+    ) {
+      GlobalD.GameData.PlusDiamond(-CostCoin)
+      this.OpenBuildingUILock(Index, false)
+
+      cc.loader.loadRes(
+        'prefab/show',
+        function (err, texture) {
+          this.ShowRewardsView = cc.instantiate(texture)
+          this.BuildView.addChild(this.ShowRewardsView)
+          let Rewards =
+            this.ShowRewardsView.getChildByName('GivePrize').getChildByName(
+              'Rewards'
+            )
+          Rewards.getComponent(cc.Sprite).spriteFrame = this.BuildingFrameArray[
+            Index
+          ].getChildByName('New Sprite(Splash)').getComponent(
+            cc.Sprite
+          ).spriteFrame
+
+          var Sunshine =
+            this.ShowRewardsView.getChildByName('GivePrize').getChildByName(
+              'Sunshine'
+            )
+          var GivePrize = this.ShowRewardsView.getChildByName('GivePrize')
+          Sunshine.scaleX = 0
+          Sunshine.scaleY = 0
+          GivePrize.scaleX = 0
+          GivePrize.scaleY = 0
+          Sunshine.stopAllActions()
+          GivePrize.stopAllActions()
+          this.scheduleOnce(function () {
+            var sc2 = cc.scaleTo(0.5, 0.8, 0.8)
+            Sunshine.runAction(sc2)
+            var sc3 = cc.scaleTo(0.5, 1.3, 1.3)
+            GivePrize.runAction(sc3)
+
+            var repeat = cc.repeatForever(cc.rotateBy(5.0, 360))
+            Sunshine.runAction(repeat)
+          }, 0.1)
+
+          //CloseBtn
+          let close = this.ShowRewardsView.getChildByName('close')
+          let clickEventHandler = new cc.Component.EventHandler()
+          clickEventHandler.target = this.node
+          clickEventHandler.component = 'ManageUI'
+          clickEventHandler.handler = 'OnShowRewardsViewClose'
+          let button = close.getComponent(cc.Button)
+          button.clickEvents.push(clickEventHandler)
+        }.bind(this)
+      )
+
+      return
+    }
+    //No Enough Diamond
+    cc.loader.loadRes(
+      'prefab/ShowNoMoney',
+      function (err, texture) {
+        this.ShowNoMoneyView = cc.instantiate(texture)
+        this.BuildView.addChild(this.ShowNoMoneyView)
+        let DetailLabel = this.ShowNoMoneyView.getChildByName('DetailLabel')
+        DetailLabel.getComponent(cc.Label).string = '钻石不够!'
+
+        this.scheduleOnce(
+          function () {
+            this.ShowNoMoneyView.destroy()
+          }.bind(this),
+          1
+        )
+      }.bind(this)
+    )
+  },
+  OnShowRewardsViewClose(event, CustomEventData) {
+    this.ShowRewardsView.destroy()
+  },
+
+  //弹出购买提示
+  onPurchaseTips(_contentButton) {
+    // cc.log('是否用钻石购买建筑', _contentButton.node.name);
+
+    if (this.TipViewPrefab) {
+      let _TipView
+      _TipView = cc.instantiate(this.TipViewPrefab)
+      _TipView.parent = this.TipView
+      _TipView.setPosition(cc.v2(0, 0))
+      _TipView
+        .getComponent('TipView')
+        .onShowTip({ ContentButton: _contentButton, TipViewNode: this.TipView })
+      // cc.log(_TipView.name);
+    }
+  },
+  //点击了建造列表里面的按钮时候改变样式
+  onSetButtonState(Data, Synopsis) {
+    cc.Component.EventHandler.emitEvents(Data.Target.clickEvents)
+  },
+  onSetButtonInfoState(Data, Synopsis) {
+    if (Synopsis) {
+      this.onSetButtonInfo(Synopsis.Name, Synopsis.Price, Synopsis.Synopsis)
+    }
+  },
+  //设置介绍信息
+  onSetButtonInfo(_Name, _Price, _Synopsis) {
+    this.BuildContent_Name.string = _Name
+    this.BuildContent_Price.string = _Price
+    this.BuildContent_Synopsis.string = _Synopsis.replace(/\n|\r/g, '')
+  },
+
+  /**
+   * 设置商城信息
+   * @param {}} Data
+   * @param {*} Synopsis
+   */
+  onSetMallInfoState(Data, Synopsis) {
+    if (Synopsis) {
+      this.onSetMallInfo(
+        Synopsis.Name,
+        Synopsis.Mature,
+        Synopsis.Price,
+        Synopsis.Synopsis
+      )
+    }
+  },
+  //设置介绍信息
+  onSetMallInfo(_Name, _mature, _Price, _Synopsis) {
+    this.mallContent_Name.string = _Name
+    this.mallContent_Price.string = _Price
+    this.mallContent_Mature.string = _mature
+    this.mallContent_Synopsis.string = _Synopsis.replace(/\n|\r/g, '')
+  },
+  //编辑对应的建筑
+  onEditorialBuildings(mUI_buildTarget) {
+    if (!this.EditorialBuildings) {
+      cc.warn('EditorialBuildings is Null!')
+      return
+    }
+    this.EditorialBuildings.active = true
+    //重置上一个编辑建筑的状态
+    if (this._buildTarget && this._buildTarget.getComponent('buildingsTouch')) {
+      this._buildTarget.getComponent('buildingsTouch').onCancelEdit()
+    }
+    this._buildTarget = mUI_buildTarget
+    this.EditorialBuildings.parent = mUI_buildTarget
+    this.EditorialBuildings.setPosition(cc.v2(0, 0))
+  },
+  //取消编辑
+  onCancellationEditor() {
+    //获取建筑物上的组件
+    let buildTouch = this._buildTarget.getComponent('buildingsTouch')
+    let isTaskNext = buildTouch.onTaskBuild()
+    if (!isTaskNext) return
+    if (task.isMushBuildState) {
+      cc.loader.loadRes(
+        'resUI/ShowNotEnoughMoney',
+        function (err, texture) {
+          var prefab = cc.instantiate(texture)
+          prefab.getComponent('ShowNotEnoughMoney').Text("请点击'√'号")
+          this._buildTarget.addChild(prefab)
+        }.bind(this)
+      )
+      return
+    }
+    // if (buildTouch) {
+    buildTouch.onCancelEdit()
+    // }
+
+    this.EditorialBuildings.active = false
+    this.EditorialBuildings.parent = this._thisEditBuildingsParent
+    this.EditorialBuildings.setPosition(cc.v2(10000, 100))
+    this._buildTarget = null
+  },
+  //确定编辑(创建建筑物 对号)
+  onConfirmationEditor() {
+    //获取建筑物上的组件
+    let buildTouch = this._buildTarget.getComponent('buildingsTouch')
+    let isTaskNext = buildTouch.onTaskBuild()
+    if (!isTaskNext) return
+    // if (buildTouch) {
+    buildTouch.onFinishEdit()
+    // }
+
+    this.EditorialBuildings.active = false
+    this.EditorialBuildings.parent = this._thisEditBuildingsParent
+    this.EditorialBuildings.setPosition(cc.v2(10000, 100))
+
+    this._buildTarget = null
+  },
+
+  //如果相等的话返回true
+  verctor3IsEqual(vector1, vector2) {
+    let isEqual = false
+    let out = new cc.Vec3()
+    out.x = vector2.x - vector1.x
+    out.y = vector2.y - vector1.y
+    out.z = vector2.z - vector1.z
+    if (out.x == 0 && out.y == 0 && out.z == 0) {
+      isEqual = true
+    }
+    return isEqual
+  },
+  //收起全部菜单
+  onHideMenu() {
+    // if (this.BuildView) {
+    //     this.BuildView.active = false;
+    // }
     //音效设置界面
-    onButtonEvent_Setting_OPen() {
-        this.onHideMenu();
-        this.onSetTouchStatus(this.SettingInfoView, true);
-    },
-    onButtonEvent_Setting_Close() {
-        this.onSetTouchStatus(this.SettingInfoView, false);
-    },
+    if (this.SettingInfoView.active)
+      this.onSetTouchStatus(this.SettingInfoView, false)
     //建造界面
-    onButtonEvent_Building_OPen() {
-        this.onHideMenu();
-        this.onSetTouchStatus(this.BuildView, true);
-        this.BuildView.getComponent('BuildingView').onSwitchBuildingContent(this.Evn.getComponent(cc.Button), 0);
-    },
-    //商城界面
-    onButtonEvent_Store_OPen() {
-        this.onHideMenu();
-        this.onSetTouchStatus(this.StoreView, true);
-        this.StoreView.getComponent('StoreView').onSwitchBuildingContent(this.Seed.getComponent(cc.Button), 0);
-    },
-    novice: function () {
-        var BuildingView = cc.find("Canvas/UICamera/BuildingContainer/BuildingView");
-        task.removeTaskNode(task.taskCursorName[2]); //左上
-        task.addTaskTips(BuildingView, task.taskPrefab[1], -180, 180, task.taskCursorName[2], function (nodePrefabs) {
-            //手指
-            this.nodePrefabs = nodePrefabs;
-        }.bind(this));
-    },
-    novice1: function () {
-        var BuildingView = cc.find("Canvas/UICamera/BuildingContainer/BuildingView");
-        task.addTaskTips(BuildingView, task.novice[1], 0, 50, task.taskCursorName[3], function (node) {
-            UtilsPrefabs.setOn(node.getChildByName("SureBtn"), function () {
-                UtilsPrefabs.setOff(node.getChildByName("SureBtn"));
-
-                var mt = cc.moveTo(1, 110, 180);//右上
-
-                var finished = cc.callFunc(function () {
-
-                    task.removeTaskNode(task.taskCursorName[3]);
-                    this.novice2();
-                }.bind(this));
-                var sequence = cc.sequence(mt, finished);
-                this.nodePrefabs.runAction(sequence);
-
-                task.isShowTaskNode(task.taskCursorName[3], false);
-            }.bind(this))
-        }.bind(this));
-    },
-    novice2: function () {
-        var BuildingView = cc.find("Canvas/UICamera/BuildingContainer/BuildingView");
-        task.addTaskTips(BuildingView, task.novice[2], 0, 50, task.taskCursorName[3], function (node) {
-            UtilsPrefabs.setOn(node.getChildByName("SureBtn"), function () {
-                UtilsPrefabs.setOff(node.getChildByName("SureBtn"));
-
-                var mt = cc.moveTo(1, -200, 0);//
-
-                var finished = cc.callFunc(function () {
-
-                    task.removeTaskNode(task.taskCursorName[3]);
-                    this.novice3();
-                }.bind(this));
-                var sequence = cc.sequence(mt, finished);
-                this.nodePrefabs.runAction(sequence);
-
-                task.isShowTaskNode(task.taskCursorName[3], false);
-            }.bind(this))
-        }.bind(this));
-    },
-    novice3: function () {
-        var BuildingView = cc.find("Canvas/UICamera/BuildingContainer/BuildingView");
-        task.addTaskTips(BuildingView, task.novice[3], 0, -150, task.taskCursorName[3], function (node) {
-            UtilsPrefabs.setOn(node.getChildByName("SureBtn"), function () {
-                task.removeTaskNode(task.taskCursorName[3]);
-            }.bind(this))
-
-        }.bind(this));
-    },
-
-    //外面管理的手指
-    novicepersonnel: function () {
-        task.removeTaskNode(task.taskCursorName[2]); //左上
-        task.addTaskTips(task.personnelview, task.taskPrefab[1], 0, 0, task.taskCursorName[2], function (nodePrefabs) {
-            //手指
-            this.nodePrefabs = nodePrefabs;
-        }.bind(this));
-    },
-    //外面的 建筑手指
-    noviceBuilding: function () {
-        //建造农舍指引
-        task.showTiledTile(0, 0, 0, 23, 25);
-    },
-    novice4: function () {
-        var BuildingView = cc.find("Canvas/UICamera/BuildingContainer/BuildingView");
-        task.addTaskTips(BuildingView, task.novice[4], 0, -200, task.taskCursorName[3], function (node) {
-            UtilsPrefabs.setOn(node.getChildByName("SureBtn"), function () {
-                task.removeTaskNode(task.taskCursorName[3]);
-            }.bind(this))
-        }.bind(this));
-    },
-    //关闭 建造框
-    onButtonEvent_Building_Close() {
-        // cc.log(this.BuildView);
-        this.onSetTouchStatus(this.BuildView, false);
-    },
-    //关闭 商城框
-    onButtonEvent_Store_Close() {
-        this.onSetTouchStatus(this.StoreView, false);
-    },
+    if (this.BuildView.active) this.onSetTouchStatus(this.BuildView, false)
     //人才界面
-    onButtonEvent_Personnel_OPen() {
-        this.onHideMenu();
-        this.onSetTouchStatus(this.PersonnelView, true);
-    },
-    onButtonEvent_Personnel_Close() {
-        this.onSetTouchStatus(this.PersonnelView, false);
-    },
+    if (this.PersonnelView.active)
+      this.onSetTouchStatus(this.PersonnelView, false)
     //股票界面
-    onButtonEvent_Stock_OPen() {
-        this.onHideMenu();
-        this.onSetTouchStatus(this.StockView, true);
-        // console.log("所有建筑物数据", GlobalD.game.buildingsTiledMapUnit);
-        UtilsWX.lookRankList(true);
-        this.showFriend();
-    },
-    //限制
-    returnDialog: function (cursor) {
-        var num = 0;
-        // console.log("要创建什么提示呢数字", cursor);
-        switch (cursor) {
-            case 1:
-                num = 0;
-                break;
-            case 4:
-                num = 1;
-                break;
-            case 6:
-                num = 2;
-                break;
-        }
-        console.log("要创建什么提示呢", task.returnPrefab[num]);
-        var Canvas = cc.find("Canvas/UICamera");
-        task.addTaskTips(Canvas, task.returnPrefab[num], 0, 0, task.taskCursorName[4], function (nodePrefabs) {
-            UtilsPrefabs.setOn(nodePrefabs.getChildByName("SureBtn"), function () {
-                task.removeTaskNode(task.taskCursorName[4]);
-
-            }.bind(this))
-        }.bind(this));
-    },
-
-
-    showFriend: function () {
-        // var data1 = {
-        //     name: "Whoareyou",
-        //     openId : userData.openId
-        // }
-        // UtilsWX.postMessage(data1);
-        var data = {
-            name: "showFriend",
-        }
-        UtilsWX.postMessage(data);
-    },
-
-
-    onButtonEvent_Stock_Close() {
-        this.onSetTouchStatus(this.StockView, false);
-        var data = {
-            name: "hideFriend",
-        }
-        UtilsWX.postMessage(data);
-        setTimeout(function () {
-            UtilsWX.lookRankList(false);
-        }.bind(this), 200);
-
-    },
+    if (this.StockView.active) this.onSetTouchStatus(this.StockView, false)
     //转盘界面
-    onButtonEvent_Luck_OPen() {
-        this.onHideMenu();
-        this.onSetTouchStatus(this.LuckView, true);
-        if (this.nodePrefabsLuck != null) {
-            task.removeNode(this.nodePrefabsLuck);
-        }
-    },
-    isTask: function (obj) {
-        var Canvas = cc.find("Canvas/UICamera");
-        UtilsPrefabs
-            .init(Canvas)
-            .addPrefabs(UtilsPrefabs.sharePrefab[1], null, function (node) {
-                var gosharebtn = UtilsPrefabs.getNode("gosharebtn", node);
-
-                var close = UtilsPrefabs.getNode("close", node);
-                UtilsPrefabs.setOn(close, function () {
-                    UtilsPrefabs.removePrefabs(Canvas, node.name);
-                    if (task.TaskIconCountClick == 5) {
-                        if (obj.currentTarget.name == "GetGift") {
-                            task.addTaskIconCountClick();
-                            task.removeTaskNodes();
-                        }
-                    }
-                }.bind(this))
-
-                UtilsPrefabs.setOn(gosharebtn, function () {
-                    // console.log("点击分享按钮");
-
-                    UtilsWX.sharebtn(function () {
-                        UtilsPrefabs.setOff(gosharebtn);
-                        GlobalD.GameData.PlusGolden(GlobalD.GameData.shareGive[0]);
-                        GlobalD.GameData.PlusDiamond(GlobalD.GameData.shareGive[1]);
-                        if (task.TaskIconCountClick == 5) {
-                            if (obj.currentTarget.name == "GetGift") {
-                                task.addTaskIconCountClick();
-                                task.removeTaskNodes();
-                            }
-                        }
-                    }.bind(this));
-                    UtilsPrefabs.removePrefabs(Canvas, node.name);
-                }.bind(this))
-            }.bind(this));
-
-
-    },
-    isTask4: function () {
-        if (task.TaskIconCountClick == 4) {
-            task.addTaskIconCountClick();
-            task.removeTaskNodes();
-        }
-    },
-    onButtonEvent_Luck_Close(obj) {
-        // console.log("现在是谁点的", obj);
-        let Wheel = this.LuckView.getChildByName('Wheel').getComponent('Wheel');
-        Wheel.node.active = true;
-        Wheel.ShowRewards.active = false;
-
-        this.onSetTouchStatus(this.LuckView, false);
-
-
-        if (obj.target.name == "GetGift") {
-            this.isTask(obj);
-        }
-
-    },
-    onButtonEvent_EveryDay_OPen() {
+    if (this.LuckView.active) this.onSetTouchStatus(this.LuckView, false)
+    //商城界面
+    if (this.StoreView.active) this.onSetTouchStatus(this.StoreView, false)
+  },
+  //底部菜单栏
+  onBottomMenuView(isActive) {
+    if (this.BottomView) {
+      this.BottomView.active = isActive
+    }
 
-        this.onHideMenu();
-        this.onSetTouchStatus(this.EveryDaySignView, true);
-        //打开每日签到 外面的按钮
-        if (task.TaskIconCountClick == 4) {
+    // cc.log('不能显示面板信息:');
+    GlobalD.GameControl._isBuildingCanEdit = !isActive
+  },
+  //开启信息显示
+  onShowBuildingInfo(buildingInfo) {
+    this.BuildingInfoView.active = true
+    if (!this._buildingInfoViewScript)
+      this._buildingInfoViewScript =
+        this.BuildingInfoView.getComponent('buildingInfoView')
+
+    //显示房屋信息
+    this._buildingInfoViewScript.onSetBuildingInfoView(buildingInfo)
+  },
+  //关闭信息显示
+  onCloseBuildingInfo() {
+    this.BuildingInfoView.active = false
+  },
+  //进入编辑模式,
+  onEnterEditing() {},
+  onSetTouchStatus(target, isActive) {
+    target.active = isActive
+    if (this.UITouch) {
+      this.UITouch.active = isActive
+    }
+  },
+
+  /**
+   * 绑定邀请
+   */
+  onInvite_Open() {
+    this.inviteNode.getComponent('inviteInfo').onOpenInviteInfo()
+  },
+
+  //点击钻石兑换
+  onButtonEvent_Exchange() {
+    if (GlobalD.GameData.GetDiamond() > 30000) {
+      alert('钻石数量不够,累积到30000个钻石即可免费兑换一包辣椒种子。')
+      return
+    }
+    this.onSetTouchStatus(this.DiamondSeedsView, true)
+  },
+  //点击钻石兑换的确认按钮
+  onButtonEvent_DiamondSure() {
+    this.onSetTouchStatus(this.DiamondSeedsView, false)
+    this.onSetTouchStatus(this.DiamondGapView, false)
+  },
+
+  //音效设置界面
+  onButtonEvent_Setting_OPen() {
+    this.onHideMenu()
+    this.onSetTouchStatus(this.SettingInfoView, true)
+  },
+  onButtonEvent_Setting_Close() {
+    this.onSetTouchStatus(this.SettingInfoView, false)
+  },
+  //建造界面
+  onButtonEvent_Building_OPen() {
+    this.onHideMenu()
+    this.onSetTouchStatus(this.BuildView, true)
+    this.BuildView.getComponent('BuildingView').onSwitchBuildingContent(
+      this.Evn.getComponent(cc.Button),
+      0
+    )
+  },
+  //商城界面
+  onButtonEvent_Store_OPen() {
+    this.onHideMenu()
+    this.onSetTouchStatus(this.StoreView, true)
+    this.StoreView.getComponent('StoreView').onSwitchBuildingContent(
+      this.Seed.getComponent(cc.Button),
+      0
+    )
+  },
+  novice: function () {
+    var BuildingView = cc.find('Canvas/UICamera/BuildingContainer/BuildingView')
+    task.removeTaskNode(task.taskCursorName[2]) //左上
+    task.addTaskTips(
+      BuildingView,
+      task.taskPrefab[1],
+      -180,
+      180,
+      task.taskCursorName[2],
+      function (nodePrefabs) {
+        //手指
+        this.nodePrefabs = nodePrefabs
+      }.bind(this)
+    )
+  },
+  novice1: function () {
+    var BuildingView = cc.find('Canvas/UICamera/BuildingContainer/BuildingView')
+    task.addTaskTips(
+      BuildingView,
+      task.novice[1],
+      0,
+      50,
+      task.taskCursorName[3],
+      function (node) {
+        UtilsPrefabs.setOn(
+          node.getChildByName('SureBtn'),
+          function () {
+            UtilsPrefabs.setOff(node.getChildByName('SureBtn'))
+
+            var mt = cc.moveTo(1, 110, 180) //右上
+
+            var finished = cc.callFunc(
+              function () {
+                task.removeTaskNode(task.taskCursorName[3])
+                this.novice2()
+              }.bind(this)
+            )
+            var sequence = cc.sequence(mt, finished)
+            this.nodePrefabs.runAction(sequence)
+
+            task.isShowTaskNode(task.taskCursorName[3], false)
+          }.bind(this)
+        )
+      }.bind(this)
+    )
+  },
+  novice2: function () {
+    var BuildingView = cc.find('Canvas/UICamera/BuildingContainer/BuildingView')
+    task.addTaskTips(
+      BuildingView,
+      task.novice[2],
+      0,
+      50,
+      task.taskCursorName[3],
+      function (node) {
+        UtilsPrefabs.setOn(
+          node.getChildByName('SureBtn'),
+          function () {
+            UtilsPrefabs.setOff(node.getChildByName('SureBtn'))
+
+            var mt = cc.moveTo(1, -200, 0) //
+
+            var finished = cc.callFunc(
+              function () {
+                task.removeTaskNode(task.taskCursorName[3])
+                this.novice3()
+              }.bind(this)
+            )
+            var sequence = cc.sequence(mt, finished)
+            this.nodePrefabs.runAction(sequence)
+
+            task.isShowTaskNode(task.taskCursorName[3], false)
+          }.bind(this)
+        )
+      }.bind(this)
+    )
+  },
+  novice3: function () {
+    var BuildingView = cc.find('Canvas/UICamera/BuildingContainer/BuildingView')
+    task.addTaskTips(
+      BuildingView,
+      task.novice[3],
+      0,
+      -150,
+      task.taskCursorName[3],
+      function (node) {
+        UtilsPrefabs.setOn(
+          node.getChildByName('SureBtn'),
+          function () {
+            task.removeTaskNode(task.taskCursorName[3])
+          }.bind(this)
+        )
+      }.bind(this)
+    )
+  },
+
+  //外面管理的手指
+  novicepersonnel: function () {
+    task.removeTaskNode(task.taskCursorName[2]) //左上
+    task.addTaskTips(
+      task.personnelview,
+      task.taskPrefab[1],
+      0,
+      0,
+      task.taskCursorName[2],
+      function (nodePrefabs) {
+        //手指
+        this.nodePrefabs = nodePrefabs
+      }.bind(this)
+    )
+  },
+  //外面的 建筑手指
+  noviceBuilding: function () {
+    //建造农舍指引
+    task.showTiledTile(0, 0, 0, 23, 25)
+  },
+  novice4: function () {
+    var BuildingView = cc.find('Canvas/UICamera/BuildingContainer/BuildingView')
+    task.addTaskTips(
+      BuildingView,
+      task.novice[4],
+      0,
+      -200,
+      task.taskCursorName[3],
+      function (node) {
+        UtilsPrefabs.setOn(
+          node.getChildByName('SureBtn'),
+          function () {
+            task.removeTaskNode(task.taskCursorName[3])
+          }.bind(this)
+        )
+      }.bind(this)
+    )
+  },
+  //关闭 建造框
+  onButtonEvent_Building_Close() {
+    // cc.log(this.BuildView);
+    this.onSetTouchStatus(this.BuildView, false)
+  },
+  //关闭 商城框
+  onButtonEvent_Store_Close() {
+    this.onSetTouchStatus(this.StoreView, false)
+  },
+  //人才界面
+  onButtonEvent_Personnel_OPen() {
+    this.onHideMenu()
+    this.onSetTouchStatus(this.PersonnelView, true)
+  },
+  onButtonEvent_Personnel_Close() {
+    this.onSetTouchStatus(this.PersonnelView, false)
+  },
+  //股票界面
+  onButtonEvent_Stock_OPen() {
+    this.onHideMenu()
+    this.onSetTouchStatus(this.StockView, true)
+    // console.log("所有建筑物数据", GlobalD.game.buildingsTiledMapUnit);
+    UtilsWX.lookRankList(true)
+    this.showFriend()
+  },
+  //限制
+  returnDialog: function (cursor) {
+    var num = 0
+    // console.log("要创建什么提示呢数字", cursor);
+    switch (cursor) {
+      case 1:
+        num = 0
+        break
+      case 4:
+        num = 1
+        break
+      case 6:
+        num = 2
+        break
+    }
+    console.log('要创建什么提示呢', task.returnPrefab[num])
+    var Canvas = cc.find('Canvas/UICamera')
+    task.addTaskTips(
+      Canvas,
+      task.returnPrefab[num],
+      0,
+      0,
+      task.taskCursorName[4],
+      function (nodePrefabs) {
+        UtilsPrefabs.setOn(
+          nodePrefabs.getChildByName('SureBtn'),
+          function () {
+            task.removeTaskNode(task.taskCursorName[4])
+          }.bind(this)
+        )
+      }.bind(this)
+    )
+  },
+
+  showFriend: function () {
+    // var data1 = {
+    //     name: "Whoareyou",
+    //     openId : userData.openId
+    // }
+    // UtilsWX.postMessage(data1);
+    var data = {
+      name: 'showFriend',
+    }
+    UtilsWX.postMessage(data)
+  },
 
-            var EveryDaySign = cc.find("Canvas/UICamera/OverTheMask/EveryDaySignContainer/EveryDaySignView");
-            // var Canvas = cc.find("Canvas/UICamera");
-            // task.removeTaskNodes();
+  onButtonEvent_Stock_Close() {
+    this.onSetTouchStatus(this.StockView, false)
+    var data = {
+      name: 'hideFriend',
+    }
+    UtilsWX.postMessage(data)
+    setTimeout(
+      function () {
+        UtilsWX.lookRankList(false)
+      }.bind(this),
+      200
+    )
+  },
+  //转盘界面
+  onButtonEvent_Luck_OPen() {
+    this.onHideMenu()
+    this.onSetTouchStatus(this.LuckView, true)
+    if (this.nodePrefabsLuck != null) {
+      task.removeNode(this.nodePrefabsLuck)
+    }
+  },
+  isTask: function (obj) {
+    var Canvas = cc.find('Canvas/UICamera')
+    UtilsPrefabs.init(Canvas).addPrefabs(
+      UtilsPrefabs.sharePrefab[1],
+      null,
+      function (node) {
+        var gosharebtn = UtilsPrefabs.getNode('gosharebtn', node)
+
+        var close = UtilsPrefabs.getNode('close', node)
+        UtilsPrefabs.setOn(
+          close,
+          function () {
+            UtilsPrefabs.removePrefabs(Canvas, node.name)
+            if (task.TaskIconCountClick == 5) {
+              if (obj.currentTarget.name == 'GetGift') {
+                task.addTaskIconCountClick()
+                task.removeTaskNodes()
+              }
+            }
+          }.bind(this)
+        )
+
+        UtilsPrefabs.setOn(
+          gosharebtn,
+          function () {
+            // console.log("点击分享按钮");
+
+            UtilsWX.sharebtn(
+              function () {
+                UtilsPrefabs.setOff(gosharebtn)
+                GlobalD.GameData.PlusGolden(GlobalD.GameData.shareGive[0])
+                GlobalD.GameData.PlusDiamond(GlobalD.GameData.shareGive[1])
+                if (task.TaskIconCountClick == 5) {
+                  if (obj.currentTarget.name == 'GetGift') {
+                    task.addTaskIconCountClick()
+                    task.removeTaskNodes()
+                  }
+                }
+              }.bind(this)
+            )
+            UtilsPrefabs.removePrefabs(Canvas, node.name)
+          }.bind(this)
+        )
+      }.bind(this)
+    )
+  },
+  isTask4: function () {
+    if (task.TaskIconCountClick == 4) {
+      task.addTaskIconCountClick()
+      task.removeTaskNodes()
+    }
+  },
+  onButtonEvent_Luck_Close(obj) {
+    // console.log("现在是谁点的", obj);
+    let Wheel = this.LuckView.getChildByName('Wheel').getComponent('Wheel')
+    Wheel.node.active = true
+    Wheel.ShowRewards.active = false
 
-            task.removeTaskNode(task.taskCursorName[4]);
-            task.addTaskTips(EveryDaySign, task.taskPrefab[1], 20, -470, task.taskCursorName[4], function (nodePrefabs) {
+    this.onSetTouchStatus(this.LuckView, false)
 
-            }.bind(this));
+    if (obj.target.name == 'GetGift') {
+      this.isTask(obj)
+    }
+  },
+  onButtonEvent_EveryDay_OPen() {
+    this.onHideMenu()
+    this.onSetTouchStatus(this.EveryDaySignView, true)
+    //打开每日签到 外面的按钮
+    if (task.TaskIconCountClick == 4) {
+      var EveryDaySign = cc.find(
+        'Canvas/UICamera/OverTheMask/EveryDaySignContainer/EveryDaySignView'
+      )
+      // var Canvas = cc.find("Canvas/UICamera");
+      // task.removeTaskNodes();
+
+      task.removeTaskNode(task.taskCursorName[4])
+      task.addTaskTips(
+        EveryDaySign,
+        task.taskPrefab[1],
+        20,
+        -470,
+        task.taskCursorName[4],
+        function (nodePrefabs) {}.bind(this)
+      )
+    }
+  },
+  onButtonEvent_EveryDay_Close() {
+    this.onSetTouchStatus(this.EveryDaySignView, false)
+  },
+  onShowRewards: function (Index) {
+    let ManageBuildingScript = this.node.getComponent('ManageBuildings')
+    console.log('走了吗', Index)
+
+    let GivePrize = this.ShowRewards.getChildByName('GivePrize')
+    let Rewards = GivePrize.getChildByName('Rewards')
+
+    Rewards.getComponent(cc.Sprite).spriteFrame = this.BuildingFrameArray[
+      Index
+    ].getChildByName('New Sprite(Splash)').getComponent(cc.Sprite).spriteFrame
+
+    //开始播放
+    var Sunshine =
+      this.ShowRewards.getChildByName('GivePrize').getChildByName('Sunshine')
+    Sunshine.scaleX = 0
+    Sunshine.scaleY = 0
+    GivePrize.scaleX = 0
+    GivePrize.scaleY = 0
+    Sunshine.stopAllActions()
+    GivePrize.stopAllActions()
+    this.scheduleOnce(function () {
+      this.ShowRewards.opacity = 255
+      this.ShowRewards.active = true
+      var sc2 = cc.scaleTo(1, 0.5, 0.5)
+      Sunshine.runAction(sc2)
+      var sc3 = cc.scaleTo(1, 1, 1)
+      GivePrize.runAction(sc3)
+
+      var repeat = cc.repeatForever(cc.rotateBy(5.0, 360))
+      Sunshine.runAction(repeat)
+    }, 0.1)
+  },
+  onCloseShowRewards: function () {
+    this.ShowRewards.active = false
+  },
+
+  DiamondGapViewShow: function () {
+    this.DiamondGapView.active = true
+  },
+  GoldenChangeCallBack: function (Num, LastMoney, CurrentMoney) {
+    let Scale = 30
+    let Index = -1
+    // if(Num>10*Scale)
+    // {
+    //     Index = 7;//伐木场
+    // }
+    // if(Num>30*Scale)
+    // {
+    //     Index = 8;//矿坑
+    // }
+
+    // if(Num>70*Scale)
+    // {
+    //     // Index = 9;//加工厂
+    // }
+
+    // if(Num>350*Scale && Num<450*Scale)
+    // {
+    //     Index = 4;//单元楼
+    // }
+    if (Num > 4000 && Num < 4500) {
+      Index = 4 //单元楼
+    }
+    // else if(Num>450*Scale && Num<550*Scale)
+    // {
+    //     Index = 11;//鲜花店
+    // }
+    else if (Num > 4500 && Num < 5500) {
+      Index = 11 //鲜花店
+    } else if (Num > 550 * Scale && Num < 650 * Scale) {
+      Index = 12 //甜品店
+    }
+    if (Num > 650 * Scale && Num < 750 * Scale) {
+      Index = 7 //伐木场
+    } else if (Num > 750 * Scale && Num < 950 * Scale) {
+      Index = 13 //汉堡店
+    }
+    // else if(Num>850*Scale)
+    // {
+    //     Index = 0;//公路
+    // }
+    else if (Num > 950 * Scale && Num < 1050 * Scale) {
+      Index = 14 //咖啡店
+    } else if (Num > 1050 * Scale && Num < 1150 * Scale) {
+      Index = 5 //别墅
+    } else if (Num > 1150 * Scale && Num < 1250 * Scale) {
+      Index = 15 //洋装店
+    }
+    if (Num > 1250 * Scale && Num < 1350 * Scale) {
+      Index = 8 //矿坑
+    } else if (Num > 1350 * Scale) {
+      Index = 16 //酒吧
+    }
+    // else if(Num>250*Scale)
+    // {
+    //     Index = 4;//单元楼
+    // }
+    // else if(Num>600*Scale)
+    // {
+    //     Index = 5;//别墅
+    // }
+
+    var BuildingStateArray = GlobalD.GameData.GetBuildingStateArray()
+    if (Index == 0) {
+      if (BuildingStateArray[Index] != 1) {
+        BuildingStateArray[0] = 1 //公路
+        BuildingStateArray[1] = 1 //路铲
+        BuildingStateArray[2] = 1 //拆迁
+
+        let Building0 =
+          this.node.getComponent('ManageBuildings').BuildingArray[0]
+        let Building1 =
+          this.node.getComponent('ManageBuildings').BuildingArray[1]
+        let Building2 =
+          this.node.getComponent('ManageBuildings').BuildingArray[2]
+        Building0.active = true
+        Building1.active = true
+        Building2.active = true
+
+        GlobalD.GameData.SetBuildingStateArray(BuildingStateArray)
+        this.onShowRewards(Index)
+      }
+    } else {
+      if (BuildingStateArray[Index] != 1 && Index != -1) {
+        cc.log('Index=' + Index)
+        BuildingStateArray[Index] = 1
+        let Building =
+          this.node.getComponent('ManageBuildings').BuildingArray[Index]
+        Building.active = true
+
+        GlobalD.GameData.SetBuildingStateArray(BuildingStateArray)
+        this.onShowRewards(Index)
+      }
+    }
 
+    let Diff = CurrentMoney - LastMoney
+    let InitMoneyNum = LastMoney
+    let AnimTimes = 0
+    let Times = 3
+    this.schedule(
+      function () {
+        if (Diff > 0) {
+          InitMoneyNum += parseInt((CurrentMoney - LastMoney) / Times)
+        } else {
+          InitMoneyNum -= parseInt((CurrentMoney - LastMoney) / Times)
         }
-    },
-    onButtonEvent_EveryDay_Close() {
-        this.onSetTouchStatus(this.EveryDaySignView, false);
-    },
-    onShowRewards: function (Index) {
-        let ManageBuildingScript = this.node.getComponent('ManageBuildings');
-        console.log("走了吗", Index);
-
-        let GivePrize = this.ShowRewards.getChildByName('GivePrize');
-        let Rewards = GivePrize.getChildByName('Rewards');
-
-        Rewards.getComponent(cc.Sprite).spriteFrame = this.BuildingFrameArray[Index].getChildByName('New Sprite(Splash)').getComponent(cc.Sprite).spriteFrame;
-
-        //开始播放
-        var Sunshine = this.ShowRewards.getChildByName('GivePrize').getChildByName('Sunshine');
-        Sunshine.scaleX = 0;
-        Sunshine.scaleY = 0;
-        GivePrize.scaleX = 0;
-        GivePrize.scaleY = 0;
-        Sunshine.stopAllActions();
-        GivePrize.stopAllActions();
-        this.scheduleOnce(function () {
-            this.ShowRewards.opacity = 255;
-            this.ShowRewards.active = true;
-            var sc2 = cc.scaleTo(1, 0.5, 0.5);
-            Sunshine.runAction(sc2);
-            var sc3 = cc.scaleTo(1, 1, 1);
-            GivePrize.runAction(sc3);
-
-
-            var repeat = cc.repeatForever(cc.rotateBy(5.0, 360));
-            Sunshine.runAction(repeat);
-        }, 0.1);
-    },
-    onCloseShowRewards: function () {
-        this.ShowRewards.active = false;
 
-    },
-
-    GoldenChangeCallBack: function (Num, LastMoney, CurrentMoney) {
-        let Scale = 30;
-        let Index = -1;
-        // if(Num>10*Scale)
-        // {
-        //     Index = 7;//伐木场
-        // }
-        // if(Num>30*Scale)
-        // {
-        //     Index = 8;//矿坑
-        // }
-
-        // if(Num>70*Scale)
-        // {
-        //     // Index = 9;//加工厂
-        // }
-
-        // if(Num>350*Scale && Num<450*Scale)
-        // {
-        //     Index = 4;//单元楼
-        // }
-        if (Num > 4000 && Num < 4500) {
-            Index = 4;//单元楼
-        }
-        // else if(Num>450*Scale && Num<550*Scale)
-        // {
-        //     Index = 11;//鲜花店
-        // }
-        else if (Num > 4500 && Num < 5500) {
-            Index = 11;//鲜花店
-        } else if (Num > 550 * Scale && Num < 650 * Scale) {
-            Index = 12;//甜品店
-        }
-        if (Num > 650 * Scale && Num < 750 * Scale) {
-            Index = 7;//伐木场
-        } else if (Num > 750 * Scale && Num < 950 * Scale) {
-            Index = 13;//汉堡店
-        }
-        // else if(Num>850*Scale)
-        // {
-        //     Index = 0;//公路
-        // }
-        else if (Num > 950 * Scale && Num < 1050 * Scale) {
-            Index = 14;//咖啡店
-        } else if (Num > 1050 * Scale && Num < 1150 * Scale) {
-            Index = 5;//别墅
-        } else if (Num > 1150 * Scale && Num < 1250 * Scale) {
-            Index = 15;//洋装店
+        let result = this.FormatMoney(InitMoneyNum)
+        if (AnimTimes == Times - 1) {
+          this.Goldenlabel.getComponent(cc.Label).string =
+            this.FormatMoney(CurrentMoney)
+          return
         }
-        if (Num > 1250 * Scale && Num < 1350 * Scale) {
-            Index = 8;//矿坑
-        } else if (Num > 1350 * Scale) {
-            Index = 16;//酒吧
-        }
-        // else if(Num>250*Scale)
-        // {
-        //     Index = 4;//单元楼
-        // }
-        // else if(Num>600*Scale)
-        // {
-        //     Index = 5;//别墅
-        // }
-
-        var BuildingStateArray = GlobalD.GameData.GetBuildingStateArray();
-        if (Index == 0) {
-            if (BuildingStateArray[Index] != 1) {
-                BuildingStateArray[0] = 1;//公路
-                BuildingStateArray[1] = 1;//路铲
-                BuildingStateArray[2] = 1;//拆迁
-
-                let Building0 = this.node.getComponent('ManageBuildings').BuildingArray[0];
-                let Building1 = this.node.getComponent('ManageBuildings').BuildingArray[1];
-                let Building2 = this.node.getComponent('ManageBuildings').BuildingArray[2];
-                Building0.active = true;
-                Building1.active = true;
-                Building2.active = true;
-
-                GlobalD.GameData.SetBuildingStateArray(BuildingStateArray);
-                this.onShowRewards(Index);
-            }
+        this.Goldenlabel.getComponent(cc.Label).string = result
+        AnimTimes++
+      },
+      0.05,
+      Times
+    )
+  },
+  DiamondChangeCallBack: function (Num, LastMoney, CurrentMoney) {
+    let Diff = CurrentMoney - LastMoney
+    let InitMoneyNum = LastMoney
+    let AnimTimes = 0
+    let Times = 3
+    this.schedule(
+      function () {
+        if (Diff > 0) {
+          InitMoneyNum += parseInt((CurrentMoney - LastMoney) / Times)
         } else {
-            if (BuildingStateArray[Index] != 1 && Index != -1) {
-                cc.log('Index=' + Index);
-                BuildingStateArray[Index] = 1;
-                let Building = this.node.getComponent('ManageBuildings').BuildingArray[Index];
-                Building.active = true;
-
-                GlobalD.GameData.SetBuildingStateArray(BuildingStateArray);
-                this.onShowRewards(Index);
-            }
+          InitMoneyNum -= parseInt((CurrentMoney - LastMoney) / Times)
         }
 
+        let result = this.FormatMoney(InitMoneyNum)
+        if (AnimTimes == Times - 1) {
+          this.DiamondNowlabel.string = result + '/30000'
+          this.Diamondlabel.getComponent(cc.Label).string =
+            this.FormatMoney(CurrentMoney)
 
-        let Diff = CurrentMoney - LastMoney;
-        let InitMoneyNum = LastMoney;
-        let AnimTimes = 0;
-        let Times = 3;
-        this.schedule(function () {
-            if (Diff > 0) {
-                InitMoneyNum += parseInt((CurrentMoney - LastMoney) / Times);
-            } else {
-                InitMoneyNum -= parseInt((CurrentMoney - LastMoney) / Times);
-            }
-
-            let result = this.FormatMoney(InitMoneyNum);
-            if (AnimTimes == Times - 1) {
-                this.Goldenlabel.getComponent(cc.Label).string = this.FormatMoney(CurrentMoney);
-                return;
-            }
-            this.Goldenlabel.getComponent(cc.Label).string = result;
-            AnimTimes++;
-        }, 0.05, Times);
-    },
-    DiamondChangeCallBack: function (Num, LastMoney, CurrentMoney) {
-        let Diff = CurrentMoney - LastMoney;
-        let InitMoneyNum = LastMoney;
-        let AnimTimes = 0;
-        let Times = 3;
-        this.schedule(function () {
-            if (Diff > 0) {
-                InitMoneyNum += parseInt((CurrentMoney - LastMoney) / Times);
-            } else {
-                InitMoneyNum -= parseInt((CurrentMoney - LastMoney) / Times);
-            }
-
-            let result = this.FormatMoney(InitMoneyNum);
-            if (AnimTimes == Times - 1) {
-                this.Diamondlabel.getComponent(cc.Label).string = this.FormatMoney(CurrentMoney);
-                return;
-            }
-            this.Diamondlabel.getComponent(cc.Label).string = result;
-            AnimTimes++;
-        }, 0.05, Times);
-    },
-
-    CNTChangeCallBack: function (Num) {
-        this.CNTlabel.getComponent(cc.Label).string = this.FormatMoney(Num);
-    },
-    SNBChangeCallBack: function (Num) {
-        this.SNBlabel.getComponent(cc.Label).string = this.FormatMoney(Num);
-    },
-
-    FormatMoney(s, n) {
-        n = n > 0 && n <= 20 ? n : 2;
-        s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + "";
-        var l = s.split(".")[0].split("").reverse(),
-            r = s.split(".")[1];
-        let t = "";
-        for (let i = 0; i < l.length; i++) {
-            t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "");
+          return
         }
-        return t.split("").reverse().join(""); //+ "." + r;
+        this.DiamondNowlabel.string = result + '/20000'
+        this.Diamondlabel.getComponent(cc.Label).string = result
+        AnimTimes++
+      },
+      0.05,
+      Times
+    )
+  },
+
+  CNTChangeCallBack: function (Num) {
+    this.CNTlabel.getComponent(cc.Label).string = this.FormatMoney(Num)
+  },
+  SNBChangeCallBack: function (Num) {
+    this.SNBlabel.getComponent(cc.Label).string = this.FormatMoney(Num)
+  },
+
+  FormatMoney(s, n) {
+    n = n > 0 && n <= 20 ? n : 2
+    s = parseFloat((s + '').replace(/[^\d\.-]/g, '')).toFixed(n) + ''
+    var l = s.split('.')[0].split('').reverse(),
+      r = s.split('.')[1]
+    let t = ''
+    for (let i = 0; i < l.length; i++) {
+      t += l[i] + ((i + 1) % 3 == 0 && i + 1 != l.length ? ',' : '')
     }
-});
+    return t.split('').reverse().join('') //+ "." + r;
+  },
+})

+ 2 - 1
settings/project.json

@@ -38,5 +38,6 @@
     "width": 960
   },
   "use-customize-simulator": true,
-  "use-project-simulator-setting": false
+  "use-project-simulator-setting": false,
+  "start-scene": "current"
 }

部分文件因为文件数量过多而无法显示