| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- var reGameStates = require('GameStates')
- cc.Class({
- extends: cc.Component,
- properties: {
- Name: {
- default: '种子',
- tooltip: '种子名字,这里和Content_button差不多。主要用于种子',
- },
- SeedPrefab: {
- default: null,
- type: cc.Prefab,
- },
- SpawnPoint: {
- default: null,
- type: cc.Node,
- },
- seedType: {
- default: reGameStates.SeedType.Normal,
- type: cc.Enum(reGameStates.SeedType),
- serializable: true,
- },
- //商城类型
- mallType: { default: 0, tooltip: "类型,默认0是种子" },
- goodsSeedInfo: {
- default: null,
- tooltip: '设定一个背包种子信息',
- },
- seedSpriteFrame: {
- default: null,
- type: cc.SpriteFrame,
- tooltip: '种子',
- },
- fruitSpriteFrame: {
- default: null,
- type: cc.SpriteFrame,
- tooltip: '果实',
- },
- myIndex: -1,
- plantButtonText: {
- default: null,
- type:cc.Label,
- tooltip: '按钮文字修改',
- },
- },
- start() {
- this.StoreViewScp = cc.find("Canvas/UICamera/StoreContainer/StoreView").getComponent('StoreView')
- // console.log('11111111111=',this.StoreViewScp);
- },
- onUpdatePlantButtonText(){
- //修改文字
- this.plantButtonText.string = 0 === this.mallType?"种植":"养殖";
- },
- onCreateSeed() {
- let seedTemp = cc.instantiate(this.SeedPrefab)
- // console.log(seedTemp);
- //获取对应的信息,设置不同的种子
- let _ManageSeedNode = seedTemp.getComponent('ManageSeedNode')
- _ManageSeedNode.seedName = this.Name
- _ManageSeedNode.seedType = this.seedType
- _ManageSeedNode.goodsSeedInfo = this.goodsSeedInfo
- _ManageSeedNode.seedSprite.spriteFrame = this.seedSpriteFrame
- _ManageSeedNode.fruitSpriteFrame = this.fruitSpriteFrame
- _ManageSeedNode.upTarget = this.node;
- _ManageSeedNode.mallType = this.mallType;
- let tempPos = this.SpawnPoint.convertToNodeSpace(
- GlobalD.game.MainCamera.node
- )
- let CanvasPos = GlobalD.game.Canvas.position
- seedTemp.setPosition(tempPos.x + CanvasPos.x, tempPos.y + CanvasPos.y)
- seedTemp.parent = this.SpawnPoint
- //收起菜单
- GlobalD.game._ManageUIScript.onButtonEvent_Building_Close()
- },
- onPayCNTPopView() {
- this.StoreViewScp.onPayCNTPopView(this.myIndex)
- },
- onPaySNBPopView() {
- this.StoreViewScp.onPaySNBPopView(this.myIndex)
- },
- })
|