2025-10-15 00:36:54 +08:00

88 lines
3.7 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MapVisualization : MonoBehaviour
{
[HideInInspector] public MapListener mapListener;
private List<MapListener.RoomPrefabs> room_prefab_list;
// 地下房间预制件
private MapListener.RoomPrefabs statue_prefab;
private MapListener.RoomPrefabs cage_normal_prefab;
private MapListener.RoomPrefabs cage_special_prefab;
private MapListener.RoomPrefabs weapon_prefab;
private MapListener.RoomPrefabs storage_prefab;
private MapListener.RoomPrefabs mission_prefab;
// 地上房间预制件
private MapListener.RoomPrefabs team_editor_prefab;
private void Start()
{
this.m_self_load_prefab_message();
this.m_self_load_map_data();
}
private void m_self_load_prefab_message()
{
foreach (MapListener.RoomPrefabs item in mapListener.m_recv_get_all_room_prefab_message())
{
switch (item.roomType)
{
case HomeMapSO.RoomType.StatueRoom:
statue_prefab = item;
break;
case HomeMapSO.RoomType.CageNormalRoom:
cage_normal_prefab = item;
break;
case HomeMapSO.RoomType.CageSpecialRoom:
cage_special_prefab = item;
break;
case HomeMapSO.RoomType.WeaponRoom:
weapon_prefab = item;
break;
case HomeMapSO.RoomType.StorageRoom:
storage_prefab = item;
break;
case HomeMapSO.RoomType.MissionRoom:
mission_prefab = item;
break;
case HomeMapSO.RoomType.TeamEditorRoom:
team_editor_prefab = item;
break;
default:
break;
}
}
}
// TODO: 从存档文件读取数据
private void m_self_load_map_data()
{
mm_self_load_under_ground_room(); // 加载地下房间数据
mm_self_load_on_the_ground_room(); // 加载地上房间数据
return;
void mm_self_load_under_ground_room()
{
mapListener.m_send_SOMap_create_a_room(position: new Vector2Int(0, 0), statue_prefab, true); // 雕像房间
mapListener.m_send_SOMap_create_a_room(position: new Vector2Int(2, 0), weapon_prefab, true); // 武器房间
mapListener.m_send_SOMap_create_a_room(position: new Vector2Int(4, 0), storage_prefab, true); // 仓库房间
mapListener.m_send_SOMap_create_a_room(position: new Vector2Int(-2, 0), mission_prefab, true); // 任务房间
mapListener.m_send_SOMap_create_a_room(position: new Vector2Int(4, -1), cage_normal_prefab, true); // 普通笼子房间
mapListener.m_send_SOMap_create_a_room(position: new Vector2Int(2, -1), cage_special_prefab, true); // 特殊笼子房间
}
void mm_self_load_on_the_ground_room()
{
mapListener.m_send_SOMap_create_a_room(position: new Vector2Int(0, 0), team_editor_prefab, false); // 团队编辑房间 1
mapListener.m_send_SOMap_create_a_room(position: new Vector2Int(2, 0), team_editor_prefab, false); // 团队编辑房间 2
mapListener.m_send_SOMap_create_a_room(position: new Vector2Int(-2, 0), team_editor_prefab, false); // 团队编辑房间 3
mapListener.m_send_SOMap_create_a_room(position: new Vector2Int(-4, 0), team_editor_prefab, false); // 团队编辑房间 4
mapListener.m_send_SOMap_create_a_room(position: new Vector2Int(4, 0), team_editor_prefab, false); // 团队编辑房间 5
}
}
}