private void ParseMapLeftRow(Internal.ByteArray message) { UnityEngine.Vector3Int position = WorldMapStorage.Position; position.x--; WorldMapStorage.Position = position; MiniMapStorage.Position = position; WorldMapStorage.ScrollMap(1, 0); WorldMapStorage.InvalidateOnscreenMessages(); ReadArea(message, 0, 0, 0, Constants.MapSizeY - 1); }
private void ParseMapLeftRow(Internal.CommunicationStream message) { UnityEngine.Vector3Int position = WorldMapStorage.Position; position.x--; WorldMapStorage.Position = position; MiniMapStorage.Position = position; WorldMapStorage.ScrollMap(1, 0); WorldMapStorage.InvalidateOnscreenMessages(); ProtocolGameExtentions.ReadArea(message, 0, 0, 0, Constants.MapSizeY - 1); WorldMapStorage.CacheRefresh = true; }
private void ParseMapBottomRow(Internal.CommunicationStream message) { UnityEngine.Vector3Int position = WorldMapStorage.Position; position.y++; WorldMapStorage.Position = position; MiniMapStorage.Position = position; WorldMapStorage.ScrollMap(0, -1); WorldMapStorage.InvalidateOnscreenMessages(); ReadArea(message, 0, Constants.MapSizeY - 1, Constants.MapSizeX - 1, Constants.MapSizeY - 1); WorldMapStorage.CacheRefresh = true; }
private void ParseMapTopRow(Internal.CommunicationStream message) { UnityEngine.Vector3Int position = WorldMapStorage.Position; position.y--; //NewGameManager.inst.RenderGroundRow(NewGameManager.rowType.top); WorldMapStorage.Position = position; MiniMapStorage.Position = position; WorldMapStorage.ScrollMap(0, 1); WorldMapStorage.InvalidateOnscreenMessages(); ProtocolGameExtentions.ReadArea(message, 0, 0, Constants.MapSizeX - 1, 0); WorldMapStorage.CacheRefresh = true; }
private void ParseMapBottomFloor(Internal.CommunicationStream message) { UnityEngine.Vector3Int position = WorldMapStorage.Position; position.x--; position.y--; position.z++; WorldMapStorage.Position = position; MiniMapStorage.Position = position; if (position.z > Constants.GroundLayer + 1) { WorldMapStorage.ScrollMap(0, 0, 1); if (position.z <= Constants.MapMaxZ - Constants.UndergroundLayer) { ProtocolGameExtentions.ReadFloor(message, 2 * Constants.UndergroundLayer, 0); } } else if (position.z == Constants.GroundLayer + 1) { WorldMapStorage.ScrollMap(0, 0, Constants.UndergroundLayer + 1); int skip = 0; for (int zposition = Constants.UndergroundLayer; zposition >= 0; zposition--) { skip = ProtocolGameExtentions.ReadFloor(message, zposition, skip); } } Player.StopAutowalk(true); WorldMapStorage.InvalidateOnscreenMessages(); var mapPosition = WorldMapStorage.ToMap(position); for (int x = 0; x < Constants.MapSizeX; x++) { for (int y = 0; y < Constants.MapSizeY; y++) { mapPosition.x = x; mapPosition.y = y; var absolutePosition = WorldMapStorage.ToAbsolute(mapPosition); WorldMapStorage.UpdateMiniMap(mapPosition); uint color = WorldMapStorage.GetMiniMapColour(mapPosition); int cost = WorldMapStorage.GetMiniMapCost(mapPosition); MiniMapStorage.UpdateField(absolutePosition, color, cost, false); } } WorldMapStorage.CacheRefresh = true; }
private void ParseMapBottomFloor(Internal.ByteArray message) { UnityEngine.Vector3Int position = WorldMapStorage.Position; position.x--; position.y--; position.z++; WorldMapStorage.Position = position; MiniMapStorage.Position = position; if (position.z > Constants.GroundLayer + 1) { WorldMapStorage.ScrollMap(0, 0, 1); if (position.z <= Constants.MapMaxZ - Constants.UndergroundLayer) { ReadFloor(message, 2 * Constants.UndergroundLayer, 0); } } else if (position.z == Constants.GroundLayer + 1) { WorldMapStorage.ScrollMap(0, 0, Constants.UndergroundLayer + 1); int skip = 0; for (int zposition = Constants.UndergroundLayer; zposition >= 0; zposition--) { skip = ReadFloor(message, zposition, skip); } } Player.StopAutowalk(true); WorldMapStorage.InvalidateOnscreenMessages(); UnityEngine.Vector3Int tmpPosition = WorldMapStorage.ToMap(position); for (int x = 0; x < Constants.MapSizeX; x++) { for (int y = 0; x < Constants.MapSizeY; y++) { tmpPosition.x = x; tmpPosition.y = y; UnityEngine.Vector3Int absolutePosition = WorldMapStorage.ToAbsolute(tmpPosition); WorldMapStorage.UpdateMiniMap(tmpPosition); uint color = WorldMapStorage.GetMiniMapColour(tmpPosition); int cost = WorldMapStorage.GetMiniMapCost(tmpPosition); MiniMapStorage.UpdateField(absolutePosition, color, cost, false); } } }
public void ParseMapRightRow(Internal.CommunicationStream message) { UnityEngine.Vector3Int position = WorldMapStorage.Position; position.x++; //NewGameManager.inst.RenderGroundRow(NewGameManager.rowType.right); var allFields = WorldMapStorage.GetFields(); /* * int x = allFields[0].ObjectsNetwork[0]._lastPatternX; * int y = allFields[0].ObjectsNetwork[0]._lastPatternY; * int z = allFields[0].ObjectsNetwork[0]._lastPatternZ; */ for (int i = 0; i < 20; i++) { for (int j = 0; j < 20; j++) { for (int o = 0; o < 20; o++) { try { WorldMap.Field _field = WorldMapStorage.GetField(new Vector3Int(i, j, o)); int countItem = _field.ObjectsNetwork.Where(c => c != null).Count(); if (countItem > 4) { Debug.Log(WorldMapStorage.Position); Debug.Log(Player.Position); Debug.Log("not null" + i + " " + j + " " + o); } break; } catch (Exception ex) { //Debug.Log("null"); } } } } /////////////// /* * int last_index = 0; * int count = 0; * for(int i=0; i<allFields.Length; i++) * { * for(int j=0; j<allFields[i].ObjectsNetwork.Length; j++) * { * if (allFields[i].ObjectsNetwork[j] != null) * { * last_index = j; * count++; * } * * } * if (count > 2) * { * int posX = allFields[i].ObjectsNetwork[last_index]._lastPatternX; * int posY = allFields[i].ObjectsNetwork[last_index]._lastPatternY; * int posZ = allFields[i].ObjectsNetwork[last_index]._lastPatternZ; * Debug.Log(count +" "+posX+ " "+posY+" "+posZ); * } * // * count = 0; * } * */ //List<ObjItem> RightMapObj = new List<ObjItem>(); /* * for(int i=0; i<5; i++) * { * UnityEngine.Vector3Int pos = new Vector3Int(position.x, position.y, position.z); * WorldMap.Field _field = (WorldMapStorage.GetField(pos)); * _field.ObjectsNetwork[0].las * } */ //////// // var fields = WorldMapStorage.GetFields(); // foreach(var field in fields) // { /// var cos = field.ObjectsNetwork; /// foreach (var tmp1 in cos) // { // if (tmp1 == null) // Debug.Log("null"); /// else // Debug.Log("not null"); //UnityEngine.Vector3 pos = new UnityEngine.Vector3(tmp1._lastPatternX, tmp1._lastPatternY, tmp1._lastPatternZ); //ObjItem item = new ObjItem((int)tmp1.Id, pos); //NewGameManager.AddObjToList(item); // } // } ///// WorldMapStorage.Position = position; MiniMapStorage.Position = position; WorldMapStorage.ScrollMap(-1, 0); WorldMapStorage.InvalidateOnscreenMessages(); ProtocolGameExtentions.ReadArea(message, Constants.MapSizeX - 1, 0, Constants.MapSizeX - 1, Constants.MapSizeY - 1); WorldMapStorage.CacheRefresh = true; }