1using System.Collections.Generic;
22 public List<int>
ruined =
new List<int>();
86 public static string PathTemp => CorePath.MapPieceSave +
"_temp.mp";
90 public string ID =>
new FileInfo(
path).Name.Replace(
".mp",
"");
107 item.skipRender =
false;
150 int maxX = point.x +
w;
151 int maxZ = point.z +
h;
157 minZ = point.z -
w + 1;
161 minX = point.x -
w + 1;
163 minZ = point.z -
h + 1;
167 minX = point.x -
h + 1;
176 this.result.
ruined.Clear();
179 for (
int i = 0; i <
w; i++)
181 for (
int j = 0; j <
h; j++)
184 p.
Set(point.
x + num2, point.
z + num3);
199 c1.skipRender =
true;
206 guidePass.
Add(vector.x, vector.y, vector.z - 0.01f, num4, 0.3f);
236 this.result.ruined.Add(p.
index);
242 c1._block = (byte)interior.
block.
id;
247 c1._block = (byte)exterior.
block.
id;
257 c1._floor = (byte)interior.
floor.
id;
262 c1._floor = (byte)exterior.
floor.
id;
275 c1.decal = cell.
decal;
276 c1._dirs = cell.
_dirs;
280 c1.isModified =
true;
287 c1.height = (byte)Mathf.Clamp(height + cell.
height - num, 0, 255);
288 c1.bridgeHeight = (byte)Mathf.Clamp((cell.
bridgeHeight != 0) ? (c1.height + (cell.bridgeHeight - cell.
height)) : 0, 0, 255);
339 p.
Set(point.
x, point.
z);
411 public void Save(
int _x,
int _z,
int _w,
int _h)
418 for (
int i = _x; i < _x +
w; i++)
420 for (
int j = _z; j < _z +
h; j++)
443 partialMap.ruinChance = 0f;
450 bool flag =
path.IsEmpty();
455 if (!File.Exists(
path))
460 if (metaData ==
null || metaData.
partial ==
null)
476 map =
GameIO.LoadFile<
Map>(EClass._zone.pathTemp +
"map");
486 for (
int i = 0; i <
w; i++)
488 for (
int j = 0; j <
h; j++)
509 string fullFileNameWithoutExtension =
path.GetFullFileNameWithoutExtension();
511 IO.DeleteFile(fullFileNameWithoutExtension +
".jpg");
512 IO.DeleteFile(fullFileNameWithoutExtension +
".txt");
520 if (!
string.IsNullOrEmpty(pathDest))
532 string fileName = CorePath.Temp +
"preview.jpg";
533 Texture2D texture2D = ScreenCapture.CaptureScreenshotAsTexture();
536 RenderTexture renderTexture =
new RenderTexture(num, num2, 0);
537 renderTexture.Create();
538 RenderTexture active = RenderTexture.active;
539 RenderTexture.active = renderTexture;
540 Graphics.Blit(texture2D, renderTexture);
541 Texture2D texture2D2 =
new Texture2D(num, num2, texture2D.format, mipChain:
false);
542 texture2D2.ReadPixels(
new Rect(0f, 0f, num, num2), 0, 0);
544 RenderTexture.active = active;
545 renderTexture.Release();
546 File.WriteAllBytes(fileName, texture2D2.EncodeToJPG());
547 ZipFile zipFile = ZipFile.Read(
path);
548 zipFile.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
549 zipFile.AddFile(fileName,
"");
550 zipFile.Save(pathDest);
552 IO.DeleteFile(fileName);
553 Object.Destroy(texture2D2);
554 Object.Destroy(texture2D);
555 Object.Destroy(renderTexture);
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
virtual MeshPass GetGuidePass(Point point)
void WaitForEndOfFrame(Action action)
List< Action > actionsNextFrame
virtual int GetPrice(CurrencyType currency=CurrencyType.Money, bool sell=false, PriceType priceType=PriceType.Default, Chara c=null)
static int GetTilePrice(TileRow row, SourceMaterial.Row mat)
int GetCurrency(string id="money")
SourceBlock.Row sourceBlock
SourceMaterial.Row matBlock
SourceFloor.Row sourceFloor
SourceMaterial.Row matRoofBlock
SourceMaterial.Row matObj
SourceMaterial.Row matBridge
SourceFloor.Row sourceBridge
SourceMaterial.Row matFloor
SourceBlock.Row sourceRoofBlock
static string MapPieceSaveUser
static string MapPieceSave
static void RebuildCritter(Cell cell)
static SourceManager sources
bool Contains(int dx, int dz)
static void UpdateMetaData(string pathZip, PartialMap partial=null)
static MapMetaData GetMetaData(string pathZip)
void Load(string path, bool import=false, PartialMap partial=null)
void Add(Point point, float tile=0f, float color=0f)
static string SayRaw(string text)
static void Delete(string path)
ZoneExportData exportData
void Apply(Point _point, ApplyMode mode)
static void SavePreview(string path, string pathDest)
static PartialMap Load(string path=null)
static PartialMap Apply(string path, Point pos)
HashSet< int > validPoints
static void ExportDialog(string dir=null)
void Save(int _x, int _z, int _w, int _h)
ref Vector3 Position(int height)
Point Set(int _x, int _z)
bool Within(int _x, int _z, int _w, int _h)
static int Range(int min, int max)
virtual void OnRenderMarker(Point point, bool active, HitResult result, bool main, int dir, int bridgeHeight)
static Recipe GetOrCreate(string id)
static string SaveFilePanel(string title, string directory, string defaultName, string extension)
void Restore(Map map, Map orgMap, bool addToZone, PartialMap partial=null)
Dictionary< string, CardRow > map
virtual bool CanBeDestroyed
virtual bool CanCopyInBlueprint
SerializedCards serializedCards
ZoneExportData Import(string path)
void Export(string path, PartialMap partial=null, bool usermap=false)