31 public void Activate(
PartialMap partial, DirectoryInfo dir, Action<PartialMap> onSave =
null,
bool isUpdate =
false)
33 inputName.text = (MapPiece.IsEditor ? GetUniqueName(
"") :
EMono.
_zone.
Name);
36 inputName.text = (MapPiece.IsEditor ? partial.ID : partial.
name);
42 GetComponent<CanvasGroup>().alpha = 0f;
43 string text = dir.FullName +
"/" + (MapPiece.IsEditor ?
inputName.text.IsEmpty(
"new") : GetUniqueName(
"user")) +
".mp";
60 if ((bool)PartialMapMenu.Instance)
62 PartialMapMenu.Instance.Refresh();
71 string GetUniqueName(
string id)
73 for (
int i = 1; i < 999999; i++)
75 if (!File.Exists(dir.FullName +
"/" +
id + i +
".mp"))
96 public static void SavePreview(
string path,
string name, Action onSave)
102 Texture2D texture2D = ScreenCapture.CaptureScreenshotAsTexture();
103 texture2D.filterMode = FilterMode.Point;
106 float num3 = (float)num / (
float)Screen.width;
107 float num4 = (
float)num2 / (
float)Screen.height;
108 Vector2 scale =
new Vector2(num3, num4);
109 Vector2 offset =
new Vector2((1f - num3) * 0.5f, (1f - num4) * 0.5f);
110 RenderTexture renderTexture =
new RenderTexture(num, num2, 0);
111 renderTexture.filterMode = FilterMode.Point;
112 renderTexture.Create();
113 RenderTexture active = RenderTexture.active;
114 RenderTexture.active = renderTexture;
115 Graphics.Blit(texture2D, renderTexture, scale, offset);
116 Texture2D texture2D2 =
new Texture2D(num, num2, texture2D.format, mipChain:
false);
117 texture2D2.filterMode = FilterMode.Point;
118 texture2D2.ReadPixels(
new Rect(0f, 0f, num, num2), 0, 0);
120 RenderTexture.active = active;
121 renderTexture.Release();
122 File.WriteAllBytes(path.GetFullFileNameWithoutExtension() +
".jpg", texture2D2.EncodeToJPG());
123 File.WriteAllText(path.GetFullFileNameWithoutExtension() +
".txt", name);
124 UnityEngine.Object.Destroy(texture2D2);
125 UnityEngine.Object.Destroy(texture2D);
126 UnityEngine.Object.Destroy(renderTexture);
134 UnityEngine.Object.Destroy(base.gameObject);
List< Action > actionsNextFrame
static void Delete(string path)
static UIScreenshot Create()
void Activate(PartialMap partial, DirectoryInfo dir, Action< PartialMap > onSave=null, bool isUpdate=false)
static void SavePreview(string path, string name, Action onSave)
static UIScreenshot Instance