19 UIScreenshot.Instance =
this;
24 public void Activate(
PartialMap partial, DirectoryInfo dir, Action<PartialMap> onSave =
null,
bool isUpdate =
false)
27 CS$<>8__locals1.dir = dir;
28 CS$<>8__locals1.<>4__this =
this;
29 CS$<>8__locals1.isUpdate = isUpdate;
30 CS$<>8__locals1.partial = partial;
31 CS$<>8__locals1.onSave = onSave;
32 this.inputName.text = (MapPiece.IsEditor ? CS$<>8__locals1.<Activate>g__GetUniqueName|0(
"") :
EMono._zone.Name);
33 if (CS$<>8__locals1.isUpdate)
35 this.inputName.text = (MapPiece.IsEditor ? CS$<>8__locals1.partial.ID : CS$<>8__locals1.partial.name);
37 this.buttonSave.SetOnClick(delegate
39 CS$<>8__locals1.<>4__this.isDeactivating =
true;
41 CS$<>8__locals1.<>4__this.GetComponent<CanvasGroup>().alpha = 0f;
42 string text = CS$<>8__locals1.dir.FullName +
"/" + (MapPiece.IsEditor ? CS$<>8__locals1.<>4__this.inputName.text.IsEmpty(
"new") : base.<Activate>g__GetUniqueName|0(
"user")) +
".mp";
43 if (CS$<>8__locals1.isUpdate)
47 PartialMap.Delete(CS$<>8__locals1.partial.path);
51 text = CS$<>8__locals1.partial.path;
54 CS$<>8__locals1.partial.name = CS$<>8__locals1.<>4__this.inputName.text.IsEmpty(
EMono._zone.Name);
55 CS$<>8__locals1.partial.path = text;
58 string name = CS$<>8__locals1.partial.name;
60 if ((onSave2 = CS$<>8__locals1.<>9__2) ==
null)
62 onSave2 = (CS$<>8__locals1.<>9__2 = delegate()
68 CS$<>8__locals1.<>4__this.Deactivate();
69 if (CS$<>8__locals1.onSave !=
null)
71 CS$<>8__locals1.onSave(CS$<>8__locals1.partial);
82 if (this.isDeactivating)
84 EInput.Consume(
false, 1);
87 if (EInput.rightMouse.clicked || Input.GetKeyDown(KeyCode.Escape))
94 public static void SavePreview(
string path,
string name, Action onSave)
97 EMono.core.actionsNextFrame.Add(delegate
99 List<Action> actionsNextFrame =
EMono.core.actionsNextFrame;
101 if ((item = <>9__1) ==
null)
103 item = (<>9__1 = delegate()
105 Texture2D texture2D = ScreenCapture.CaptureScreenshotAsTexture();
106 texture2D.filterMode = FilterMode.Point;
109 float num3 = (float)num / (
float)Screen.width;
110 float num4 = (float)num2 / (
float)Screen.height;
111 Vector2 scale =
new Vector2(num3, num4);
112 Vector2 offset =
new Vector2((1f - num3) * 0.5f, (1f - num4) * 0.5f);
113 RenderTexture renderTexture =
new RenderTexture(num, num2, 0);
114 renderTexture.filterMode = FilterMode.Point;
115 renderTexture.Create();
116 RenderTexture active = RenderTexture.active;
117 RenderTexture.active = renderTexture;
118 Graphics.Blit(texture2D, renderTexture, scale, offset);
119 Texture2D texture2D2 =
new Texture2D(num, num2, texture2D.format,
false);
120 texture2D2.filterMode = FilterMode.Point;
121 texture2D2.ReadPixels(
new Rect(0f, 0f, (
float)num, (
float)num2), 0, 0);
123 RenderTexture.active = active;
124 renderTexture.Release();
125 File.WriteAllBytes(path.GetFullFileNameWithoutExtension() +
".jpg", texture2D2.EncodeToJPG());
126 File.WriteAllText(path.GetFullFileNameWithoutExtension() +
".txt", name);
127 UnityEngine.Object.Destroy(texture2D2);
128 UnityEngine.Object.Destroy(texture2D);
129 UnityEngine.Object.Destroy(renderTexture);
130 Action onSave2 = onSave;
138 actionsNextFrame.Add(item);
143 public void Deactivate()
145 UnityEngine.Object.Destroy(base.gameObject);
147 EInput.Consume(
false, 1);
154 public Image imageFrame;
157 public InputField inputName;
160 public UIButton buttonSave;
163 public UIButton buttonCancel;
166 public bool isDeactivating;