public void OnMapDataUpdateEvent(Coord c) { HexSubMapView s = null; subMapViews.TryGetValue(c, out s); if (null != s) { s.DestroyTiles(); s.InitTiles(); s.SetPitch(MapView.Current.CameraPitch); } }
/// <summary> /// 地图编辑器强制刷新 /// </summary> /// <param name="tileCoord"></param> public void ForceRereshSubMapView(Coord tileCoord) { List <Coord> needRefresh = new List <Coord>(); Coord submapCoord = new Coord(); submapCoord.x = Mathf.FloorToInt(tileCoord.x / hex.xTile); submapCoord.y = Mathf.FloorToInt(tileCoord.y / hex.yTile); needRefresh.Add(submapCoord); int cx = tileCoord.x % hex.xTile; int cy = tileCoord.y % hex.yTile; if (cx == 0) { needRefresh.Add(new Coord(submapCoord.x - 1, submapCoord.y)); } if (cy == 0) { needRefresh.Add(new Coord(submapCoord.x - 1, submapCoord.y)); } if (cx == 0 && cy == 0) { needRefresh.Add(new Coord(submapCoord.x - 1, submapCoord.y - 1)); } if (cx == hex.xTile - 1) { needRefresh.Add(new Coord(submapCoord.x + 1, submapCoord.y)); } if (cy == hex.yTile) { needRefresh.Add(new Coord(submapCoord.x - 1, submapCoord.y)); } if (cx == hex.xTile && cy == hex.yTile) { needRefresh.Add(new Coord(submapCoord.x + 1, submapCoord.y + 1)); } foreach (Coord coord in needRefresh) { if (subMapViews.ContainsKey(coord)) { HexSubMapView submap = subMapViews[coord]; if (MapEditorEntry.Instance != null) { submap.DestroyTiles(); submap.DestroyBlocks(); submap.ReplaceMesh(); switch (MapEditorEntry.Instance.curOp) { case MapEditorEntry.EDIT_OP.EDIT_AREA: submap.InitBg(false); submap.ShowMarks(MapEditorEntry.EDIT_OP.EDIT_AREA, MapEditorEntry.Instance.campColors); return; case MapEditorEntry.EDIT_OP.EDIT_LV: submap.InitBg(false); submap.ShowMarks(MapEditorEntry.EDIT_OP.EDIT_LV, MapEditorEntry.Instance.levelColors); return; case MapEditorEntry.EDIT_OP.EDIT_TILETYPE: submap.InitBg(false); submap.ShowMarks(MapEditorEntry.EDIT_OP.EDIT_TILETYPE, MapEditorEntry.Instance.typeColors); break; default: submap.InitBg(); submap.InitBlocks(); submap.HideMarks(); break; } } submap.SetPitch(MapView.Current.CameraPitch); } } }