ManageBuildings.js 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214
  1. var reGameStates = require('GameStates');
  2. import date from "../Unit/date.js"
  3. cc.Class({
  4. extends: cc.Component,
  5. properties: {
  6. //MyMapNode
  7. //建筑物的节点
  8. BuildingsParent: {
  9. default: null,
  10. type: cc.Node,
  11. },
  12. //农舍
  13. Env_101_house_low: {
  14. default: null,
  15. type: cc.Prefab,
  16. serializable: true,
  17. },
  18. //单元楼
  19. Env_102_house_mid: {
  20. default: null,
  21. type: cc.Prefab,
  22. serializable: true,
  23. },
  24. //别墅
  25. Env_103_house_high: {
  26. default: null,
  27. type: cc.Prefab,
  28. serializable: true,
  29. },
  30. //蓝色城堡
  31. Env_104_BlueCastle: {
  32. default: null,
  33. type: cc.Prefab,
  34. serializable: true,
  35. },
  36. //粉色城堡
  37. Env_105_PinkCastle: {
  38. default: null,
  39. type: cc.Prefab,
  40. serializable: true,
  41. },
  42. //农田
  43. Labour_201_Farmland: {
  44. default: null,
  45. type: cc.Prefab,
  46. serializable: true,
  47. },
  48. //伐木场
  49. Labour_202_TimberYard: {
  50. default: null,
  51. type: cc.Prefab,
  52. serializable: true,
  53. },
  54. //矿坑
  55. Labour_203_MiningPit: {
  56. default: null,
  57. type: cc.Prefab,
  58. serializable: true,
  59. },
  60. //工厂
  61. Labour_204_Factory: {
  62. default: null,
  63. type: cc.Prefab,
  64. serializable: true,
  65. },
  66. //神农专用农田
  67. Labour_205_Holy_Farmland: {
  68. default: null,
  69. type: cc.Prefab,
  70. serializable: true,
  71. },
  72. //一级
  73. // 冷饮摊
  74. Shops_30101_ColdDrinkStall: {
  75. default: null,
  76. type: cc.Prefab,
  77. serializable: true,
  78. },
  79. //贩卖机
  80. Shops_30102_SalesMachine: {
  81. default: null,
  82. type: cc.Prefab,
  83. serializable: true,
  84. },
  85. //面包房
  86. Shops_30103_Bakery: {
  87. default: null,
  88. type: cc.Prefab,
  89. serializable: true,
  90. },
  91. //早餐车
  92. Shops_30104_BreakfastCar: {
  93. default: null,
  94. type: cc.Prefab,
  95. serializable: true,
  96. },
  97. //二级
  98. //饮茶店
  99. Shops_30201_TeaShop: {
  100. default: null,
  101. type: cc.Prefab,
  102. serializable: true,
  103. },
  104. //点心店
  105. Shops_30202_confectaurant: {
  106. default: null,
  107. type: cc.Prefab,
  108. serializable: true,
  109. },
  110. //美食店
  111. Shops_30203_GourmetRestaurant: {
  112. default: null,
  113. type: cc.Prefab,
  114. serializable: true,
  115. },
  116. //西餐厅
  117. Shops_30204_WesternRestaurant: {
  118. default: null,
  119. type: cc.Prefab,
  120. serializable: true,
  121. },
  122. //三级
  123. //花店
  124. Shops_30301_Florist: {
  125. default: null,
  126. type: cc.Prefab,
  127. serializable: true,
  128. },
  129. //美发店
  130. Shops_30302_HairSalon: {
  131. default: null,
  132. type: cc.Prefab,
  133. serializable: true,
  134. },
  135. //洋装店
  136. Shops_30303_DressShop: {
  137. default: null,
  138. type: cc.Prefab,
  139. serializable: true,
  140. },
  141. //珠宝店
  142. Shops_30304_JewelryStore: {
  143. default: null,
  144. type: cc.Prefab,
  145. serializable: true,
  146. },
  147. //电影院
  148. Shops_30305_Cinema: {
  149. default: null,
  150. type: cc.Prefab,
  151. serializable: true,
  152. },
  153. //特殊建筑
  154. //路灯
  155. Spe_401_StreetLamp: {
  156. default: null,
  157. type: cc.Prefab,
  158. serializable: true,
  159. },
  160. //绿化带
  161. Spe_402_GreenBelt: {
  162. default: null,
  163. type: cc.Prefab,
  164. serializable: true,
  165. },
  166. //花坛
  167. Spe_403_FlowerBed: {
  168. default: null,
  169. type: cc.Prefab,
  170. serializable: true,
  171. },
  172. //喷泉
  173. Spe_404_Pool: {
  174. default: null,
  175. type: cc.Prefab,
  176. serializable: true,
  177. },
  178. //警察局
  179. Spe_405_PoliceOffice: {
  180. default: null,
  181. type: cc.Prefab,
  182. serializable: true,
  183. },
  184. //游乐场
  185. Spe_406_Playground: {
  186. default: null,
  187. type: cc.Prefab,
  188. serializable: true,
  189. },
  190. BuildingArray: {
  191. default: [],
  192. type: [cc.Node],
  193. serializable: true,
  194. },
  195. /**
  196. * 定义一个场景预制对象
  197. */
  198. DressUpArray: {
  199. default: [],
  200. type: [cc.Prefab]
  201. }
  202. },
  203. onBuildHouse(index) {
  204. // cc.log(index);
  205. let mainCamera = GlobalD.game.MainCamera;
  206. let housing = null;
  207. //content button 设置的index
  208. //农舍
  209. if ('101' == index) {
  210. housing = cc.instantiate(this.Env_101_house_low);
  211. }
  212. //单元楼
  213. else if ('102' == index) {
  214. housing = cc.instantiate(this.Env_102_house_mid);
  215. }
  216. //别墅
  217. else if ('103' == index) {
  218. housing = cc.instantiate(this.Env_103_house_high);
  219. }
  220. else if ('104' == index) {
  221. housing = cc.instantiate(this.Env_104_BlueCastle);
  222. }
  223. else if ('105' == index) {
  224. housing = cc.instantiate(this.Env_105_PinkCastle);
  225. }
  226. //农田
  227. else if ('201' == index) {
  228. housing = cc.instantiate(this.Labour_201_Farmland);
  229. }
  230. //伐木场
  231. else if ('202' == index) {
  232. housing = cc.instantiate(this.Labour_202_TimberYard);
  233. }
  234. //矿坑
  235. else if ('203' == index) {
  236. housing = cc.instantiate(this.Labour_203_MiningPit);
  237. }
  238. //工厂
  239. else if ('204' == index) {
  240. housing = cc.instantiate(this.Labour_204_Factory);
  241. }
  242. //神农专用农田
  243. else if ('205' == index) {
  244. housing = cc.instantiate(this.Labour_205_Holy_Farmland);
  245. }
  246. //冷饮摊
  247. else if ('30101' == index) {
  248. housing = cc.instantiate(this.Shops_30101_ColdDrinkStall);
  249. }
  250. //贩卖机
  251. else if ('30102' == index) {
  252. housing = cc.instantiate(this.Shops_30102_SalesMachine);
  253. }
  254. //面包房
  255. else if ('30103' == index) {
  256. housing = cc.instantiate(this.Shops_30103_Bakery);
  257. }
  258. //早餐车
  259. else if ('30104' == index) {
  260. housing = cc.instantiate(this.Shops_30104_BreakfastCar);
  261. }
  262. //饮茶店
  263. else if ('30201' == index) {
  264. housing = cc.instantiate(this.Shops_30201_TeaShop);
  265. }
  266. //点心店
  267. else if ('30202' == index) {
  268. housing = cc.instantiate(this.Shops_30202_confectaurant);
  269. }
  270. //美食店
  271. else if ('30203' == index) {
  272. housing = cc.instantiate(this.Shops_30203_GourmetRestaurant);
  273. }
  274. //西餐厅
  275. else if ('30204' == index) {
  276. housing = cc.instantiate(this.Shops_30204_WesternRestaurant);
  277. }
  278. //花店
  279. else if ('30301' == index) {
  280. housing = cc.instantiate(this.Shops_30301_Florist);
  281. }
  282. //美发店
  283. else if ('30302' == index) {
  284. housing = cc.instantiate(this.Shops_30302_HairSalon);
  285. }
  286. //洋装店
  287. else if ('30303' == index) {
  288. housing = cc.instantiate(this.Shops_30303_DressShop);
  289. }
  290. //珠宝店
  291. else if ('30304' == index) {
  292. housing = cc.instantiate(this.Shops_30304_JewelryStore);
  293. }
  294. //电影院
  295. else if ('30305' == index) {
  296. housing = cc.instantiate(this.Shops_30305_Cinema);
  297. }
  298. //路灯
  299. else if ('401' == index) {
  300. housing = cc.instantiate(this.Spe_401_StreetLamp);
  301. }
  302. //绿化带
  303. else if ('402' == index) {
  304. housing = cc.instantiate(this.Spe_402_GreenBelt);
  305. }
  306. //花坛
  307. else if ('403' == index) {
  308. housing = cc.instantiate(this.Spe_403_FlowerBed);
  309. }
  310. //喷泉
  311. else if ('404' == index) {
  312. housing = cc.instantiate(this.Spe_404_Pool);
  313. }
  314. //警察局
  315. else if ('405' == index) {
  316. housing = cc.instantiate(this.Spe_405_PoliceOffice);
  317. }
  318. //游乐场
  319. else if ('406' == index) {
  320. housing = cc.instantiate(this.Spe_406_Playground);
  321. }
  322. housing.parent = this.BuildingsParent;
  323. let tempPos = housing.parent.convertToNodeSpace(mainCamera.node);
  324. let CanvasPos = GlobalD.game.Canvas.position;
  325. housing.setPosition(tempPos.x + CanvasPos.x, tempPos.y + CanvasPos.y);
  326. let buildingsInfo = housing.getComponent("buildingsInfo");
  327. //id用时间戳来记录
  328. buildingsInfo.buildInfo.id = new Date().getTime();//+= Math.random() * 1000000;
  329. this.SpawnBuildingDefaultValue(buildingsInfo);
  330. let buildingsTouch = housing.getComponent("buildingsTouch");
  331. // buildingsTouch.buildInfo = buildingsInfo.buildInfo;
  332. buildingsTouch.onEditorStatus(true);
  333. // housing.active = true;
  334. //收起菜单
  335. GlobalD.game._ManageUIScript.onHideMenu();
  336. //收起底部菜单栏
  337. GlobalD.game._ManageUIScript.onBottomMenuView(false);
  338. },
  339. start() {
  340. },
  341. //如果存储到有房子数据的话,把地图上的房屋都隐藏起来,或者删除
  342. //todo...
  343. onHideInitPosBuildings() {
  344. //删除对应层的子节点
  345. let tempNode = this.BuildingsParent.children;
  346. let length = tempNode.length;
  347. for (let i = length - 1; i >= 0; i--) {
  348. tempNode[i].active = false;
  349. }
  350. },
  351. /**
  352. * GameData里面处理的生成数据流程,生成建筑物
  353. */
  354. InitBuildings() {
  355. //如果有存储的数据,隐藏场景房屋节点
  356. // this.onHideInitPosBuildings();
  357. /**
  358. * 注释 spawnConfigLand 不初始化固定土地
  359. */
  360. //第一步初始化土地的网络数据
  361. this.spawnConfigLand(GlobalD.UserLeaseLand, true);
  362. /**
  363. * todo 之类初始化场景障碍物操作,如果不需要直接注释即可。
  364. * 村长和镇长
  365. * 初始化障碍物场景,装饰
  366. */
  367. // if(0 != GlobalD.Dapp.UserInfo.agent_level){
  368. // this.spawnDressUp();
  369. // }
  370. //先初始化网络数据
  371. // remove version: todo 去除旧的生成建筑逻辑
  372. // this.SpawnHouse();
  373. // cc.log('初始化场景建筑');
  374. let BuildingStateArray = GlobalD.GameData.GetBuildingStateArray();
  375. for (let i = 0; i < BuildingStateArray.length; i++) {
  376. if (BuildingStateArray[i] == 0) {
  377. if (this.BuildingArray[i])
  378. this.BuildingArray[i].active = false;
  379. }
  380. else {
  381. if (this.BuildingArray[i])
  382. this.BuildingArray[i].active = true;
  383. }
  384. }
  385. let BuildingNumArray = GlobalD.GameData.GetBuildingNumArray();
  386. // cc.log('BuildingNumArray',BuildingNumArray)
  387. for (let i = 3; i < this.BuildingArray.length; i++) {
  388. // cc.log('this.BuildingArray[' + i + ']=' + this.BuildingArray[i].getChildByName('Name').getComponent(cc.Label).string);
  389. if (this.BuildingArray[i])
  390. this.BuildingArray[i].getChildByName('Name').getChildByName('Num').getComponent(cc.Label).string = BuildingNumArray[i];
  391. }
  392. },
  393. //生成房子的默认值
  394. SpawnBuildingDefaultValue(buildingsInfo) {
  395. buildingsInfo.InitPos = false;
  396. buildingsInfo.InitWorkBuildingInfo = false;
  397. //激活状态,可运营
  398. buildingsInfo.buildInfo.isItActive = true;
  399. //设置销售状态
  400. buildingsInfo.buildInfo.isItSaleable = true;
  401. if (reGameStates.BuildType.Farmland == buildingsInfo.buildInfo.buildType) {
  402. buildingsInfo.buildInfo.isItSaleable = GlobalD.GameData.GetFoodTradeState() > 0 ? true : false;// GlobalD.GameData.GetFoodTradeState();
  403. // cc.log('初始化房子的信息:', buildingsInfo.buildInfo.buildingName, buildingsInfo.buildInfo.isItSaleable);
  404. }
  405. if (reGameStates.BuildType.MiningPit == buildingsInfo.buildInfo.buildType) {
  406. buildingsInfo.buildInfo.isItSaleable = GlobalD.GameData.GetMineralTradeState() > 0 ? true : false;// GlobalD.GameData.GetMineralTradeState();
  407. }
  408. if (reGameStates.BuildType.TimberYard == buildingsInfo.buildInfo.buildType) {
  409. buildingsInfo.buildInfo.isItSaleable = GlobalD.GameData.GetWoodTradeState() > 0 ? true : false;// GlobalD.GameData.GetWoodTradeState();
  410. }
  411. //设置一下,可查看信息
  412. if (reGameStates.BuildType.Housing !== buildingsInfo.buildInfo.buildType
  413. && reGameStates.BuildType.Special !== buildingsInfo.buildInfo.buildType
  414. /** 神农小镇固定土地关闭 基本的房屋信息,另外设置其他信息 */
  415. && reGameStates.BuildType.HolyFarmland !== buildingsInfo.buildInfo.buildType
  416. ) {
  417. buildingsInfo.node.getComponent('buildingsTouch').isShowBuildingInfo = true;
  418. }
  419. //设置消耗的体力值为工人的最低值 20
  420. //过高的话,会导致工人不工作
  421. // buildingsInfo.buildInfo.totalConsumption = 20;
  422. // cc.log('初始化房子的信息:', buildingsInfo.buildInfo.buildingName, buildingsInfo.buildInfo.isItSaleable)
  423. },
  424. //初始化场景的两个建筑
  425. SpawnDefaultHouse() {
  426. cc.log('初始化默认房子');
  427. //房子
  428. let housingTemp_house = this.onGetHousingPrefabFromName('Env_101_house_low');
  429. housingTemp_house.parent = this.BuildingsParent;
  430. var endPos = GlobalD.TiledMap._getTheMiddleLocationFromtilePos(cc.v2(24, 23));
  431. housingTemp_house.setPosition(endPos.x, endPos.y);
  432. let buildingsInfo_house = housingTemp_house.getComponent("buildingsInfo");
  433. //id用时间戳来记录
  434. buildingsInfo_house.buildInfo.id = 101;//对应的id
  435. //设置tile的最底下的坐标,就是起始坐标
  436. buildingsInfo_house.buildInfo.startTilePos = cc.v2(24, 23);
  437. this.SpawnBuildingDefaultValue(buildingsInfo_house);
  438. //起始坐标,占位范围,是否占位
  439. GlobalD.game.addBuildTiled(buildingsInfo_house.buildInfo.id, buildingsInfo_house.buildInfo.startTilePos, buildingsInfo_house.buildInfo.occupyArea);
  440. //添加占位信息
  441. GlobalD.game.addBuilding(buildingsInfo_house);
  442. //农田
  443. let housingTemp_farmland = this.onGetHousingPrefabFromName('Labour_201_Farmland');
  444. housingTemp_farmland.parent = this.BuildingsParent;
  445. var endPos = GlobalD.TiledMap._getTheMiddleLocationFromtilePos(cc.v2(26, 24));
  446. housingTemp_farmland.setPosition(endPos.x, endPos.y);
  447. let buildingsInfo_farmland = housingTemp_farmland.getComponent("buildingsInfo");
  448. //id用时间戳来记录
  449. buildingsInfo_farmland.buildInfo.id = 201;//对应的id
  450. //设置tile的最底下的坐标,就是起始坐标
  451. buildingsInfo_farmland.buildInfo.startTilePos = cc.v2(26, 24);
  452. this.SpawnBuildingDefaultValue(buildingsInfo_farmland);
  453. //起始坐标,占位范围,是否占位
  454. GlobalD.game.addBuildTiled(buildingsInfo_farmland.buildInfo.id, buildingsInfo_farmland.buildInfo.startTilePos, buildingsInfo_farmland.buildInfo.occupyArea);
  455. //添加占位信息
  456. GlobalD.game.addBuilding(buildingsInfo_farmland);
  457. },
  458. /**
  459. * 按钮调用
  460. * 回到用户自己的农场
  461. */
  462. onBackSelfFarmland() {
  463. //刷新一下自己的用户信息
  464. GlobalD.GameData.getSelfUserLandList(() => {
  465. this.spawnConfigLand(GlobalD.UserLeaseLand, true);
  466. //显示底部菜单栏
  467. GlobalD.game._ManageUIScript.onBottomMenuView(true);
  468. //收起其他用户场景后菜单操作
  469. GlobalD.game._ManageUIScript.onOtherFarmerView(false);
  470. })
  471. //更新自己的狗
  472. let _dogContainerScript = cc.find("Canvas/DogContainer").getComponent("DogContainer")
  473. _dogContainerScript.onGetSelfList();
  474. GlobalD.GameData.onSwitchAddressBg(GlobalD.Dapp.UserInfo.agent_level);
  475. },
  476. /**
  477. * 初始化后台配置的土地数据
  478. * 切换时候需要重置其他用户数据
  479. * @returns
  480. */
  481. spawnConfigLand(_userLeaseLand, bSelf) {
  482. if (GlobalD.ConfigLand == null) {
  483. console.error("GlobalD.ConfigLand 未初始化设置!");
  484. return;
  485. }
  486. if (_userLeaseLand == null) {
  487. console.error("_userLeaseLand 未初始化设置!");
  488. return;
  489. }
  490. let _configLand = GlobalD.ConfigLand;
  491. if (bSelf) {
  492. let _bInitFarmland = false;
  493. let _landBuildingsInfo = this.BuildingsParent.children;
  494. for (let i = _landBuildingsInfo.length - 1; i >= 0; i--) {
  495. let resetLandInfo = _landBuildingsInfo[i];
  496. if (resetLandInfo.name == "Labour_205_Holy_Farmland") {
  497. let leaseFarmlandInfoScript = resetLandInfo.getComponent("LeaseFarmlandInfo");
  498. //如果存在开锁的土地,重置状态
  499. if (!leaseFarmlandInfoScript.onGetUnlockLandState()) {
  500. leaseFarmlandInfoScript.onLockLand();
  501. }
  502. for (let j = 0; j < _userLeaseLand.length; j++) {
  503. //记录已经租赁的信息(租赁里面包含了seedInfo,如果有种植的话,对应的种植信息会有)
  504. if (_userLeaseLand[j].configLandId == leaseFarmlandInfoScript.initConfigLandId) {
  505. // console.log(leaseFarmlandInfoScript.initConfigLandId);
  506. let _leaseLandInfo = _userLeaseLand[j];
  507. leaseFarmlandInfoScript.setLeaseLandInfo(_leaseLandInfo, bSelf);
  508. }
  509. }
  510. _bInitFarmland = true;
  511. }
  512. }
  513. if (_bInitFarmland) {
  514. console.log("已经初始化过土地数据!");
  515. return;
  516. }
  517. //此时是第一次生成
  518. for (let i = 0; i < _configLand.length; i++) {
  519. //生成默认土地
  520. //农田
  521. let housingTemp_farmland = this.onGetHousingPrefabFromName('Labour_205_Holy_Farmland');
  522. housingTemp_farmland.parent = this.BuildingsParent;
  523. var endPos = GlobalD.TiledMap._getTheMiddleLocationFromtilePos(cc.v2(_configLand[i].posX, _configLand[i].posY));
  524. housingTemp_farmland.setPosition(endPos.x, endPos.y);
  525. let leaseFarmlandInfoScript = housingTemp_farmland.getComponent("LeaseFarmlandInfo");
  526. //记录一下第一次初始化时候的id
  527. leaseFarmlandInfoScript.initConfigLandId = _configLand[i].id;
  528. // console.log(housingTemp_farmland.name +" = "+ leaseFarmlandInfoScript.initConfigLandId);
  529. //记录config的土地信息
  530. leaseFarmlandInfoScript.setConfigLandInfo(_configLand[i]);
  531. for (let j = 0; j < _userLeaseLand.length; j++) {
  532. //记录已经租赁的信息(租赁里面包含了seedInfo,如果有种植的话,对应的种植信息会有)
  533. if (_userLeaseLand[j].configLandId == _configLand[i].id) {
  534. let _leaseLandInfo = _userLeaseLand[j];
  535. leaseFarmlandInfoScript.setLeaseLandInfo(_leaseLandInfo, bSelf);
  536. }
  537. }
  538. let buildingsInfo_farmland = housingTemp_farmland.getComponent("buildingsInfo");
  539. //id用时间戳来记录
  540. buildingsInfo_farmland.buildInfo.id = _configLand[i].id;//对应的id
  541. /**
  542. * 服务器设置的农田 独立于其他游戏数据
  543. * 这步设置之后,addBuilding 时候不存储到 GameData_buildings
  544. */
  545. buildingsInfo_farmland.InitPosFromStore = true;
  546. //设置tile的最底下的坐标,就是起始坐标
  547. buildingsInfo_farmland.buildInfo.startTilePos = cc.v2(_configLand[i].posX, _configLand[i].posY);
  548. this.SpawnBuildingDefaultValue(buildingsInfo_farmland);
  549. //起始坐标,占位范围,是否占位
  550. GlobalD.game.addBuildTiled(buildingsInfo_farmland.buildInfo.id, buildingsInfo_farmland.buildInfo.startTilePos, buildingsInfo_farmland.buildInfo.occupyArea);
  551. //添加占位信息
  552. GlobalD.game.addBuilding(buildingsInfo_farmland);
  553. }
  554. // console.log(this.BuildingsParent.children);
  555. } else {
  556. //访问其他用户时候,已经有土地了
  557. //重置土地信息
  558. let _landBuildingsInfo = this.BuildingsParent.children;
  559. for (let i = _landBuildingsInfo.length - 1; i >= 0; i--) {
  560. let resetLandInfo = _landBuildingsInfo[i];
  561. if (resetLandInfo.name == "Labour_205_Holy_Farmland") {
  562. let leaseFarmlandInfoScript = resetLandInfo.getComponent("LeaseFarmlandInfo");
  563. //如果存在开锁的土地,重置状态
  564. if (!leaseFarmlandInfoScript.onGetUnlockLandState()) {
  565. leaseFarmlandInfoScript.onLockLand();
  566. }
  567. //访问其他农场时候,全部不显示待租按钮
  568. leaseFarmlandInfoScript.onUnlockLand();
  569. for (let j = 0; j < _userLeaseLand.length; j++) {
  570. //记录已经租赁的信息(租赁里面包含了seedInfo,如果有种植的话,对应的种植信息会有)
  571. if (_userLeaseLand[j].configLandId == leaseFarmlandInfoScript.initConfigLandId) {
  572. let _leaseLandInfo = _userLeaseLand[j];
  573. leaseFarmlandInfoScript.setLeaseLandInfo(_leaseLandInfo, bSelf);
  574. }
  575. }
  576. }
  577. }
  578. // console.log("other:", this.BuildingsParent.children);
  579. }
  580. },
  581. /**
  582. * 初始化障碍物
  583. * 生成的预制信息,需要在 DressUpArray 添加对应的预制件,才可以添加
  584. */
  585. spawnDressUp() {
  586. //村长和镇长的区别,樱花树区别
  587. let agent_level = GlobalD.Dapp.UserInfo.agent_level; // 0普通用户,1 村长身份,2 镇长身份
  588. let _cherryTree = 2 === agent_level ? "Dress_505_SmallTree02" : "Dress_505_SmallTree01";
  589. let _temp = [
  590. //左边第一部分 ----start----
  591. {
  592. spawnName: "Dress_502_ChrisTree",
  593. startPos: cc.v2(14, 20)
  594. },
  595. //拱门
  596. {
  597. spawnName: "Dress_505_MainDoor01",
  598. startPos: cc.v2(18, 17)
  599. },
  600. {
  601. spawnName: "Dress_503_RailingGrassX",
  602. startPos: cc.v2(9, 20)
  603. },
  604. {
  605. spawnName: "Dress_503_RailingGrassX",
  606. startPos: cc.v2(7, 20)
  607. },
  608. //-----
  609. {
  610. spawnName: "Dress_505_FlowerBed",
  611. startPos: cc.v2(8, 22)
  612. },
  613. {
  614. spawnName: "Dress_505_FlowerBed",
  615. startPos: cc.v2(8, 23)
  616. },
  617. //喷泉
  618. {
  619. spawnName: "Dress_502_Fountain",
  620. startPos: cc.v2(10, 23)
  621. },
  622. {
  623. spawnName: "Dress_505_FlowerBed",
  624. startPos: cc.v2(11, 22)
  625. },
  626. {
  627. spawnName: "Dress_505_FlowerBed",
  628. startPos: cc.v2(11, 23)
  629. },
  630. {
  631. spawnName: "Dress_505_ChrisSanta",
  632. startPos: cc.v2(10, 25)
  633. },
  634. //-----
  635. //左边第一部分 ----end----
  636. //主路放两个灯和树
  637. {
  638. spawnName: "Dress_505_Streetlight",
  639. startPos: cc.v2(15, 29)
  640. },
  641. {
  642. spawnName: "Dress_505_Streetlight",
  643. startPos: cc.v2(18, 29)
  644. },
  645. {
  646. spawnName: "Dress_505_SmallTree",
  647. startPos: cc.v2(15, 30)
  648. },
  649. {
  650. spawnName: "Dress_505_SmallTree",
  651. startPos: cc.v2(18, 30)
  652. }
  653. ];
  654. //左边小麦区域
  655. // for (let x = 0; x < 3; x++) {
  656. // for (let y = 0; y < 2; y++) {
  657. // _temp.push({
  658. // spawnName: "Dress_502_Rice",
  659. // startPos: cc.v2(4 - x * 2, 30 - y * 2)
  660. // })
  661. // }
  662. // }
  663. //1倍土地部分木质花圃
  664. // for (let x = 0; x < 6; x++) {
  665. // for (let y = 0; y < 3; y++) {
  666. // _temp.push({
  667. // spawnName: "Dress_503_WhiteWoodRailingX",
  668. // startPos: cc.v2(18 + x, 14 - y * 3)
  669. // })
  670. // }
  671. // }
  672. //生成一个未盛开的樱花围绕,间隔1个空格 ---start ,镇长换成盛开的樱花
  673. // for (let x = 0; x < 3; x++) {
  674. // _temp.push({
  675. // spawnName: _cherryTree,
  676. // startPos: cc.v2(18 + x * 2, 17)
  677. // })
  678. // _temp.push({
  679. // spawnName: _cherryTree,
  680. // startPos: cc.v2(18 + x * 2, 5)
  681. // })
  682. // }
  683. // for (let y = 0; y < 7; y++) {
  684. // _temp.push({
  685. // spawnName: _cherryTree,
  686. // startPos: cc.v2(24, 17 - y * 2)
  687. // })
  688. // }
  689. //多倍区域
  690. // for (let x = 0; x < 3; x++) {
  691. // _temp.push({
  692. // spawnName: _cherryTree,
  693. // startPos: cc.v2(15 - x * 2, 14)
  694. // })
  695. // _temp.push({
  696. // spawnName: _cherryTree,
  697. // startPos: cc.v2(15 - x * 2, 2)
  698. // })
  699. // }
  700. //生成一个未盛开的樱花围绕,间隔1个空格 --- end
  701. //多倍土地部分木质花圃
  702. // for (let x = 0; x < 3; x++) {
  703. // for (let y = 0; y < 3; y++) {
  704. // _temp.push({
  705. // spawnName: "Dress_503_RailingGrassX",
  706. // startPos: cc.v2(15 - x * 2, 11 - y * 3)
  707. // })
  708. // }
  709. // }
  710. //生成番茄区域
  711. // for (let x = 0; x < 3; x++) {
  712. // for (let y = 0; y < 2; y++) {
  713. // _temp.push({
  714. // spawnName: "Dress_502_Tomato",
  715. // startPos: cc.v2(26 + x * 2, 30 - y * 2)
  716. // })
  717. // }
  718. // }
  719. //----中上别墅区域--start
  720. //生成中上三个别墅和三个树木
  721. for (let x = 0; x < 3; x++) {
  722. _temp.push({
  723. spawnName: "Dress_505_SmallTree",
  724. startPos: cc.v2(7 - x * 2, 6)
  725. })
  726. _temp.push({
  727. spawnName: "Dress_502_Villa",
  728. startPos: cc.v2(8 - x * 2, 8)
  729. })
  730. }
  731. //雪橇
  732. _temp.push({
  733. spawnName: "Dress_505_ChrisCar02",
  734. startPos: cc.v2(8, 10)
  735. })
  736. //圣诞门和栏杆
  737. for (let x = 0; x < 3; x++) {
  738. _temp.push({
  739. spawnName: "Dress_503_WhiteWoodRailingX",
  740. startPos: cc.v2(8 - x, 11)
  741. })
  742. }
  743. _temp.push({
  744. spawnName: "Dress_503_ChrisDoorX",
  745. startPos: cc.v2(5, 11)
  746. })
  747. for (let x = 0; x < 3; x++) {
  748. _temp.push({
  749. spawnName: "Dress_503_WhiteWoodRailingX",
  750. startPos: cc.v2(4 - x, 11)
  751. })
  752. }
  753. //门外区域
  754. _temp.push({
  755. spawnName: "Dress_502_florist",
  756. startPos: cc.v2(4, 15)
  757. })
  758. _temp.push({
  759. spawnName: "Dress_505_ChrisCar01",
  760. startPos: cc.v2(6, 16)
  761. })
  762. _temp.push({
  763. spawnName: "Dress_505_PondDuck",
  764. startPos: cc.v2(6, 14)
  765. })
  766. for (let y = 0; y < 3; y++) {
  767. _temp.push({
  768. spawnName: "Dress_504_ChrisRailingY",
  769. startPos: cc.v2(8, 16 - y)
  770. })
  771. }
  772. //樱花路
  773. for (let x = 0; x < 5; x++) {
  774. _temp.push({
  775. spawnName: _cherryTree,
  776. startPos: cc.v2(10 - x * 2, 17)
  777. })
  778. _temp.push({
  779. spawnName: _cherryTree,
  780. startPos: cc.v2(10 - x * 2, 19)
  781. })
  782. }
  783. //------end
  784. //----右边区域--start
  785. _temp.push({
  786. spawnName: "Dress_505_Pond",
  787. startPos: cc.v2(20, 3)
  788. })
  789. _temp.push({
  790. spawnName: "Dress_504_RailingGrassY",
  791. startPos: cc.v2(21, 3)
  792. })
  793. _temp.push({
  794. spawnName: "Dress_502_FruitTreeAndStool",
  795. startPos: cc.v2(23, 3)
  796. })
  797. //---- end
  798. for (let i = 0; i < _temp.length; i++) {
  799. for (let j = 0; j < this.DressUpArray.length; j++) {
  800. let _dressUpTemp = this.DressUpArray[j];
  801. if (_dressUpTemp.name == _temp[i].spawnName) {
  802. let prefab = cc.instantiate(_dressUpTemp);
  803. prefab.parent = this.BuildingsParent;
  804. let tipNode = prefab.getChildByName("Tip");
  805. if (tipNode) {
  806. tipNode.destroy();
  807. }
  808. let buildingsInfo = prefab.getComponent("buildingsInfo");
  809. //id用时间戳来记录
  810. buildingsInfo.buildInfo.id = new Date().getTime();//对应的id
  811. buildingsInfo.buildInfo.isItActive = false;
  812. //设置tile的最底下的坐标,就是起始坐标
  813. buildingsInfo.buildInfo.startTilePos = _temp[i].startPos;
  814. buildingsInfo.InitPos = false;
  815. buildingsInfo.InitStartPos = _temp[i].startPos;
  816. var endPos = GlobalD.TiledMap._getTheMiddleLocationFromtilePos(_temp[i].startPos);
  817. prefab.setPosition(endPos.x, endPos.y);
  818. //起始坐标,占位范围,是否占位
  819. GlobalD.game.addBuildTiled(buildingsInfo.buildInfo.id, buildingsInfo.buildInfo.startTilePos, buildingsInfo.buildInfo.occupyArea);
  820. //添加占位信息
  821. GlobalD.game.addBuilding(buildingsInfo);
  822. // console.log(_dressUpTemp.name);
  823. //跳出里面一层循环
  824. break;
  825. }
  826. }
  827. }
  828. },
  829. //初始化场景建筑
  830. SpawnHouse: function () {
  831. let BuildingJSON = Object.assign([], GlobalD.GameData.GameData_buildings);
  832. //拿到数据后,清空 GlobalD.GameData.GameData_buildings 数据,下面再添加上去
  833. GlobalD.GameData.GameData_buildings.length = 0;
  834. // cc.log('BuildingJSON', BuildingJSON);
  835. // if (BuildingJSON.length == 0) {
  836. // //初始化默认房子
  837. // this.SpawnDefaultHouse();
  838. // return
  839. // };
  840. for (let i = 0; i < BuildingJSON.length; i++) {
  841. let HouseName = BuildingJSON[i].buildingNodeName;
  842. let housingTemp = this.onGetHousingPrefabFromName(HouseName);
  843. if (!housingTemp)
  844. cc.error('housingTemp', HouseName, housingTemp);
  845. //预制为空
  846. if (!housingTemp) continue;
  847. let buildingsInfo = housingTemp.getComponent("buildingsInfo");
  848. /**
  849. * 处理数据库数据冲突问题
  850. * 这里处理判断初始化位置是否被占用,占用了回收到仓库背包系统
  851. * BuildingJSON 看做旧的数据, 拿到旧数据 BuildingJSON[i].startTilePos 起始位置 ,生成对应预制的大小occupyArea
  852. * 来判断占位信息
  853. */
  854. // //全部回收
  855. // // 背包添加对应的建筑数量
  856. // GlobalD.game.PlusBuilding(buildingsInfo.buildInfo.buildingName);
  857. // // 删除上面生成的预制节点
  858. // housingTemp.destroy();
  859. // continue;
  860. let _canNotBuild = GlobalD.game.areTheraOverlappingAreas(BuildingJSON[i].startTilePos, buildingsInfo.buildInfo.occupyArea, 1);
  861. if (_canNotBuild) {
  862. // 背包添加对应的建筑数量
  863. GlobalD.game.PlusBuilding(buildingsInfo.buildInfo.buildingName);
  864. // 删除上面生成的预制节点
  865. housingTemp.destroy();
  866. //跳过生成
  867. continue;
  868. }
  869. housingTemp.parent = this.BuildingsParent;
  870. var endPos = GlobalD.TiledMap._getTheMiddleLocationFromtilePos(BuildingJSON[i].startTilePos);
  871. housingTemp.setPosition(endPos.x, endPos.y);
  872. //id用时间戳来记录
  873. buildingsInfo.buildInfo.id = BuildingJSON[i].buildingId;//对应的id
  874. //设置tile的最底下的坐标,就是起始坐标
  875. buildingsInfo.buildInfo.startTilePos = BuildingJSON[i].startTilePos;
  876. //初始化位置的坐标
  877. buildingsInfo.InitStartPos = BuildingJSON[i].startTilePos;
  878. this.SpawnBuildingDefaultValue(buildingsInfo);
  879. //目前应该只有商店,后面根据RunningCost来判断 todo.....
  880. // if (reGameStates.BuildType.Shop == buildingsInfo.buildInfo.buildType)
  881. {
  882. // buildingsInfo.buildInfo.isItSaleable = Number(BuildingJSON[i].isItSaleable) > 0 ? true : false;
  883. buildingsInfo.buildInfo.isItStopOperation = Number(BuildingJSON[i].isItStopOperation) > 0 ? true : false;
  884. //如果不可以运营的,加上牌子
  885. if (buildingsInfo.buildInfo.isItStopOperation) {
  886. GlobalD.game.onAddBuildingTipView(buildingsInfo);
  887. }
  888. }
  889. //建筑物的加成值
  890. buildingsInfo.buildInfo.consumeStrengthAddValue = Number(BuildingJSON[i].consumeStrengthAddValue);
  891. buildingsInfo.buildInfo.goodsPriceAddValue = Number(BuildingJSON[i].goodsPriceAddValue);
  892. /**
  893. * 判断是否占位的时候,需要进一步处理。放回背包,然后背包物品加上对应的数量
  894. */
  895. //起始坐标,占位范围,是否占位
  896. GlobalD.game.addBuildTiled(buildingsInfo.buildInfo.id, buildingsInfo.buildInfo.startTilePos, buildingsInfo.buildInfo.occupyArea);
  897. //添加占位信息
  898. GlobalD.game.addBuilding(buildingsInfo);
  899. }
  900. // console.log("GlobalD.GameData.GameData_buildings:", GlobalD.GameData.GameData_buildings);
  901. },
  902. onGetHousingPrefabFromName(HouseName) {
  903. let housing = null;
  904. //住宿地方
  905. if (HouseName == 'Env_101_house_low') {
  906. housing = cc.instantiate(this.Env_101_house_low);
  907. }
  908. else if (HouseName === 'Env_102_house_mid') {
  909. housing = cc.instantiate(this.Env_102_house_mid);
  910. }
  911. else if (HouseName == 'Env_103_house_high') {
  912. housing = cc.instantiate(this.Env_103_house_high);
  913. }
  914. else if (HouseName == 'Env_104_BlueCastle') {
  915. housing = cc.instantiate(this.Env_104_BlueCastle);
  916. }
  917. else if (HouseName == 'Env_105_PinkCastle') {
  918. housing = cc.instantiate(this.Env_105_PinkCastle);
  919. }
  920. //劳动地方
  921. else if (HouseName == 'Labour_201_Farmland') {
  922. housing = cc.instantiate(this.Labour_201_Farmland);
  923. }
  924. else if (HouseName == 'Labour_202_TimberYard') {
  925. housing = cc.instantiate(this.Labour_202_TimberYard);
  926. }
  927. else if (HouseName == 'Labour_203_MiningPit') {
  928. housing = cc.instantiate(this.Labour_203_MiningPit);
  929. }
  930. else if (HouseName == 'Labour_204_Factory') {
  931. housing = cc.instantiate(this.Labour_204_Factory);
  932. }
  933. //神农专用农田
  934. else if (HouseName == 'Labour_205_Holy_Farmland') {
  935. housing = cc.instantiate(this.Labour_205_Holy_Farmland);
  936. }
  937. //特殊建筑
  938. else if (HouseName == 'Spe_401_StreetLamp') {
  939. housing = cc.instantiate(this.Spe_401_StreetLamp);
  940. }
  941. else if (HouseName == 'Spe_402_GreenBelt') {
  942. housing = cc.instantiate(this.Spe_402_GreenBelt);
  943. }
  944. else if (HouseName == 'Spe_403_FlowerBed') {
  945. housing = cc.instantiate(this.Spe_403_FlowerBed);
  946. }
  947. else if (HouseName == 'Spe_404_Pool') {
  948. housing = cc.instantiate(this.Spe_404_Pool);
  949. }
  950. else if (HouseName == 'Spe_405_PoliceOffice') {
  951. housing = cc.instantiate(this.Spe_405_PoliceOffice);
  952. }
  953. else if (HouseName == 'Spe_406_Playground') {
  954. housing = cc.instantiate(this.Spe_406_Playground);
  955. }
  956. //商店类型
  957. else if (HouseName == 'Shops_30101_ColdDrinkStall') {
  958. housing = cc.instantiate(this.Shops_30101_ColdDrinkStall);
  959. }
  960. else if (HouseName == 'Shops_30102_SalesMachine') {
  961. housing = cc.instantiate(this.Shops_30102_SalesMachine);
  962. }
  963. else if (HouseName == 'Shops_30103_Bakery') {
  964. housing = cc.instantiate(this.Shops_30103_Bakery);
  965. }
  966. else if (HouseName == 'Shops_30104_BreakfastCar') {
  967. housing = cc.instantiate(this.Shops_30104_BreakfastCar);
  968. }
  969. else if (HouseName == 'Shops_30201_TeaShop') {
  970. housing = cc.instantiate(this.Shops_30201_TeaShop);
  971. }
  972. else if (HouseName == 'Shops_30202_confectaurant') {
  973. housing = cc.instantiate(this.Shops_30202_confectaurant);
  974. }
  975. else if (HouseName == 'Shops_30203_GourmetRestaurant') {
  976. housing = cc.instantiate(this.Shops_30203_GourmetRestaurant);
  977. }
  978. else if (HouseName == 'Shops_30204_WesternRestaurant') {
  979. housing = cc.instantiate(this.Shops_30204_WesternRestaurant);
  980. }
  981. else if (HouseName == 'Shops_30301_Florist') {
  982. housing = cc.instantiate(this.Shops_30301_Florist);
  983. }
  984. else if (HouseName == 'Shops_30302_HairSalon') {
  985. housing = cc.instantiate(this.Shops_30302_HairSalon);
  986. }
  987. else if (HouseName == 'Shops_30303_DressShop') {
  988. housing = cc.instantiate(this.Shops_30303_DressShop);
  989. }
  990. else if (HouseName == 'Shops_30304_JewelryStore') {
  991. housing = cc.instantiate(this.Shops_30304_JewelryStore);
  992. }
  993. else if (HouseName == 'Shops_30305_Cinema') {
  994. housing = cc.instantiate(this.Shops_30305_Cinema);
  995. }
  996. return housing;
  997. },
  998. //获取预制的名字
  999. onGetPrefabsBuildingName(index) {
  1000. //content button 设置的index
  1001. let buildingName = '';
  1002. //农舍
  1003. if ('101' == index) {
  1004. buildingName = 'Env_101_house_low';
  1005. }
  1006. //单元楼
  1007. else if ('102' == index) {
  1008. buildingName = 'Env_102_house_mid';
  1009. }
  1010. //别墅
  1011. else if ('103' == index) {
  1012. buildingName = 'Env_103_house_high';
  1013. }
  1014. //蓝色城堡
  1015. else if ('104' == index) {
  1016. buildingName = 'Env_104_BlueCastle';
  1017. }
  1018. //粉色城堡
  1019. else if ('105' == index) {
  1020. buildingName = 'Env_105_PinkCastle';
  1021. }
  1022. //农田
  1023. else if ('201' == index) {
  1024. buildingName = 'Labour_201_Farmland';
  1025. }
  1026. //伐木场
  1027. else if ('202' == index) {
  1028. buildingName = 'Labour_202_TimberYard';
  1029. }
  1030. //矿坑
  1031. else if ('203' == index) {
  1032. buildingName = 'Labour_203_MiningPit';
  1033. }
  1034. //工厂
  1035. else if ('204' == index) {
  1036. buildingName = 'Labour_204_Factory';
  1037. }
  1038. //神农专用农田
  1039. else if ('205' == index) {
  1040. buildingName = 'Labour_205_Holy_Farmland';
  1041. }
  1042. //冷饮摊
  1043. else if ('30101' == index) {
  1044. buildingName = 'Shops_30101_ColdDrinkStall';
  1045. }
  1046. //贩卖机
  1047. else if ('30102' == index) {
  1048. buildingName = 'Shops_30102_SalesMachine';
  1049. }
  1050. //面包房
  1051. else if ('30103' == index) {
  1052. buildingName = 'Shops_30103_Bakery';
  1053. }
  1054. //早餐车
  1055. else if ('30104' == index) {
  1056. buildingName = 'Shops_30104_BreakfastCar';
  1057. }
  1058. //饮茶店
  1059. else if ('30201' == index) {
  1060. buildingName = 'Shops_30201_TeaShop';
  1061. }
  1062. //点心店
  1063. else if ('30202' == index) {
  1064. buildingName = 'Shops_30202_confectaurant';
  1065. }
  1066. //美食店
  1067. else if ('30203' == index) {
  1068. buildingName = 'Shops_30203_GourmetRestaurant';
  1069. }
  1070. //西餐厅
  1071. else if ('30204' == index) {
  1072. buildingName = 'Shops_30204_WesternRestaurant';
  1073. }
  1074. //花店
  1075. else if ('30301' == index) {
  1076. buildingName = 'Shops_30301_Florist';
  1077. }
  1078. //美发店
  1079. else if ('30302' == index) {
  1080. buildingName = 'Shops_30302_HairSalon';
  1081. }
  1082. //洋装店
  1083. else if ('30303' == index) {
  1084. buildingName = 'Shops_30303_DressShop';
  1085. }
  1086. //珠宝店
  1087. else if ('30304' == index) {
  1088. buildingName = 'Shops_30304_JewelryStore';
  1089. }
  1090. //电影院
  1091. else if ('30305' == index) {
  1092. buildingName = 'Shops_30305_Cinema';
  1093. }
  1094. //路灯
  1095. else if ('401' == index) {
  1096. buildingName = 'Spe_401_StreetLamp';
  1097. }
  1098. //绿化带
  1099. else if ('402' == index) {
  1100. buildingName = 'Spe_402_GreenBelt';
  1101. }
  1102. //花坛
  1103. else if ('403' == index) {
  1104. buildingName = 'Spe_403_FlowerBed';
  1105. }
  1106. //喷泉
  1107. else if ('404' == index) {
  1108. buildingName = 'Spe_404_Pool';
  1109. }
  1110. //警察局
  1111. else if ('405' == index) {
  1112. buildingName = 'Spe_405_PoliceOffice';
  1113. }
  1114. //游乐场
  1115. else if ('406' == index) {
  1116. buildingName = 'Spe_406_Playground';
  1117. }
  1118. return buildingName;
  1119. },
  1120. Grant() {
  1121. },
  1122. Sale() {
  1123. },
  1124. Exchange() {
  1125. }
  1126. });