Bladeren bron

增加杂货铺脚本

kaka 4 jaren geleden
bovenliggende
commit
0750bca63a

+ 12 - 0
assets/res/game/ani/mainScene.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "096ef00c-5d62-4fd4-a4f3-073088a3305a",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 139 - 0
assets/res/game/ani/mainScene/fountain.anim

@@ -0,0 +1,139 @@
+{
+  "__type__": "cc.AnimationClip",
+  "_name": "fountain",
+  "_objFlags": 0,
+  "_native": "",
+  "_duration": 1.6,
+  "sample": 60,
+  "speed": 1,
+  "wrapMode": 2,
+  "curveData": {
+    "comps": {
+      "cc.Sprite": {
+        "spriteFrame": [
+          {
+            "frame": 0,
+            "value": {
+              "__uuid__": "4effeb62-066d-40b3-992f-9c6e0cbfb9ed@6c48a"
+            }
+          },
+          {
+            "frame": 0.08333333333333333,
+            "value": {
+              "__uuid__": "addf8e85-7543-4435-ad5b-a9d8f35f01d3@6c48a"
+            }
+          },
+          {
+            "frame": 0.16666666666666666,
+            "value": {
+              "__uuid__": "4ee8eb34-175a-4799-b577-994184b5cc35@6c48a"
+            }
+          },
+          {
+            "frame": 0.25,
+            "value": {
+              "__uuid__": "33367d74-4dd5-4af6-a5fe-c545f404698a@6c48a"
+            }
+          },
+          {
+            "frame": 0.3333333333333333,
+            "value": {
+              "__uuid__": "03bba11e-0c27-45bb-86ae-71a6c5e12a45@6c48a"
+            }
+          },
+          {
+            "frame": 0.4166666666666667,
+            "value": {
+              "__uuid__": "db5dddd8-06da-49a8-ba0c-057d1fb555ce@6c48a"
+            }
+          },
+          {
+            "frame": 0.5,
+            "value": {
+              "__uuid__": "440e5a3d-6546-4809-8d91-3cde32671919@6c48a"
+            }
+          },
+          {
+            "frame": 0.5833333333333334,
+            "value": {
+              "__uuid__": "1c97f462-e8dd-4c2f-9833-88dcaa551514@6c48a"
+            }
+          },
+          {
+            "frame": 0.6666666666666666,
+            "value": {
+              "__uuid__": "fbd49342-c41b-46bc-a5ae-493883bdd8f2@6c48a"
+            }
+          },
+          {
+            "frame": 0.75,
+            "value": {
+              "__uuid__": "6e7a7f76-a366-45b8-b59a-ebf3768671f5@6c48a"
+            }
+          },
+          {
+            "frame": 0.8333333333333334,
+            "value": {
+              "__uuid__": "9f7872a4-b014-4cf8-8224-29273140164b@6c48a"
+            }
+          },
+          {
+            "frame": 0.9166666666666666,
+            "value": {
+              "__uuid__": "d0444ae9-acf6-411e-afba-26951e39a844@6c48a"
+            }
+          },
+          {
+            "frame": 1,
+            "value": {
+              "__uuid__": "d51c29e4-f617-49dd-b105-ecbc81a05e2e@6c48a"
+            }
+          },
+          {
+            "frame": 1.0833333333333333,
+            "value": {
+              "__uuid__": "7ce2cc17-6af4-420a-b826-07f546bbb641@6c48a"
+            }
+          },
+          {
+            "frame": 1.1666666666666667,
+            "value": {
+              "__uuid__": "c7a9e68c-c714-40a0-800c-db1010aba15e@6c48a"
+            }
+          },
+          {
+            "frame": 1.25,
+            "value": {
+              "__uuid__": "e0ea8658-ec9b-47fa-9c3e-7674e16d020a@6c48a"
+            }
+          },
+          {
+            "frame": 1.3333333333333333,
+            "value": {
+              "__uuid__": "270a4512-60c8-48c6-99e5-5fecf76ca5af@6c48a"
+            }
+          },
+          {
+            "frame": 1.4166666666666667,
+            "value": {
+              "__uuid__": "d5e62433-bf00-4415-916a-d327f82c53dc@6c48a"
+            }
+          },
+          {
+            "frame": 1.5,
+            "value": {
+              "__uuid__": "4ac92d37-80d2-468f-8a7b-619b4002bc9d@6c48a"
+            }
+          },
+          {
+            "frame": 1.5833333333333333,
+            "value": {
+              "__uuid__": "505b83d3-dc18-4e26-8824-577f9e5b5fb2@6c48a"
+            }
+          }
+        ]
+      }
+    }
+  },
+  "events": []
+}

