yangqiwen 2 months ago
parent 94f973ad38
commit f35d2e1e1c
  1. 4
      assets/GameRes/侧边栏/prefab/Cebianlan.prefab
  2. 12
      assets/MishuGame/prefab/MishuGame.prefab
  3. 4
      assets/Scripts/Mishu/MishuItem.ts
  4. 83
      assets/Scripts/ZaoCanDian/ZaoCanDian.ts

@ -1188,8 +1188,8 @@
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "自动点击",
"_N$string": "自动点击",
"_string": "自动营业",
"_N$string": "自动营业",
"_fontSize": 35,
"_lineHeight": 35,
"_enableWrapText": true,

@ -6154,7 +6154,7 @@
"__id__": 178
}
],
"_active": false,
"_active": true,
"_components": [
{
"__id__": 181
@ -6244,7 +6244,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 56,
"width": 37,
"height": 50
},
"_anchorPoint": {
@ -6256,8 +6256,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
62.398,
27.645,
0,
0,
0,
@ -6320,7 +6320,7 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-29,
0,
-0.311,
0,
0,
@ -6398,7 +6398,7 @@
"_enabled": true,
"_layoutSize": {
"__type__": "cc.Size",
"width": 56,
"width": 37,
"height": 50
},
"_resize": 1,

@ -302,14 +302,14 @@ export default class MishuItem extends cc.Component {
if (UserManager.getCurMoney() - this.guyongNeedMoney >= 0) {
this.guyongNeedAd = false
adIcon.active = false
lab.getComponent(cc.Label).string = '雇佣'
// lab.getComponent(cc.Label).string = '雇佣'
this.redPoint1.active = true
this.redPoint2.active = true
} else {
this.guyongNeedAd = true
//出现广告
adIcon.active = true
lab.getComponent(cc.Label).string = '免费雇佣'
// lab.getComponent(cc.Label).string = '免费雇佣'
this.redPoint1.active = false
this.redPoint2.active = false

@ -5,7 +5,10 @@
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
import { ryw_Event } from "../../FrameWork/Event/EventEnum";
import EventMgr from "../../FrameWork/Event/EventMgr";
import Common5 from "../../Platform/th/Common5";
import ZaoCanManager from "../Manager/ZaoCanManager";
import ZaoCanDianNpc from "./ZaoCanDianNpc";
const { ccclass, property } = cc._decorator;
@ -36,13 +39,7 @@ export default class ZaoCanDian extends cc.Component {
npc_Position_States: Npc_Position_State[] = [{ isHaveNpc: false }, { isHaveNpc: false }, { isHaveNpc: false }]
ZaoCanArr = [
['馒头', '肉包', '烧卖', '红薯'],
['鸡蛋', '茶叶蛋', '玉米', '西兰花'],
['饺子', '韭菜盒子', '鸡蛋饼', '牛排'],
['油条', '麻球', '油饼', '鸡腿'],
['豆浆', '小米粥', '燕麦', '咖啡机'],
]
ZaoCanArr = []
// LIFE-CYCLE CALLBACKS:
@ -53,6 +50,28 @@ export default class ZaoCanDian extends cc.Component {
//NPC,头上带气泡
//点击,点击完自动上架早餐
//刷新早餐种类
this.refreshZaoCan()
EventMgr.onEvent_custom(ryw_Event.levelUpChange, () => {
//人物升级会变更早餐
this.refreshZaoCan()
}, this)
}
refreshZaoCan() {
let config = ZaoCanManager.getManagerConfigDate()
for (let i = 0; i < config.length; i++) {
let name = ZaoCanManager.getCurNameById(config[i])
this.ZaoCanArr[i] = name
}
for (let i = this.npcNodes.length - 1; i >= 0; i--) {
this.npcNodes[i].removeFromParent()
this.npcNodes[i].destroy()
this.npc_Position_States[i].isHaveNpc = false
}
this.npcNodes = []
}
runNpc() {
@ -61,7 +80,7 @@ export default class ZaoCanDian extends cc.Component {
let position = this.getNpcEndPosition()
let curDirect = this.lastDirect == Npc_Direct.LEFT ? Npc_Direct.RIGHT : Npc_Direct.LEFT
let index = Common5.getRandomNumber(0, this.ZaoCanArr.length - 1)
npc.getComponent(ZaoCanDianNpc).init(curDirect, position, this.ZaoCanArr[index][0], index, 1)
npc.getComponent(ZaoCanDianNpc).init(curDirect, position, this.ZaoCanArr[index], index, 1)
this.lastDirect = curDirect
this.npcNodes.push(npc)
}
@ -87,27 +106,37 @@ export default class ZaoCanDian extends cc.Component {
}
let _child
let _position
if (custom == "油条") {
let tanwei = this.node.getChildByName("油条摊位")
let children = tanwei.children
for (const child of children) {
if (child.active) {
_child = child
break
}
}
_position = tanwei.convertToNodeSpaceAR(_npc.parent.convertToWorldSpaceAR(_npc.getPosition()))
} else if (custom == "包子") {
let tanwei = this.node.getChildByName("包子摊位")
let children = tanwei.children
for (const child of children) {
if (child.active) {
_child = child
break
}
// if (custom == "馒头") {
// let tanwei = this.node.getChildByName("馒头摊位")
// let children = tanwei.children
// for (const child of children) {
// if (child.active) {
// _child = child
// break
// }
// }
// _position = tanwei.convertToNodeSpaceAR(_npc.parent.convertToWorldSpaceAR(_npc.getPosition()))
// } else if (custom == "鸡蛋") {
// let tanwei = this.node.getChildByName("鸡蛋摊位")
// let children = tanwei.children
// for (const child of children) {
// if (child.active) {
// _child = child
// break
// }
// }
// _position = tanwei.convertToNodeSpaceAR(_npc.parent.convertToWorldSpaceAR(_npc.getPosition()))
// }
let tanwei = this.node.getChildByName(custom + "摊位")
let children = tanwei.children
for (const child of children) {
if (child.active) {
_child = child
break
}
_position = tanwei.convertToNodeSpaceAR(_npc.parent.convertToWorldSpaceAR(_npc.getPosition()))
}
_position = tanwei.convertToNodeSpaceAR(_npc.parent.convertToWorldSpaceAR(_npc.getPosition()))
if (_child) {
cc.tween(_child)

Loading…
Cancel
Save