174 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
		
		
			
		
	
	
			174 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
|  | import { Vec2, v2 } from "cc"; | ||
|  | import { NpkImage } from "../Tool/NPKImage"; | ||
|  | 
 | ||
|  | /// 地块类型
 | ||
|  | export enum MapTileType { | ||
|  |   /// 赫顿玛尔
 | ||
|  |   HeDunMaEr, | ||
|  |   /// 时间广场
 | ||
|  |   ShiJianGuangChang, | ||
|  |   /// 兽人峡谷
 | ||
|  |   ShouRenXiaGu, | ||
|  |   /// 超时空漩涡
 | ||
|  |   ChaoShiKongXuanWo, | ||
|  |   /// 恐怖的栖息地
 | ||
|  |   KongBuDeQiXiDi, | ||
|  |   /// 红色魔女之森
 | ||
|  |   HongSeMoNvZhiSen, | ||
|  | 
 | ||
|  |   /// 月光酒馆
 | ||
|  |   YueGuangJiuGuan, | ||
|  |   /// 哈林的命运硬币(左边)
 | ||
|  |   HaLinMingYunYinBi, | ||
|  |   /// 亡命杀阵
 | ||
|  |   WangMingShaZhen, | ||
|  |   /// 皇家娱乐
 | ||
|  |   HuangJaiYuLe, | ||
|  |   /// 黑暗都市
 | ||
|  |   AnHeiDuShi, | ||
|  |   /// 第九隔离区
 | ||
|  |   DiJiuGeLiQu, | ||
|  | 
 | ||
|  |   /// 决斗场
 | ||
|  |   JueDouChang, | ||
|  |   /// 腐坏街道
 | ||
|  |   FuHuaiJieDao, | ||
|  |   /// 溢血的地下城
 | ||
|  |   YiXueDeDiXiaChen, | ||
|  |   /// 普雷·伊西斯
 | ||
|  |   PuLeiYiXiSi, | ||
|  |   /// 沉重的礼拜堂
 | ||
|  |   ChenZhongDeLiBaiTang, | ||
|  |   /// 螺旋王国
 | ||
|  |   LuoXuanWangGuo, | ||
|  | 
 | ||
|  |   /// 海上列车
 | ||
|  |   HaiShangLieChe, | ||
|  |   /// 切斯特小镇的命运硬币(右边)
 | ||
|  |   XiaoZhenMingYunYinBi, | ||
|  |   /// 暗黑神殿
 | ||
|  |   AnHeiShenDian, | ||
|  |   /// 痛苦地下城
 | ||
|  |   TongKuDiXiaChen, | ||
|  |   /// 无底坑道
 | ||
|  |   WuDiKenDao, | ||
|  |   /// 记忆之地
 | ||
|  |   JiYiZhiDi, | ||
|  | } | ||
|  | 
 | ||
|  | /// 地块方向
 | ||
|  | export enum MapTileDirection { | ||
|  |   /// 横
 | ||
|  |   horizontal = 24, | ||
|  |   /// 竖
 | ||
|  |   vertical = 25, | ||
|  |   /// 角落
 | ||
|  |   nook = 26, | ||
|  | } | ||
|  | 
 | ||
|  | /// 地块的数据
 | ||
|  | export class MapTileData { | ||
|  |   /// 坐标
 | ||
|  |   location: Vec2; | ||
|  |   /// npk路径
 | ||
|  |   npkPath: NpkImage; | ||
|  |   /// 地块背景index
 | ||
|  |   backgroundIndex: number; | ||
|  |   /// 地块名称图片index
 | ||
|  |   nameIndex: number; | ||
|  |   /// 地块方向
 | ||
|  |   direction: MapTileDirection; | ||
|  |   /// 怪物相关数据
 | ||
|  | 
 | ||
|  |   /// 列车选择许可
 | ||
|  |   trainsSelectLicense: boolean; | ||
|  |   /// 决斗场选择许可
 | ||
|  |   duelSelectLicense: boolean; | ||
|  |   /// 占领许可
 | ||
|  |   occupyLicense: boolean; | ||
|  | 
 | ||
|  |     constructor({ | ||
|  |       /// 坐标
 | ||
|  |       location, | ||
|  |       /// 背景index
 | ||
|  |       backgroundIndex, | ||
|  |       /// 名称index
 | ||
|  |       nameIndex, | ||
|  |       /// 地块方向
 | ||
|  |       direction, | ||
|  |       /// 占领许可
 | ||
|  |       occupyLicense = true, | ||
|  |       /// 列车选择许可
 | ||
|  |       trainsSelectLicense, | ||
|  |       /// 决斗场选择许可
 | ||
|  |       duelSelectLicense, | ||
|  |     }: { | ||
|  |       location: Vec2; | ||
|  |       backgroundIndex?: number; | ||
|  |       nameIndex?: number; | ||
|  |       direction: MapTileDirection; | ||
|  |       occupyLicense?: boolean; | ||
|  |       trainsSelectLicense: boolean; | ||
|  |       duelSelectLicense: boolean; | ||
|  |     }) { | ||
|  |       this.location = location; | ||
|  |       this.npkPath = NpkImage.board; | ||
|  |       this.backgroundIndex = backgroundIndex; | ||
|  |       this.nameIndex = nameIndex; | ||
|  |       this.direction = direction; | ||
|  | 
 | ||
|  |       this.trainsSelectLicense = trainsSelectLicense; | ||
|  |       this.duelSelectLicense = duelSelectLicense; | ||
|  |       this.occupyLicense = occupyLicense; | ||
|  |     } | ||
|  | } | ||
|  | 
 | ||
|  | export class MapTileFactory { | ||
|  |   static getData(type: MapTileType): MapTileData{ | ||
|  | 
 | ||
|  |     // const tts = type as MapTileType;
 | ||
|  |     // const ss = tts == MapTileType.HeDunMaEr;
 | ||
|  |     // const nn = Number(type);
 | ||
|  |     // const aa = +type;
 | ||
|  |     // const tttt: MapTileType = MapTileType.HeDunMaEr;
 | ||
|  | 
 | ||
|  |     switch (type) { | ||
|  |       /// 赫顿玛尔
 | ||
|  |       case MapTileType.HeDunMaEr: | ||
|  |         console.log(type); | ||
|  |         return MapTileFactory.HeDunMaErData; | ||
|  |       /// 时间广场
 | ||
|  |       case MapTileType.ShiJianGuangChang: | ||
|  |         console.log(type); | ||
|  |           return MapTileFactory.ShiJianGuangChangData; | ||
|  |     } | ||
|  | 
 | ||
|  |     console.log(type); | ||
|  |   } | ||
|  | 
 | ||
|  |   // 赫顿玛尔
 | ||
|  |   private static HeDunMaErData = new MapTileData({ | ||
|  |     location: v2(507, -500), | ||
|  |     direction: MapTileDirection.nook, | ||
|  |     trainsSelectLicense: true, | ||
|  |     duelSelectLicense: false, | ||
|  |     occupyLicense: false, | ||
|  |   }); | ||
|  | 
 | ||
|  |   /// 时间广场
 | ||
|  |   private static ShiJianGuangChangData = new MapTileData({ | ||
|  |     location: v2(507, -500), | ||
|  |     backgroundIndex: 1, | ||
|  |     direction: MapTileDirection.horizontal, | ||
|  |     trainsSelectLicense: true, | ||
|  |     duelSelectLicense: true, | ||
|  |     occupyLicense: true, | ||
|  |   }); | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  | } |