+ 5 - 0
assets/res/game/ani/mainScene/fountain.anim.meta

@@ -0,0 +1,5 @@
+{
+  "ver": "2.1.0",
+  "uuid": "f62225e2-b0b7-45ec-bd95-96a8668c025b",
+  "subMetas": {}
+}

File diff suppressed because it is too large
+ 302 - 302
assets/resources/game/coregame/coregame.prefab


+ 2 - 2
assets/resources/game/texture/main/bg_assets.png.meta

@@ -7,8 +7,8 @@
   "premultiplyAlpha": false,
   "genMipmaps": false,
   "packable": true,
-  "width": 129,
-  "height": 28,
+  "width": 163,
+  "height": 40,
   "platformSettings": {},
   "subMetas": {
     "bg_assets": {

+ 1 - 1
assets/resources/module/gradeReward/texture/name2.png.meta

@@ -7,7 +7,7 @@
   "premultiplyAlpha": false,
   "genMipmaps": false,
   "packable": true,
-  "width": 152,
+  "width": 153,
   "height": 44,
   "platformSettings": {},
   "subMetas": {

+ 1 - 1
assets/resources/module/inviteFriends/texture/tabbar_in_bg.png.meta

@@ -8,7 +8,7 @@
   "genMipmaps": false,
   "packable": true,
   "width": 80,
-  "height": 130,
+  "height": 117,
   "platformSettings": {},
   "subMetas": {
     "tabbar_in_bg": {

+ 2 - 2
assets/resources/module/pigBank/texture/close.png.meta

@@ -7,8 +7,8 @@
   "premultiplyAlpha": false,
   "genMipmaps": false,
   "packable": true,
-  "width": 88,
-  "height": 88,
+  "width": 82,
+  "height": 87,
   "platformSettings": {},
   "subMetas": {
     "close": {

+ 2 - 2
assets/resources/module/sign/texture/bg.png.meta

@@ -7,8 +7,8 @@
   "premultiplyAlpha": false,
   "genMipmaps": false,
   "packable": true,
-  "width": 170,
-  "height": 190,
+  "width": 127,
+  "height": 166,
   "platformSettings": {},
   "subMetas": {
     "bg": {

+ 2 - 2
assets/resources/module/sign/texture/bg_guang.png.meta

@@ -7,8 +7,8 @@
   "premultiplyAlpha": false,
   "genMipmaps": false,
   "packable": true,
-  "width": 161,
-  "height": 150,
+  "width": 126,
+  "height": 126,
   "platformSettings": {},
   "subMetas": {
     "bg_guang": {

+ 2 - 2
assets/resources/module/sign/texture/bg_hb.png.meta

@@ -7,8 +7,8 @@
   "premultiplyAlpha": false,
   "genMipmaps": false,
   "packable": true,
-  "width": 81,
-  "height": 102,
+  "width": 60,
+  "height": 70,
   "platformSettings": {},
   "subMetas": {
     "bg_hb": {

+ 2 - 2
assets/resources/module/sign/texture/button.png.meta

@@ -7,8 +7,8 @@
   "premultiplyAlpha": false,
   "genMipmaps": false,
   "packable": true,
-  "width": 328,
-  "height": 137,
+  "width": 283,
+  "height": 112,
   "platformSettings": {},
   "subMetas": {
     "button": {

+ 2 - 2
assets/resources/module/sign/texture/button_tv.png.meta

@@ -7,8 +7,8 @@
   "premultiplyAlpha": false,
   "genMipmaps": false,
   "packable": true,
-  "width": 42,
-  "height": 44,
+  "width": 57,
+  "height": 62,
   "platformSettings": {},
   "subMetas": {
     "button_tv": {

+ 2 - 2
assets/resources/module/sign/texture/popup1.png.meta

@@ -7,8 +7,8 @@
   "premultiplyAlpha": false,
   "genMipmaps": false,
   "packable": true,
-  "width": 528,
-  "height": 123,
+  "width": 212,
+  "height": 110,
   "platformSettings": {},
   "subMetas": {
     "popup1": {

+ 2 - 2
assets/resources/module/sign/texture/popup2.png.meta

@@ -7,8 +7,8 @@
   "premultiplyAlpha": false,
   "genMipmaps": false,
   "packable": true,
-  "width": 656,
-  "height": 717,
+  "width": 588,
+  "height": 831,
   "platformSettings": {},
   "subMetas": {
     "popup2": {

+ 1 - 1
assets/resources/module/sign/texture/title.png.meta

@@ -7,7 +7,7 @@
   "premultiplyAlpha": false,
   "genMipmaps": false,
   "packable": true,
-  "width": 166,
+  "width": 106,
   "height": 49,
   "platformSettings": {},
   "subMetas": {

+ 47 - 0
assets/script/before/main/FactoryCountDown.ts

@@ -0,0 +1,47 @@
+import Util from "../util/Util";
+
+const { ccclass, property } = cc._decorator;
+
+@ccclass
+export class FactoryCountDown extends cc.Component {
+    @property({ tooltip: "配置ID" }) configID: number = 0;
+    @property({ type: cc.Component.EventHandler, tooltip: "商品制作完成时的回调" }) onComplete: cc.Component.EventHandler = null;
+    public progress: number = 0;
+    public timerString: string = "";
+
+    private config: any;
+    async start() {
+        this.config = gData.configData.configMap.get("product");
+    }
+
+    update() {
+        let producting = gData.gameData.getProductingList(this.configID);
+        let now = Date.now();
+        if (producting.length > 0 && this.config) {
+            let totleTime = this.config[producting[0].productID]["time"];
+            if (producting[0].ripeDate > now) {
+                this.progress = 1 - ((producting[0].ripeDate - now) / (totleTime * 1000));
+                this.timerString = Util.formatCountDown(producting[0].ripeDate - now);
+            } else {
+                this.onComplete && this.onComplete.emit([producting[0].productID]);
+                gData.gameData.getProductingList(this.configID).shift();
+            }
+        }
+    }
+
+    public async ripe() {
+        let producting = gData.gameData.getProductingList(this.configID);
+        this.onComplete && this.onComplete.emit([producting[0].productID]);
+        let build = gData.configData.configMap.get("build");
+        if (build[this.configID]["sequence"] == 1) {
+            let lastTime = producting[0].ripeDate - Date.now();
+            gData.gameData.getProductingList(this.configID).shift();
+            for (let i = 0; i < gData.gameData.getProductingList(this.configID).length; i++) {
+                gData.gameData.getProductingList(this.configID)[i].ripeDate -= lastTime;
+            }
+        } else {
+            gData.gameData.getProductingList(this.configID).shift();
+        }
+    }
+}
+

+ 9 - 0
assets/script/before/main/FactoryCountDown.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "d6a932d2-9ce3-4e9e-a4a5-b17badb23743",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 97 - 0
assets/script/before/main/MapIcon.ts

@@ -0,0 +1,97 @@
+import { FactoryCountDown } from "./FactoryCountDown";
+
+const { ccclass, property } = cc._decorator;
+
+
+export enum FactroyState {
+    Lock,
+    Producting,
+    Free
+}
+
+@ccclass
+export class MapIcon extends cc.Component {
+    @property({ tooltip: "点击是否缩放动画" }) touchAmition: boolean = true;
+    @property({ type: cc.Animation, tooltip: "点击动画" }) animation: cc.Animation = null;
+    @property({ type: cc.Node, tooltip: "建筑状态组" }) stateGroup: cc.Node = null;
+    @property({ type: cc.Node, tooltip: "完成品展示节点" }) showGroup: cc.Node = null;
+    @property({ tooltip: "配置ID" }) configID: number = 0;
+    @property({ type: FactoryCountDown, tooltip: "计时装置" }) countDown: FactoryCountDown = null;
+
+    private _state = FactroyState.Lock;
+    private hasActive = false;
+
+    private havrestList: { id: number, node: Node }[] = [];
+    start() {
+        if (gData.gameData.hasBuildData(this.configID)) {
+            this.activeFactroy();
+        }
+    }
+
+    update() {
+        if (this._state == FactroyState.Lock && gData.gameData.hasBuildData(this.configID)) {
+            this.activeFactroy();
+        }
+        let producting = gData.gameData.getProductingList(this.configID);
+        if (producting.length > 0) {
+            this.setState(FactroyState.Producting);
+        } else {
+            this.setState(FactroyState.Free);
+        }
+    }
+
+    public activeFactroy(): void {
+        this.hasActive = true;
+    }
+
+    public async inPolygon() {
+        // (this.touchAmition && this.animation) && this.animation.play();
+        // var sound = this.getComponent(Sound);
+        // sound && sound.play();
+        // if (this._state != FactroyState.Lock) {
+        //     if (this.havrestList.length == 0) {
+        //         this.getComponent(OpenWindow).open(this.configID, this.countDown);
+        //     } else {
+        //         WindowManager.open("Prefabs/HarvestWindow", WindowOpenMode.CloseAndCover, this.configID, this.onHarvest.bind(this));
+        //     }
+        // } else {
+        //     let lvl = ConfigData.configMap.get("build")[this.configID]["lvl"];
+        //     WindowManager.showTips(`${lvl}级解锁`);
+        // }
+    }
+    /**生产完成回调 */
+    public async onProductComplete(id: number) {
+        // if (this.showGroup) {
+        //     let prefab = await ResourcesUtils.load<Prefab>("Prefabs/ProductShow", null, this.node);
+        //     let item = instantiate(prefab);
+        //     item.getComponent(ProductShow).id = id;
+        //     item.setParent(this.showGroup);
+        //     let x = Utils.random_both(-this.showGroup.getComponent(UITransform).width / 2, this.showGroup.getComponent(UITransform).width / 2);
+        //     let y = Utils.random_both(-this.showGroup.getComponent(UITransform).height / 2, this.showGroup.getComponent(UITransform).height / 2);
+        //     item.setPosition(v3(x, y, 0));
+        //     this.havrestList.push({ id: id, node: item });
+        // }
+    }
+
+    public clean(): void {
+        this.showGroup.removeAllChildren();
+        this.havrestList = [];
+    }
+
+    private onHarvest(mult: number): void {
+        // this.havrestList.shift().node.destroy();
+    }
+
+    private setState(value: FactroyState): void {
+        if (this.hasActive) {
+            if (this._state != value) {
+                this._state = value;
+                if (this._state == FactroyState.Producting) {
+                    this.stateGroup && (this.stateGroup.active = true);
+                } else {
+                    this.stateGroup && (this.stateGroup.active = false);
+                }
+            }
+        }
+    }
+}

+ 9 - 0
assets/script/before/main/MapIcon.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "73dd9294-a1aa-4287-9cb1-f92b5793606f",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

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