Newer
Older
DungeonShooting / DungeonShooting_Godot / src / game / room / AutoTileConfig.cs
@小李xl 小李xl on 19 Feb 2024 26 KB 解决Tile层级显示错误
  1.  
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using Godot;
  5.  
  6. /// <summary>
  7. /// 房间图块配置信息
  8. /// </summary>
  9. public class AutoTileConfig
  10. {
  11. public TileCellData Floor;
  12. public TileCellData TopMask;
  13. public TileCellData Wall_Bottom;
  14. public TileCellData Wall_Left;
  15. public TileCellData Wall_Right;
  16. public TileCellData Wall_Top;
  17. public TileCellData Wall_Out_LB;
  18. public TileCellData Wall_Out_LT;
  19. public TileCellData Wall_Out_RB;
  20. public TileCellData Wall_Out_RT;
  21. public TileCellData Wall_In_LT;
  22. public TileCellData Wall_In_LB;
  23. public TileCellData Wall_In_RT;
  24. public TileCellData Wall_In_RB;
  25. public TileCellData Wall_Vertical_LeftTop;
  26. public TileCellData Wall_Vertical_CenterTop;
  27. public TileCellData Wall_Vertical_RightTop;
  28. public TileCellData Wall_Vertical_SingleTop;
  29. public TileCellData Wall_Vertical_LeftBottom;
  30. public TileCellData Wall_Vertical_CenterBottom;
  31. public TileCellData Wall_Vertical_RightBottom;
  32. public TileCellData Wall_Vertical_SingleBottom;
  33. //----------------------------- 所有自动图块数据 -----------------------------
  34. //----------------------------- 命名规则: Auto_ + LT + T + RT + _ + L + C + R + _ + LB + B + RB
  35. //第一列
  36. public TileCellData Auto_000_010_010;
  37. public TileCellData Auto_010_010_010;
  38. public TileCellData Auto_010_010_000;
  39. public TileCellData Auto_000_010_000;
  40. //第二列
  41. public TileCellData Auto_000_011_010;
  42. public TileCellData Auto_010_011_010;
  43. public TileCellData Auto_010_011_000;
  44. public TileCellData Auto_000_011_000;
  45. //第三列
  46. public TileCellData Auto_000_111_010;
  47. public TileCellData Auto_010_111_010;
  48. public TileCellData Auto_010_111_000;
  49. public TileCellData Auto_000_111_000;
  50. //第四列
  51. public TileCellData Auto_000_110_010;
  52. public TileCellData Auto_010_110_010;
  53. public TileCellData Auto_010_110_000;
  54. public TileCellData Auto_000_110_000;
  55. //第五列
  56. public TileCellData Auto_110_111_010;
  57. public TileCellData Auto_010_011_011;
  58. public TileCellData Auto_011_011_010;
  59. public TileCellData Auto_010_111_110;
  60. //第六列
  61. public TileCellData Auto_000_111_011;
  62. public TileCellData Auto_011_111_111;
  63. public TileCellData Auto_111_111_011;
  64. public TileCellData Auto_011_111_000;
  65. //第七列
  66. public TileCellData Auto_000_111_110;
  67. public TileCellData Auto_110_111_111;
  68. public TileCellData Auto_111_111_110;
  69. public TileCellData Auto_110_111_000;
  70. //第八列
  71. public TileCellData Auto_011_111_010;
  72. public TileCellData Auto_010_110_110;
  73. public TileCellData Auto_110_110_010;
  74. public TileCellData Auto_010_111_011;
  75. //第九列
  76. public TileCellData Auto_000_011_011;
  77. public TileCellData Auto_011_011_011;
  78. public TileCellData Auto_011_111_011;
  79. public TileCellData Auto_011_011_000;
  80. //第十列
  81. public TileCellData Auto_010_111_111;
  82. public TileCellData Auto_110_111_011;
  83. public TileCellData Auto_111_111_111;
  84. public TileCellData Auto_111_111_000;
  85. //第十一列
  86. public TileCellData Auto_000_111_111;
  87. public TileCellData Auto_011_111_110;
  88. public TileCellData Auto_111_111_010;
  89. //第十二列
  90. public TileCellData Auto_000_110_110;
  91. public TileCellData Auto_110_111_110;
  92. public TileCellData Auto_110_110_110;
  93. public TileCellData Auto_110_110_000;
  94. //-------------------------------------------------------------------------
  95.  
  96. /// <summary>
  97. /// 所属资源Id
  98. /// </summary>
  99. public int SourceId { get; private set; }
  100. /// <summary>
  101. /// 原地形配置数据
  102. /// </summary>
  103. public TileSetTerrainInfo TerrainInfo { get; private set; }
  104. private Dictionary<Vector2I, TileCellData> _mapping = new Dictionary<Vector2I, TileCellData>();
  105.  
  106. public AutoTileConfig(int sourceId, TileSetTerrainInfo terrainInfo)
  107. {
  108. SourceId = sourceId;
  109. TerrainInfo = terrainInfo;
  110. if (terrainInfo.T != null)
  111. {
  112. foreach (var keyValuePair in terrainInfo.T)
  113. {
  114. HandlerTileData(keyValuePair.Key, sourceId, terrainInfo.GetPosition(keyValuePair.Value));
  115. }
  116. }
  117.  
  118. if (terrainInfo.M != null)
  119. {
  120. int[] data;
  121. if (terrainInfo.M.TryGetValue(0, out data))
  122. {
  123. Wall_Vertical_SingleTop = new TileCellData(sourceId, terrainInfo.GetPosition(data), 0, TileSetTerrainInfo.MiddleLayerType, MapLayer.AutoMiddleLayer);
  124. }
  125. if (terrainInfo.M.TryGetValue(1, out data))
  126. {
  127. Wall_Vertical_LeftTop = new TileCellData(sourceId, terrainInfo.GetPosition(data), 1, TileSetTerrainInfo.MiddleLayerType, MapLayer.AutoMiddleLayer);
  128. }
  129. if (terrainInfo.M.TryGetValue(2, out data))
  130. {
  131. Wall_Vertical_CenterTop = new TileCellData(sourceId, terrainInfo.GetPosition(data), 2, TileSetTerrainInfo.MiddleLayerType, MapLayer.AutoMiddleLayer);
  132. }
  133. if (terrainInfo.M.TryGetValue(3, out data))
  134. {
  135. Wall_Vertical_RightTop = new TileCellData(sourceId, terrainInfo.GetPosition(data), 3, TileSetTerrainInfo.MiddleLayerType, MapLayer.AutoMiddleLayer);
  136. }
  137. if (terrainInfo.M.TryGetValue(4, out data))
  138. {
  139. Wall_Vertical_SingleBottom= new TileCellData(sourceId, terrainInfo.GetPosition(data), 4, TileSetTerrainInfo.MiddleLayerType, MapLayer.AutoMiddleLayer);
  140. }
  141. if (terrainInfo.M.TryGetValue(5, out data))
  142. {
  143. Wall_Vertical_LeftBottom = new TileCellData(sourceId, terrainInfo.GetPosition(data), 5, TileSetTerrainInfo.MiddleLayerType, MapLayer.AutoMiddleLayer);
  144. }
  145. if (terrainInfo.M.TryGetValue(6, out data))
  146. {
  147. Wall_Vertical_CenterBottom = new TileCellData(sourceId, terrainInfo.GetPosition(data), 6, TileSetTerrainInfo.MiddleLayerType, MapLayer.AutoMiddleLayer);
  148. }
  149. if (terrainInfo.M.TryGetValue(7, out data))
  150. {
  151. Wall_Vertical_RightBottom = new TileCellData(sourceId, terrainInfo.GetPosition(data), 7, TileSetTerrainInfo.MiddleLayerType, MapLayer.AutoMiddleLayer);
  152. }
  153. }
  154. if (terrainInfo.F != null)
  155. {
  156. if (terrainInfo.F.TryGetValue(0, out var data))
  157. {
  158. Floor = new TileCellData(sourceId, terrainInfo.GetPosition(data), 0, TileSetTerrainInfo.FloorLayerType, MapLayer.AutoFloorLayer);
  159. }
  160. }
  161. TopMask = Auto_111_111_111;
  162. Wall_Bottom = Auto_000_111_111;
  163. Wall_Left = Auto_110_110_110;
  164. Wall_Right = Auto_011_011_011;
  165. Wall_Top = Auto_111_111_000;
  166.  
  167. Wall_Out_LB = Auto_011_011_000;
  168. Wall_Out_LT = Auto_000_011_011;
  169. Wall_Out_RB = Auto_110_110_000;
  170. Wall_Out_RT = Auto_000_110_110;
  171.  
  172. Wall_In_LT = Auto_111_111_110;
  173. Wall_In_LB = Auto_110_111_111;
  174. Wall_In_RT = Auto_111_111_011;
  175. Wall_In_RB = Auto_011_111_111;
  176.  
  177. HandlerMapping();
  178. HandlerOtherCellMapping();
  179. }
  180.  
  181. public int GetLayer(Vector2I atlasCoords)
  182. {
  183. if (_mapping.TryGetValue(atlasCoords, out var tile))
  184. {
  185. return tile.DefaultLayer;
  186. }
  187.  
  188. return MapLayer.AutoFloorLayer;
  189. }
  190.  
  191. public TileCellData GetCellData(Vector2I atlasCoords)
  192. {
  193. _mapping.TryGetValue(atlasCoords, out var tile);
  194. return tile;
  195. }
  196.  
  197. private void HandlerTileData(uint peeringValue, int sourceId, Vector2I pos)
  198. {
  199. switch (peeringValue)
  200. {
  201. //第一列
  202. case TerrainPeering.Center | TerrainPeering.Bottom:
  203. Auto_000_010_010 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  204. break;
  205. case TerrainPeering.Top | TerrainPeering.Center | TerrainPeering.Bottom:
  206. Auto_010_010_010 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  207. break;
  208. case TerrainPeering.Top | TerrainPeering.Center:
  209. Auto_010_010_000 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  210. break;
  211. case TerrainPeering.Center:
  212. Auto_000_010_000 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  213. break;
  214. //第二列
  215. case TerrainPeering.Center | TerrainPeering.Right | TerrainPeering.Bottom:
  216. Auto_000_011_010 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  217. break;
  218. case TerrainPeering.Top | TerrainPeering.Center | TerrainPeering.Right | TerrainPeering.Bottom:
  219. Auto_010_011_010 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  220. break;
  221. case TerrainPeering.Top | TerrainPeering.Center | TerrainPeering.Right:
  222. Auto_010_011_000 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  223. break;
  224. case TerrainPeering.Center | TerrainPeering.Right:
  225. Auto_000_011_000 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  226. break;
  227. //第三列
  228. case TerrainPeering.Left | TerrainPeering.Center | TerrainPeering.Right | TerrainPeering.Bottom:
  229. Auto_000_111_010 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  230. break;
  231. case TerrainPeering.Top | TerrainPeering.Left | TerrainPeering.Center | TerrainPeering.Right |
  232. TerrainPeering.Bottom:
  233. Auto_010_111_010 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  234. break;
  235. case TerrainPeering.Top | TerrainPeering.Left | TerrainPeering.Center | TerrainPeering.Right:
  236. Auto_010_111_000 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  237. break;
  238. case TerrainPeering.Left | TerrainPeering.Center | TerrainPeering.Right:
  239. Auto_000_111_000 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  240. break;
  241. //第四列
  242. case TerrainPeering.Left | TerrainPeering.Center | TerrainPeering.Bottom:
  243. Auto_000_110_010 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  244. break;
  245. case TerrainPeering.Top | TerrainPeering.Left | TerrainPeering.Center | TerrainPeering.Bottom:
  246. Auto_010_110_010 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  247. break;
  248. case TerrainPeering.Top | TerrainPeering.Left | TerrainPeering.Center:
  249. Auto_010_110_000 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  250. break;
  251. case TerrainPeering.Left | TerrainPeering.Center:
  252. Auto_000_110_000 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  253. break;
  254. //第五列
  255. case TerrainPeering.LeftTop | TerrainPeering.Top | TerrainPeering.Left | TerrainPeering.Center |
  256. TerrainPeering.Right | TerrainPeering.Bottom:
  257. Auto_110_111_010 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  258. break;
  259. case TerrainPeering.Top | TerrainPeering.Center | TerrainPeering.Right | TerrainPeering.Bottom |
  260. TerrainPeering.RightBottom:
  261. Auto_010_011_011 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  262. break;
  263. case TerrainPeering.Top | TerrainPeering.RightTop | TerrainPeering.Center | TerrainPeering.Right |
  264. TerrainPeering.Bottom:
  265. Auto_011_011_010 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  266. break;
  267. case TerrainPeering.Top | TerrainPeering.Left | TerrainPeering.Center | TerrainPeering.Right |
  268. TerrainPeering.LeftBottom | TerrainPeering.Bottom:
  269. Auto_010_111_110 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  270. break;
  271. //第六列
  272. case TerrainPeering.Left | TerrainPeering.Center | TerrainPeering.Right | TerrainPeering.Bottom |
  273. TerrainPeering.RightBottom:
  274. Auto_000_111_011 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  275. break;
  276. case TerrainPeering.Top | TerrainPeering.RightTop | TerrainPeering.Left | TerrainPeering.Center |
  277. TerrainPeering.Right | TerrainPeering.LeftBottom | TerrainPeering.Bottom | TerrainPeering.RightBottom:
  278. Auto_011_111_111 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  279. break;
  280. case TerrainPeering.LeftTop | TerrainPeering.Top | TerrainPeering.RightTop | TerrainPeering.Left |
  281. TerrainPeering.Center | TerrainPeering.Right | TerrainPeering.Bottom | TerrainPeering.RightBottom:
  282. Auto_111_111_011 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  283. break;
  284. case TerrainPeering.Top | TerrainPeering.RightTop | TerrainPeering.Left | TerrainPeering.Center |
  285. TerrainPeering.Right:
  286. Auto_011_111_000 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  287. break;
  288. //第七列
  289. case TerrainPeering.Left | TerrainPeering.Center | TerrainPeering.Right | TerrainPeering.LeftBottom |
  290. TerrainPeering.Bottom:
  291. Auto_000_111_110 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  292. break;
  293. case TerrainPeering.LeftTop | TerrainPeering.Top | TerrainPeering.Left | TerrainPeering.Center |
  294. TerrainPeering.Right | TerrainPeering.LeftBottom | TerrainPeering.Bottom | TerrainPeering.RightBottom:
  295. Auto_110_111_111 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  296. break;
  297. case TerrainPeering.LeftTop | TerrainPeering.Top | TerrainPeering.RightTop | TerrainPeering.Left |
  298. TerrainPeering.Center | TerrainPeering.Right | TerrainPeering.LeftBottom | TerrainPeering.Bottom:
  299. Auto_111_111_110 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  300. break;
  301. case TerrainPeering.LeftTop | TerrainPeering.Top | TerrainPeering.Left | TerrainPeering.Center |
  302. TerrainPeering.Right:
  303. Auto_110_111_000 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  304. break;
  305. //第八列
  306. case TerrainPeering.Top | TerrainPeering.RightTop | TerrainPeering.Left | TerrainPeering.Center |
  307. TerrainPeering.Right | TerrainPeering.Bottom:
  308. Auto_011_111_010 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  309. break;
  310. case TerrainPeering.Top | TerrainPeering.Left | TerrainPeering.Center | TerrainPeering.LeftBottom |
  311. TerrainPeering.Bottom:
  312. Auto_010_110_110 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  313. break;
  314. case TerrainPeering.LeftTop | TerrainPeering.Top | TerrainPeering.Left | TerrainPeering.Center |
  315. TerrainPeering.Bottom:
  316. Auto_110_110_010 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  317. break;
  318. case TerrainPeering.Top | TerrainPeering.Left | TerrainPeering.Center | TerrainPeering.Right |
  319. TerrainPeering.Bottom | TerrainPeering.RightBottom:
  320. Auto_010_111_011 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  321. break;
  322. //第九列
  323. case TerrainPeering.Center | TerrainPeering.Right | TerrainPeering.Bottom | TerrainPeering.RightBottom:
  324. Auto_000_011_011 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  325. break;
  326. case TerrainPeering.Top | TerrainPeering.RightTop | TerrainPeering.Center | TerrainPeering.Right |
  327. TerrainPeering.Bottom | TerrainPeering.RightBottom:
  328. Auto_011_011_011 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  329. break;
  330. case TerrainPeering.Top | TerrainPeering.RightTop | TerrainPeering.Left | TerrainPeering.Center |
  331. TerrainPeering.Right | TerrainPeering.Bottom | TerrainPeering.RightBottom:
  332. Auto_011_111_011 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  333. break;
  334. case TerrainPeering.Top | TerrainPeering.RightTop | TerrainPeering.Center | TerrainPeering.Right:
  335. Auto_011_011_000 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  336. break;
  337. //第十列
  338. case TerrainPeering.Top | TerrainPeering.Left | TerrainPeering.Center | TerrainPeering.Right |
  339. TerrainPeering.LeftBottom | TerrainPeering.Bottom | TerrainPeering.RightBottom:
  340. Auto_010_111_111 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  341. break;
  342. case TerrainPeering.LeftTop | TerrainPeering.Top | TerrainPeering.Left | TerrainPeering.Center |
  343. TerrainPeering.Right | TerrainPeering.Bottom | TerrainPeering.RightBottom:
  344. Auto_110_111_011 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  345. break;
  346. case TerrainPeering.LeftTop | TerrainPeering.Top | TerrainPeering.RightTop | TerrainPeering.Left |
  347. TerrainPeering.Center | TerrainPeering.Right | TerrainPeering.LeftBottom | TerrainPeering.Bottom |
  348. TerrainPeering.RightBottom:
  349. Auto_111_111_111 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  350. break;
  351. case TerrainPeering.LeftTop | TerrainPeering.Top | TerrainPeering.RightTop | TerrainPeering.Left |
  352. TerrainPeering.Center | TerrainPeering.Right:
  353. Auto_111_111_000 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  354. break;
  355. //第十一列
  356. case TerrainPeering.Left | TerrainPeering.Center | TerrainPeering.Right | TerrainPeering.LeftBottom |
  357. TerrainPeering.Bottom | TerrainPeering.RightBottom:
  358. Auto_000_111_111 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  359. break;
  360. case TerrainPeering.Top | TerrainPeering.RightTop | TerrainPeering.Left | TerrainPeering.Center |
  361. TerrainPeering.Right | TerrainPeering.LeftBottom | TerrainPeering.Bottom:
  362. Auto_011_111_110 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  363. break;
  364. case TerrainPeering.LeftTop | TerrainPeering.Top | TerrainPeering.RightTop | TerrainPeering.Left |
  365. TerrainPeering.Center | TerrainPeering.Right | TerrainPeering.Bottom:
  366. Auto_111_111_010 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  367. break;
  368. //第十二列
  369. case TerrainPeering.Left | TerrainPeering.Center | TerrainPeering.LeftBottom | TerrainPeering.Bottom:
  370. Auto_000_110_110 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  371. break;
  372. case TerrainPeering.LeftTop | TerrainPeering.Top | TerrainPeering.Left | TerrainPeering.Center |
  373. TerrainPeering.Right | TerrainPeering.LeftBottom | TerrainPeering.Bottom:
  374. Auto_110_111_110 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  375. break;
  376. case TerrainPeering.LeftTop | TerrainPeering.Top | TerrainPeering.Left | TerrainPeering.Center |
  377. TerrainPeering.LeftBottom | TerrainPeering.Bottom:
  378. Auto_110_110_110 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  379. break;
  380. case TerrainPeering.LeftTop | TerrainPeering.Top | TerrainPeering.Left | TerrainPeering.Center:
  381. Auto_110_110_000 = new TileCellData(sourceId, pos, peeringValue, TileSetTerrainInfo.TerrainLayerType, MapLayer.AutoTopLayer);
  382. break;
  383.  
  384. default:
  385. Debug.LogError("未知PeeringValue: " + peeringValue);
  386. break;
  387. }
  388. }
  389.  
  390.  
  391. private void HandlerMapping()
  392. {
  393. //第一列
  394. _mapping.Add(Auto_000_010_010.AutoTileCoords, Auto_000_010_010);
  395. _mapping.Add(Auto_010_010_010.AutoTileCoords, Auto_010_010_010);
  396. _mapping.Add(Auto_010_010_000.AutoTileCoords, Auto_010_010_000);
  397. _mapping.Add(Auto_000_010_000.AutoTileCoords, Auto_000_010_000);
  398. //第二列
  399. _mapping.Add(Auto_000_011_010.AutoTileCoords, Auto_000_011_010);
  400. _mapping.Add(Auto_010_011_010.AutoTileCoords, Auto_010_011_010);
  401. _mapping.Add(Auto_010_011_000.AutoTileCoords, Auto_010_011_000);
  402. _mapping.Add(Auto_000_011_000.AutoTileCoords, Auto_000_011_000);
  403. //第三列
  404. _mapping.Add(Auto_000_111_010.AutoTileCoords, Auto_000_111_010);
  405. _mapping.Add(Auto_010_111_010.AutoTileCoords, Auto_010_111_010);
  406. _mapping.Add(Auto_010_111_000.AutoTileCoords, Auto_010_111_000);
  407. _mapping.Add(Auto_000_111_000.AutoTileCoords, Auto_000_111_000);
  408. //第四列
  409. _mapping.Add(Auto_000_110_010.AutoTileCoords, Auto_000_110_010);
  410. _mapping.Add(Auto_010_110_010.AutoTileCoords, Auto_010_110_010);
  411. _mapping.Add(Auto_010_110_000.AutoTileCoords, Auto_010_110_000);
  412. _mapping.Add(Auto_000_110_000.AutoTileCoords, Auto_000_110_000);
  413. //第五列
  414. _mapping.Add(Auto_110_111_010.AutoTileCoords, Auto_110_111_010);
  415. _mapping.Add(Auto_010_011_011.AutoTileCoords, Auto_010_011_011);
  416. _mapping.Add(Auto_011_011_010.AutoTileCoords, Auto_011_011_010);
  417. _mapping.Add(Auto_010_111_110.AutoTileCoords, Auto_010_111_110);
  418. //第六列
  419. _mapping.Add(Auto_000_111_011.AutoTileCoords, Auto_000_111_011);
  420. _mapping.Add(Auto_011_111_111.AutoTileCoords, Auto_011_111_111);
  421. _mapping.Add(Auto_111_111_011.AutoTileCoords, Auto_111_111_011);
  422. _mapping.Add(Auto_011_111_000.AutoTileCoords, Auto_011_111_000);
  423. //第七列
  424. _mapping.Add(Auto_000_111_110.AutoTileCoords, Auto_000_111_110);
  425. _mapping.Add(Auto_110_111_111.AutoTileCoords, Auto_110_111_111);
  426. _mapping.Add(Auto_111_111_110.AutoTileCoords, Auto_111_111_110);
  427. _mapping.Add(Auto_110_111_000.AutoTileCoords, Auto_110_111_000);
  428. //第八列
  429. _mapping.Add(Auto_011_111_010.AutoTileCoords, Auto_011_111_010);
  430. _mapping.Add(Auto_010_110_110.AutoTileCoords, Auto_010_110_110);
  431. _mapping.Add(Auto_110_110_010.AutoTileCoords, Auto_110_110_010);
  432. _mapping.Add(Auto_010_111_011.AutoTileCoords, Auto_010_111_011);
  433. //第九列
  434. _mapping.Add(Auto_000_011_011.AutoTileCoords, Auto_000_011_011);
  435. _mapping.Add(Auto_011_011_011.AutoTileCoords, Auto_011_011_011);
  436. _mapping.Add(Auto_011_111_011.AutoTileCoords, Auto_011_111_011);
  437. _mapping.Add(Auto_011_011_000.AutoTileCoords, Auto_011_011_000);
  438. //第十列
  439. _mapping.Add(Auto_010_111_111.AutoTileCoords, Auto_010_111_111);
  440. _mapping.Add(Auto_110_111_011.AutoTileCoords, Auto_110_111_011);
  441. _mapping.Add(Auto_111_111_111.AutoTileCoords, Auto_111_111_111);
  442. _mapping.Add(Auto_111_111_000.AutoTileCoords, Auto_111_111_000);
  443. //第十一列
  444. _mapping.Add(Auto_000_111_111.AutoTileCoords, Auto_000_111_111);
  445. _mapping.Add(Auto_011_111_110.AutoTileCoords, Auto_011_111_110);
  446. _mapping.Add(Auto_111_111_010.AutoTileCoords, Auto_111_111_010);
  447. //第十二列
  448. _mapping.Add(Auto_000_110_110.AutoTileCoords, Auto_000_110_110);
  449. _mapping.Add(Auto_110_111_110.AutoTileCoords, Auto_110_111_110);
  450. _mapping.Add(Auto_110_110_110.AutoTileCoords, Auto_110_110_110);
  451. _mapping.Add(Auto_110_110_000.AutoTileCoords, Auto_110_110_000);
  452. }
  453.  
  454. private void HandlerOtherCellMapping()
  455. {
  456. _mapping.Add(Floor.AutoTileCoords, Floor);
  457. _mapping.Add(Wall_Vertical_LeftTop.AutoTileCoords, Wall_Vertical_LeftTop);
  458. _mapping.Add(Wall_Vertical_RightTop.AutoTileCoords, Wall_Vertical_RightTop);
  459. _mapping.Add(Wall_Vertical_CenterTop.AutoTileCoords, Wall_Vertical_CenterTop);
  460. _mapping.Add(Wall_Vertical_SingleTop.AutoTileCoords, Wall_Vertical_SingleTop);
  461. _mapping.Add(Wall_Vertical_LeftBottom.AutoTileCoords, Wall_Vertical_LeftBottom);
  462. _mapping.Add(Wall_Vertical_CenterBottom.AutoTileCoords, Wall_Vertical_CenterBottom);
  463. _mapping.Add(Wall_Vertical_RightBottom.AutoTileCoords, Wall_Vertical_RightBottom);
  464. _mapping.Add(Wall_Vertical_SingleBottom.AutoTileCoords, Wall_Vertical_SingleBottom);
  465. }
  466. }