From c7a9a8da6f80c6d575958d2f1eb6786c229a5c6e Mon Sep 17 00:00:00 2001 From: yangqiwen <494909017@qq.com> Date: Sat, 8 Feb 2025 11:40:46 +0800 Subject: [PATCH] 1 --- assets/FrameWork/Event/EventEnum.ts | 1 + assets/JieDao.meta | 18 +- assets/JieDao/prefab/JieDao.prefab | 29 +- assets/JieDao/prefab/JieDaoItemNode.prefab | 479 ++++++++++++++++--- assets/JieDao/res/加成框.png.meta | 8 +- assets/MainHall/prefab/MainHall.prefab | 2 +- assets/Scripts/JieDao/JieDao.ts | 90 ++-- assets/Scripts/JieDao/JieDaoItemNode.ts | 86 ++-- assets/Scripts/MainHall/MainHallBtn.ts | 2 +- assets/Scripts/Manager/JieDaoManager.ts | 48 +- assets/Scripts/PrefabManager/PrefabManage.ts | 4 + 11 files changed, 590 insertions(+), 177 deletions(-) diff --git a/assets/FrameWork/Event/EventEnum.ts b/assets/FrameWork/Event/EventEnum.ts index 74993d4b..380fdc1b 100644 --- a/assets/FrameWork/Event/EventEnum.ts +++ b/assets/FrameWork/Event/EventEnum.ts @@ -382,6 +382,7 @@ export enum ryw_Event { reborn = 4321, updateZuanShi = 4322, freshGuanQiaProgress = 4323, + RefreshJieDao = 4324, //找茬1209密码 Check1209Mima = 9004, Check1303Mima = 9005, diff --git a/assets/JieDao.meta b/assets/JieDao.meta index d1ef026b..daffb936 100644 --- a/assets/JieDao.meta +++ b/assets/JieDao.meta @@ -2,12 +2,20 @@ "ver": "1.1.3", "uuid": "5e067ac9-939d-42e6-8aeb-82b30837f088", "importer": "folder", - "isBundle": false, + "isBundle": true, "bundleName": "", "priority": 1, - "compressionType": {}, - "optimizeHotUpdate": {}, - "inlineSpriteFrames": {}, - "isRemoteBundle": {}, + "compressionType": { + "bytedance": "zip" + }, + "optimizeHotUpdate": { + "bytedance": false + }, + "inlineSpriteFrames": { + "bytedance": false + }, + "isRemoteBundle": { + "bytedance": true + }, "subMetas": {} } \ No newline at end of file diff --git a/assets/JieDao/prefab/JieDao.prefab b/assets/JieDao/prefab/JieDao.prefab index bb8a9ae7..51abd309 100644 --- a/assets/JieDao/prefab/JieDao.prefab +++ b/assets/JieDao/prefab/JieDao.prefab @@ -867,8 +867,12 @@ "__id__": 14 }, "_enabled": true, - "_normalMaterial": null, - "_grayMaterial": null, + "_normalMaterial": { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + }, + "_grayMaterial": { + "__uuid__": "3a7bb79f-32fd-422e-ada2-96f518fed422" + }, "duration": 0.1, "zoomScale": 1.2, "clickEvents": [ @@ -877,7 +881,7 @@ } ], "_N$interactable": true, - "_N$enableAutoGrayEffect": false, + "_N$enableAutoGrayEffect": true, "_N$transition": 0, "transition": 0, "_N$normalColor": { @@ -991,14 +995,14 @@ }, "_anchorPoint": { "__type__": "cc.Vec2", - "x": 0, + "x": 0.5, "y": 1 }, "_trs": { "__type__": "TypedArray", "ctor": "Float64Array", "array": [ - -215.6, + 0, 354.843, 0, 0, @@ -1059,7 +1063,7 @@ }, "_anchorPoint": { "__type__": "cc.Vec2", - "x": 0, + "x": 0.5, "y": 1 }, "_trs": { @@ -1119,11 +1123,11 @@ "_contentSize": { "__type__": "cc.Size", "width": 430, - "height": 120 + "height": 300 }, "_anchorPoint": { "__type__": "cc.Vec2", - "x": 0, + "x": 0.5, "y": 1 }, "_trs": { @@ -1166,7 +1170,7 @@ "_layoutSize": { "__type__": "cc.Size", "width": 430, - "height": 120 + "height": 300 }, "_resize": 1, "_N$layoutType": 2, @@ -1264,7 +1268,7 @@ "templateType": 2, "tmpNode": null, "tmpPrefab": { - "__uuid__": "3a9f2446-bae7-4177-baa4-caea4f8e179c" + "__uuid__": "25c9e667-0138-4193-896b-52781ac0466e" }, "_slideMode": 1, "pageDistance": 0.3, @@ -1301,7 +1305,7 @@ "__id__": 1 }, "component": "", - "_componentId": "75c5b49oGhDFr34RZFvQCFc", + "_componentId": "056b2mudoVAGLwO/JMSOJuR", "handler": "onListMGridRender", "customEventData": "" }, @@ -1382,6 +1386,9 @@ "item": { "__uuid__": "25c9e667-0138-4193-896b-52781ac0466e" }, + "levelUpMoney": { + "__id__": 19 + }, "listCJ": { "__id__": 34 }, diff --git a/assets/JieDao/prefab/JieDaoItemNode.prefab b/assets/JieDao/prefab/JieDaoItemNode.prefab index 30a600a9..c2df4ffa 100644 --- a/assets/JieDao/prefab/JieDaoItemNode.prefab +++ b/assets/JieDao/prefab/JieDaoItemNode.prefab @@ -24,29 +24,32 @@ "__id__": 5 }, { - "__id__": 8 + "__id__": 11 }, { - "__id__": 11 + "__id__": 14 }, { - "__id__": 18 + "__id__": 22 }, { - "__id__": 24 + "__id__": 29 }, { - "__id__": 27 + "__id__": 32 + }, + { + "__id__": 37 } ], "_active": true, "_components": [ { - "__id__": 30 + "__id__": 40 } ], "_prefab": { - "__id__": 31 + "__id__": 41 }, "_opacity": 255, "_color": { @@ -70,8 +73,8 @@ "__type__": "TypedArray", "ctor": "Float64Array", "array": [ - 300, - -60, + 0, + 0, 0, 0, 0, @@ -209,15 +212,19 @@ "_parent": { "__id__": 1 }, - "_children": [], + "_children": [ + { + "__id__": 6 + } + ], "_active": true, "_components": [ { - "__id__": 6 + "__id__": 9 } ], "_prefab": { - "__id__": 7 + "__id__": 10 }, "_opacity": 255, "_color": { @@ -266,6 +273,113 @@ "groupIndex": 0, "_id": "" }, + { + "__type__": "cc.Node", + "_name": "图片遮罩", + "_objFlags": 0, + "_parent": { + "__id__": 5 + }, + "_children": [], + "_active": false, + "_components": [ + { + "__id__": 7 + } + ], + "_prefab": { + "__id__": 8 + }, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 403, + "height": 177 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 6 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "88e91414-87d7-4b8f-83fa-33ce2e10e7d8" + }, + "_type": 0, + "_sizeMode": 1, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "50257hsCNBcqQ6ZyXu6jzC", + "sync": false + }, { "__type__": "cc.Sprite", "_name": "", @@ -320,11 +434,11 @@ "_active": true, "_components": [ { - "__id__": 9 + "__id__": 12 } ], "_prefab": { - "__id__": 10 + "__id__": 13 }, "_opacity": 255, "_color": { @@ -378,7 +492,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 8 + "__id__": 11 }, "_enabled": true, "_materials": [ @@ -426,17 +540,20 @@ }, "_children": [ { - "__id__": 12 + "__id__": 15 } ], "_active": true, "_components": [ { - "__id__": 16 + "__id__": 19 + }, + { + "__id__": 20 } ], "_prefab": { - "__id__": 17 + "__id__": 21 }, "_opacity": 255, "_color": { @@ -490,20 +607,20 @@ "_name": "beishu", "_objFlags": 0, "_parent": { - "__id__": 11 + "__id__": 14 }, "_children": [], "_active": true, "_components": [ { - "__id__": 13 + "__id__": 16 }, { - "__id__": 14 + "__id__": 17 } ], "_prefab": { - "__id__": 15 + "__id__": 18 }, "_opacity": 255, "_color": { @@ -515,8 +632,8 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 77, - "height": 33.5 + "width": 68, + "height": 29.72 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -557,7 +674,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 12 + "__id__": 15 }, "_enabled": true, "_materials": [ @@ -569,8 +686,8 @@ "_dstBlendFactor": 771, "_string": "无加成", "_N$string": "无加成", - "_fontSize": 25, - "_lineHeight": 25, + "_fontSize": 22, + "_lineHeight": 22, "_enableWrapText": true, "_N$file": null, "_isSystemFontUsed": true, @@ -590,7 +707,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 12 + "__id__": 15 }, "_enabled": true, "_color": { @@ -619,7 +736,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 11 + "__id__": 14 }, "_enabled": true, "_materials": [ @@ -632,8 +749,8 @@ "_spriteFrame": { "__uuid__": "a4bc6cfa-ebdd-4822-8a87-48a83fcd8ee6" }, - "_type": 0, - "_sizeMode": 1, + "_type": 1, + "_sizeMode": 0, "_fillType": 0, "_fillCenter": { "__type__": "cc.Vec2", @@ -646,6 +763,33 @@ "_atlas": null, "_id": "" }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 14 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 32, + "_left": 0, + "_right": 23.52799999999999, + "_top": 0, + "_bottom": 0, + "_verticalCenter": 0, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "" + }, { "__type__": "cc.PrefabInfo", "root": { @@ -659,24 +803,27 @@ }, { "__type__": "cc.Node", - "_name": "加成框未", + "_name": "加成框锁", "_objFlags": 0, "_parent": { "__id__": 1 }, "_children": [ { - "__id__": 19 + "__id__": 23 } ], "_active": true, "_components": [ { - "__id__": 22 + "__id__": 26 + }, + { + "__id__": 27 } ], "_prefab": { - "__id__": 23 + "__id__": 28 }, "_opacity": 255, "_color": { @@ -730,17 +877,17 @@ "_name": "New RichText", "_objFlags": 0, "_parent": { - "__id__": 18 + "__id__": 22 }, "_children": [], "_active": true, "_components": [ { - "__id__": 20 + "__id__": 24 } ], "_prefab": { - "__id__": 21 + "__id__": 25 }, "_opacity": 255, "_color": { @@ -752,7 +899,7 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 135.15, + "width": 148.27, "height": 25.2 }, "_anchorPoint": { @@ -794,14 +941,14 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 19 + "__id__": 23 }, "_enabled": true, "_fontFamily": "Arial", "_isSystemFontUsed": true, "_N$string": "点击加成200%", "_N$horizontalAlign": 0, - "_N$fontSize": 20, + "_N$fontSize": 22, "_N$font": null, "_N$cacheMode": 0, "_N$maxWidth": 0, @@ -826,7 +973,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 18 + "__id__": 22 }, "_enabled": true, "_materials": [ @@ -853,6 +1000,33 @@ "_atlas": null, "_id": "" }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 22 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 32, + "_left": 0, + "_right": 24.236999999999995, + "_top": 0, + "_bottom": 0, + "_verticalCenter": 0, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "" + }, { "__type__": "cc.PrefabInfo", "root": { @@ -866,7 +1040,7 @@ }, { "__type__": "cc.Node", - "_name": "按钮使用中", + "_name": "使用中", "_objFlags": 0, "_parent": { "__id__": 1 @@ -875,11 +1049,11 @@ "_active": true, "_components": [ { - "__id__": 25 + "__id__": 30 } ], "_prefab": { - "__id__": 26 + "__id__": 31 }, "_opacity": 255, "_color": { @@ -903,8 +1077,8 @@ "__type__": "TypedArray", "ctor": "Float64Array", "array": [ - 118.301, - -34.962, + 118, + -35, 0, 0, 0, @@ -933,7 +1107,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 24 + "__id__": 29 }, "_enabled": true, "_materials": [ @@ -971,6 +1145,198 @@ "fileId": "36KYFdCB5HCbbKXjo8Lod8", "sync": false }, + { + "__type__": "cc.Node", + "_name": "切换", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 33 + }, + { + "__id__": 34 + } + ], + "_prefab": { + "__id__": 36 + }, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 157, + "height": 66 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 118, + -35, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 32 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "b86612aa-9804-4a79-93d8-a71ed6f78da4" + }, + "_type": 0, + "_sizeMode": 1, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 32 + }, + "_enabled": true, + "_normalMaterial": null, + "_grayMaterial": null, + "duration": 0.1, + "zoomScale": 1.2, + "clickEvents": [ + { + "__id__": 35 + } + ], + "_N$interactable": true, + "_N$enableAutoGrayEffect": false, + "_N$transition": 0, + "transition": 0, + "_N$normalColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$pressedColor": { + "__type__": "cc.Color", + "r": 211, + "g": 211, + "b": 211, + "a": 255 + }, + "pressedColor": { + "__type__": "cc.Color", + "r": 211, + "g": 211, + "b": 211, + "a": 255 + }, + "_N$hoverColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "hoverColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$disabledColor": { + "__type__": "cc.Color", + "r": 124, + "g": 124, + "b": 124, + "a": 255 + }, + "_N$normalSprite": null, + "_N$pressedSprite": null, + "pressedSprite": null, + "_N$hoverSprite": null, + "hoverSprite": null, + "_N$disabledSprite": null, + "_N$target": null, + "_id": "" + }, + { + "__type__": "cc.ClickEvent", + "target": { + "__id__": 1 + }, + "component": "", + "_componentId": "c4adfhZEEZPZY9YclMBngLh", + "handler": "onTouchQieHuan", + "customEventData": "" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "2e6GvR1IFM/7a1qCR+okZ0", + "sync": false + }, { "__type__": "cc.Node", "_name": "下滑箭头", @@ -982,11 +1348,11 @@ "_active": true, "_components": [ { - "__id__": 28 + "__id__": 38 } ], "_prefab": { - "__id__": 29 + "__id__": 39 }, "_opacity": 255, "_color": { @@ -1040,7 +1406,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 27 + "__id__": 37 }, "_enabled": true, "_materials": [ @@ -1087,12 +1453,17 @@ }, "_enabled": true, "icon": { - "__id__": 6 + "__id__": 9 }, "title_str": { - "__id__": 9 + "__id__": 12 + }, + "lockBeiShu": { + "__id__": 24 + }, + "unlockBeiShu": { + "__id__": 16 }, - "beishu": null, "_id": "" }, { diff --git a/assets/JieDao/res/加成框.png.meta b/assets/JieDao/res/加成框.png.meta index 485973cd..79981660 100644 --- a/assets/JieDao/res/加成框.png.meta +++ b/assets/JieDao/res/加成框.png.meta @@ -28,10 +28,10 @@ "height": 36, "rawWidth": 115, "rawHeight": 36, - "borderTop": 0, - "borderBottom": 0, - "borderLeft": 0, - "borderRight": 0, + "borderTop": 12, + "borderBottom": 11, + "borderLeft": 22, + "borderRight": 22, "subMetas": {} } } diff --git a/assets/MainHall/prefab/MainHall.prefab b/assets/MainHall/prefab/MainHall.prefab index e8c4ef9b..fe22bc7c 100644 --- a/assets/MainHall/prefab/MainHall.prefab +++ b/assets/MainHall/prefab/MainHall.prefab @@ -3850,7 +3850,7 @@ "__id__": 105 } ], - "_active": true, + "_active": false, "_components": [ { "__id__": 108 diff --git a/assets/Scripts/JieDao/JieDao.ts b/assets/Scripts/JieDao/JieDao.ts index cccb3b6a..e779d1b6 100644 --- a/assets/Scripts/JieDao/JieDao.ts +++ b/assets/Scripts/JieDao/JieDao.ts @@ -12,7 +12,8 @@ import Common5 from "../../Platform/th/Common5"; import List from "../../Platform/th/List"; import TaskManager, { MainTaskIdEnum } from "../JuQingChat/TaskManager"; import FangChanManager from "../Manager/FangChanManager"; -import ZiChanManager from "../Manager/ZiChanManager"; +import JieDaoManager from "../Manager/JieDaoManager"; +import PrefabManage from "../PrefabManager/PrefabManage"; import JieDaoItemNode from "./JieDaoItemNode"; const { ccclass, property } = cc._decorator; @@ -23,11 +24,14 @@ export default class JieDao extends cc.Component { @property(cc.Prefab) item: cc.Prefab = null; + @property(cc.Label) + levelUpMoney: cc.Label = null; + @property(List) listCJ: List = null; dataListCJ: any[]; + Config: { level: number; icon: string; isNeedAd: boolean; name: string; descLab: string; miaozhuan: number; jiesuoMoney: number; jiesuoBeiShu: number; }[]; - Config: { configId: number; icon: string; isNeedAd: boolean; descLab: string; shuliang: number; miaozhuan: number[]; jiesuoMoney: number[]; jiesuoBeiShu: number[]; str1: string; str2: string; unLockNum: number; unLockLevel: number; }[]; // LIFE-CYCLE CALLBACKS: @@ -39,36 +43,40 @@ export default class JieDao extends cc.Component { this.scheduleOnce(() => { this.setList() }, 0.01) - EventMgr.onEvent_custom(ryw_Event.RefreshZiChan, () => { - this.init() - }, this) - cc.sys.localStorage.setItem("资产引导", '1') } init() { - this.Config = ZiChanManager.getManagerConfigs() - let ziChanData = User.getZiChanData() - // this.curshouyi.string = `当前收益:${ziChanData.curshouyi}` - let getnum = 0 - let allnum = 0 - let beishu = 0 - let iconIndex = 0 - for (let i = 0; i < ziChanData.unLockNum.length; i++) { - if (ziChanData.unLockNum[i] > 0) { - getnum += ziChanData.unLockNum[i] - beishu += this.Config[i].jiesuoBeiShu[ziChanData.unLockNum[i] - 1] - iconIndex = i - } - } - for (let i = 0; i < this.Config.length; i++) { - allnum += this.Config[i].shuliang - } + this.refreshLevelUpMoney() + // let ziChanData = User.getZiChanData() + // // this.curshouyi.string = `当前收益:${ziChanData.curshouyi}` + // let getnum = 0 + // let allnum = 0 + // let beishu = 0 + // let iconIndex = 0 + // for (let i = 0; i < ziChanData.unLockNum.length; i++) { + // if (ziChanData.unLockNum[i] > 0) { + // getnum += ziChanData.unLockNum[i] + // beishu += this.Config[i].jiesuoBeiShu[ziChanData.unLockNum[i] - 1] + // iconIndex = i + // } + // } + // for (let i = 0; i < this.Config.length; i++) { + // allnum += this.Config[i].shuliang + // } // let arr = [2, 3, 4, 4] // Common5.getSpriteFrameFromBundle("ZiChan", `res/big/${arr[iconIndex]}`, this.icon) } setList() { - let array = this.Config + this.Config = JieDaoManager.getManagerConfigs() + let level = JieDaoManager.getJieDaoLevel() + let haveConfig = [] + for (let i = 0; i < this.Config.length; i++) { + if (i <= level) { + haveConfig.push(this.Config[i]) + } + } + let array = haveConfig this.dataListCJ = [] for (let n = 0; n < array.length; n++) { this.dataListCJ.push(array[n]); @@ -87,16 +95,38 @@ export default class JieDao extends cc.Component { } onTouchClose() { - if (TaskManager.getCurUnLockMainTaskId() == MainTaskIdEnum.MainTask_514_2 && !cc.sys.localStorage.getItem("房产引导") && FangChanManager.getRoomState(3) != 1) { - User.setFirstStepIndex(1102) - EventMgr.emitEvent_custom(ryw_Event.My_Guide) - } + // if (TaskManager.getCurUnLockMainTaskId() == MainTaskIdEnum.MainTask_514_2 && !cc.sys.localStorage.getItem("房产引导") && FangChanManager.getRoomState(3) != 1) { + // User.setFirstStepIndex(1102) + // EventMgr.emitEvent_custom(ryw_Event.My_Guide) + // } this.node.removeFromParent() this.node.destroy() } - onTouchShengJi(){ - + onTouchShengJi() { + Common5.playRemoteAudioEffect('sound/diandiandian/升级音效') + let money = User.getMoney() + let getJieDaoLevel = JieDaoManager.getJieDaoLevel() + 1 + let getJieDaoConfigByLevel = JieDaoManager.getJieDaoConfigByLevel(getJieDaoLevel) + if (money >= getJieDaoConfigByLevel.jiesuoMoney) { + JieDaoManager.setJieDaoLevel(getJieDaoLevel) + getJieDaoConfigByLevel = JieDaoManager.getJieDaoConfigByLevel(getJieDaoLevel) + this.dataListCJ.push(getJieDaoConfigByLevel); + this.listCJ.numItems = this.dataListCJ.length; + this.refreshLevelUpMoney() + } else { + PrefabManage.showTextTips("先去赚钱吧") + } + } + + refreshLevelUpMoney() { + let getJieDaoLevel = JieDaoManager.getJieDaoLevel() + 1 + if (getJieDaoLevel >= JieDaoManager.getManagerConfigs().length) { + this.levelUpMoney.node.parent.getComponent(cc.Button).interactable = false + return + } + let getJieDaoConfigByLevel = JieDaoManager.getJieDaoConfigByLevel(getJieDaoLevel) + this.levelUpMoney.string = `${Common5.getNumberChangeHanzi(getJieDaoConfigByLevel.jiesuoMoney)}` } // update (dt) {} diff --git a/assets/Scripts/JieDao/JieDaoItemNode.ts b/assets/Scripts/JieDao/JieDaoItemNode.ts index ad4a7cd5..21ae8c42 100644 --- a/assets/Scripts/JieDao/JieDaoItemNode.ts +++ b/assets/Scripts/JieDao/JieDaoItemNode.ts @@ -11,6 +11,7 @@ import User from "../../FrameWork/User/User"; import Common5 from "../../Platform/th/Common5"; import TaskManager, { MainTaskIdEnum } from "../JuQingChat/TaskManager"; import BagManager from "../Manager/BagManager"; +import JieDaoManager from "../Manager/JieDaoManager"; import LevelUpManager from "../Manager/LevelUpManager"; import ShipuManager from "../Manager/ShipuManager"; import UserManager from "../Manager/UserManager"; @@ -27,8 +28,11 @@ export default class JieDaoItemNode extends cc.Component { @property(cc.Label) title_str: cc.Label = null; + @property(cc.RichText) + lockBeiShu: cc.RichText = null; + @property(cc.Label) - beishu: cc.Label = null; + unlockBeiShu: cc.Label = null; config: any; @@ -37,71 +41,45 @@ export default class JieDaoItemNode extends cc.Component { // onLoad () {} start() { - + EventMgr.onEvent_custom(ryw_Event.RefreshJieDao, () => { + this.refreshState() + }, this) } init(data) { this.config = data + Common5.getSpriteFrameFromBundle("JieDao", this.config.icon, this.icon) // Common5.addUrlSprite_custom(this.config.icon, this.icon) - Common5.getSpriteFrameFromBundle("ZiChan", this.config.icon, this.icon) - this.title_str.string = data.descLab - let ziChanData = User.getZiChanData() - let level = User.getMyLevel() - //是否满足解锁条件 - if (ziChanData.unLockNum[this.config.configId] == -1 && ShipuManager.getShipuUnLockNum() >= this.config.unLockNum && level >= this.config.unLockLevel) { - ziChanData.unLockNum[this.config.configId] = 0 - } - if (ziChanData.unLockNum[this.config.configId] == -1 && ShipuManager.getShipuUnLockNum() >= this.config.unLockNum) { - // 变棕色 - // this.str1.node.color = cc.color(33, 152, 0) - } - if (ziChanData.unLockNum[this.config.configId] == -1 && level >= this.config.unLockLevel) { - // 变棕色 - // this.str2.node.color = cc.color(33, 152, 0) - } - let unLockNum = ziChanData.unLockNum[this.config.configId] <= 0 ? 0 : ziChanData.unLockNum[this.config.configId] - if (unLockNum > 0) { - this.beishu.string = `秒赚倍数:${this.config.miaozhuan[unLockNum - 1]}倍` - } else { - this.beishu.string = `秒赚倍数:${0}倍` - } - if (unLockNum >= 0) { - } this.refreshState() } - refreshState() { - let ziChanData = User.getZiChanData() - if (ziChanData.unLockNum[this.config.configId] == -1) { - } else if (ziChanData.unLockNum[this.config.configId] < this.config.shuliang) { - } else { - if (this.config.name == '镇中心门店' && TaskManager.getCurUnLockMainTaskId() >= MainTaskIdEnum.MainTask_516_1 && TaskManager.getCurUnLockMainTaskId() <= MainTaskIdEnum.MainTask_517) { - }else{ - } - } + onTouchQieHuan() { + JieDaoManager.setJieDaoInUse(this.config.level) + EventMgr.emitEvent_custom(ryw_Event.RefreshJieDao) } - onTouchShop() { - // //Common5.playEffect("sound/按键点击") - Common5.playRemoteAudioEffect('sound/diandiandian/升级音效') - let ziChanData = User.getZiChanData() - //是否满足解锁条件 - if (ziChanData.unLockNum[this.config.configId] == -1 && ShipuManager.getShipuUnLockNum() >= this.config.unLockNum) { - ziChanData.unLockNum[this.config.configId] = 0 - } - UserManager.subMoney(this.config.jiesuoMoney[ziChanData.unLockNum[this.config.configId]]) - - // ziChanData = {curshouyi:0,getnum:0,shouyi:0,unLockNum:[-1,-1,-1,-1]} - if (ziChanData.unLockNum[this.config.configId] == -1) { - ziChanData.unLockNum[this.config.configId] = 1 + refreshState() { + this.title_str.string = this.config.descLab + let inUse = JieDaoManager.getJieDaoInUse() + if (inUse == this.config.level) { + this.icon.node.getChildByName("图片遮罩").active = false + this.node.getChildByName("使用中").active = true + this.node.getChildByName("切换").active = false + this.node.getChildByName("加成框").active = true + this.node.getChildByName("加成框锁").active = false + this.unlockBeiShu.string = this.config.jiesuoBeiShu == 1 ? '无加成' : `单价加成${this.config.jiesuoBeiShu * 100}%` + this.unlockBeiShu["_forceUpdateRenderData"](true); + this.unlockBeiShu.node.parent.setContentSize(cc.size(this.lockBeiShu.node.getContentSize().width + 30, this.lockBeiShu.node.parent.getContentSize().height)) } else { - ziChanData.unLockNum[this.config.configId] += 1 + this.icon.node.getChildByName("图片遮罩").active = true + this.node.getChildByName("切换").active = true + this.node.getChildByName("使用中").active = false + this.node.getChildByName("加成框").active = false + this.node.getChildByName("加成框锁").active = true + let str1 = `无加成` + let str2 = `单价加成${this.config.jiesuoBeiShu * 100}%` + this.lockBeiShu.string = this.config.jiesuoBeiShu == 1 ? str1 : str2 } - User.setZiChanData(ziChanData) - this.init(this.config) - EventMgr.emitEvent_custom(ryw_Event.RefreshZiChan) - - this.checkTask() } checkTask() { diff --git a/assets/Scripts/MainHall/MainHallBtn.ts b/assets/Scripts/MainHall/MainHallBtn.ts index 47b7d98d..0a0b51ff 100644 --- a/assets/Scripts/MainHall/MainHallBtn.ts +++ b/assets/Scripts/MainHall/MainHallBtn.ts @@ -1256,7 +1256,7 @@ export default class MainHallBtn extends cc.Component { } ziChanClickEvent() { //Common5.playEffect("sound/按键点击") - PrefabManage.loadPrefabByType(GameType.ZiChan) + PrefabManage.loadPrefabByType(GameType.JieDao) } refreshShengJi() { diff --git a/assets/Scripts/Manager/JieDaoManager.ts b/assets/Scripts/Manager/JieDaoManager.ts index 0604ecc2..e16cb05b 100644 --- a/assets/Scripts/Manager/JieDaoManager.ts +++ b/assets/Scripts/Manager/JieDaoManager.ts @@ -9,10 +9,10 @@ import User from "../../FrameWork/User/User"; import TaskManager, { MainTaskIdEnum } from "../JuQingChat/TaskManager"; let Config = [ - { configId: 0, icon: 'res/2', isNeedAd: false, name: '镇中心门店', descLab: '镇中心门店', shuliang: 1, miaozhuan: [5], jiesuoMoney: [3000000000], jiesuoBeiShu: [5], str1: "开通3个面点", str2: "人物等级:350级", unLockNum: 3, unLockLevel: 350 }, - { configId: 1, icon: 'res/3', isNeedAd: false, name: '市区门店', descLab: '市区门店', shuliang: 1, miaozhuan: [10], jiesuoMoney: [100000000000000], jiesuoBeiShu: [10], str1: "开通9个面点", str2: "人物等级:700级", unLockNum: 9, unLockLevel: 700 }, - { configId: 2, icon: 'res/4', isNeedAd: false, name: '省城门店', descLab: '省城门店', shuliang: 1, miaozhuan: [15], jiesuoMoney: [10000000000000000000], jiesuoBeiShu: [15], str1: "开通15个面点", str2: "人物等级:1100级", unLockNum: 15, unLockLevel: 1100 }, - { configId: 3, icon: 'res/4', isNeedAd: false, name: '省城美食街', descLab: '省城美食街', shuliang: 1, miaozhuan: [20], jiesuoMoney: [1000000000000000000000], jiesuoBeiShu: [20], str1: "开通21个面点", str2: "人物等级:1300级", unLockNum: 21, unLockLevel: 1300 }, + { level: 0, icon: 'res/图片1', isNeedAd: false, name: '解放路', descLab: '解放路', miaozhuan: 1, jiesuoMoney: 1, jiesuoBeiShu: 1 }, + { level: 1, icon: 'res/图片2', isNeedAd: false, name: '朝阳路', descLab: '朝阳路', miaozhuan: 2, jiesuoMoney: 2, jiesuoBeiShu: 2 }, + { level: 2, icon: 'res/图片2', isNeedAd: false, name: '太平路', descLab: '太平路', miaozhuan: 3, jiesuoMoney: 3, jiesuoBeiShu: 3 }, + { level: 3, icon: 'res/图片2', isNeedAd: false, name: '劳动路', descLab: '劳动路', miaozhuan: 4, jiesuoMoney: 4, jiesuoBeiShu: 4 }, ] export default class JieDaoManager { @@ -21,26 +21,40 @@ export default class JieDaoManager { return Config } - public static getZiChanBeiShu() { - let ziChanData = User.getZiChanData() - let beishu = 0 - for (let i = 0; i < ziChanData.unLockNum.length; i++) { - if (ziChanData.unLockNum[i] > 0) { - if ( i == 0 && TaskManager.getCurUnLockMainTaskId() >= MainTaskIdEnum.MainTask_516_1 && TaskManager.getCurUnLockMainTaskId() <= MainTaskIdEnum.MainTask_517) { - console.log("当前镇中心门店被封,没有倍数加成了") - }else{ - beishu += Config[i].jiesuoBeiShu[ziChanData.unLockNum[i] - 1] - } - } - } + public static getJieDaoLevel() { + let level = User.getStatistics("JieDao-Level") + return level + } + public static setJieDaoLevel(level) { + User.setStatistics("JieDao-Level", level) + } + + public static getJieDaoInUse() { + let inUse = User.getStatistics("JieDao-InUse") + return inUse + } + + public static setJieDaoInUse(level) { + User.setStatistics("JieDao-InUse", level) + } + + public static getJieDaoBeiShu() { + let level = this.getJieDaoInUse() + let beishu = 0 + beishu = Config[level].jiesuoBeiShu if (beishu == 0) { beishu = 1 //0倍就是*1 } return beishu } - public static getZiChanConfigByName(name) { + public static getJieDaoConfigByLevel(level) { + let config = Config[level] + return config + } + + public static getJieDaoConfigByName(name) { let _config for (let i = 0; i < Config.length; i++) { if (Config[i].name == name) { diff --git a/assets/Scripts/PrefabManager/PrefabManage.ts b/assets/Scripts/PrefabManager/PrefabManage.ts index 0c1b375e..5fccffcb 100644 --- a/assets/Scripts/PrefabManager/PrefabManage.ts +++ b/assets/Scripts/PrefabManager/PrefabManage.ts @@ -218,6 +218,8 @@ export enum GameType { ShouHuoji, TaskResult, + + JieDao, } // 子游戏命名 @@ -462,6 +464,8 @@ let AllPrefabConfig = [ { desc: "售货机", gameType: GameType.ShouHuoji, bundleName: "shouhuoji", prefabUrl: "prefab/ShouHuoJiGai", dadianTag: '售货机-进入', wanJiaDaDianTag: "售货机-玩家", isNeedLoading: true }, { desc: "剧情任务结果", gameType: GameType.TaskResult, bundleName: "MainPrefab", prefabUrl: "prefab/taskResult", dadianTag: '剧情任务结果-进入', wanJiaDaDianTag: "剧情任务结果-玩家", isNeedLoading: false }, + + { desc: "街道", gameType: GameType.JieDao, bundleName: "JieDao", prefabUrl: "prefab/JieDao", dadianTag: '街道-进入', wanJiaDaDianTag: "街道-玩家", isNeedLoading: true }, ]