13 private string savePath
17 return CorePath.ZoneSaveUser + this.inputId.text +
".z";
22 public override void OnInit()
24 this.ini =
ELayer.core.mods.GetElinIni();
25 string text = this.ini.GetKey(
"pass") ??
"password";
26 InputField inputField = this.inputId;
28 inputField.text = (((custom !=
null) ? custom.id :
null) ??
"new_zone");
29 this.inputPassword.text = text;
35 string text = this.inputId.text;
36 this.validId = (text.Length >= 3 && text.IndexOfAny(
LayerUploader.InvalidChars) == -1 && !
this.invalidIds.Contains(text));
37 text = this.inputPassword.text;
38 this.validPass = (text.Length >= 3 && text.IndexOfAny(
LayerUploader.InvalidChars) == -1);
39 this.textInvalidId.SetActive(!this.validId);
40 this.textInvalidPass.SetActive(!this.validPass);
41 bool interactableWithAlpha = this.validId && this.validPass;
42 this.buttonSave.SetInteractableWithAlpha(interactableWithAlpha);
43 int num = LayerUploader.nextUpload - (int)Time.realtimeSinceStartup;
44 this.textNextUpload.SetActive(num > 0);
47 this.textNextUpload.text =
"net_nextUpload".lang(num.ToString() ??
"",
null,
null,
null,
null);
50 interactableWithAlpha =
false;
53 this.buttonUpload.SetInteractableWithAlpha(interactableWithAlpha);
57 public override void OnKill()
59 if (this.validId && this.validPass)
68 if (
ELayer._map.custom !=
null)
70 ELayer._map.custom.id = this.inputId.text;
72 this.ini.Global[
"pass"] = this.inputPassword.text;
73 new FileIniDataParser().WriteFile(
ModManager.PathIni,
this.ini,
null);
77 public void ExportMap()
79 ELayer._zone.Export(this.savePath,
null,
true);
80 Msg.Say(
"net_mapSaved".lang(this.savePath,
null,
null,
null,
null));
88 if (this.ini.Global[
"agreed"].IsEmpty())
90 string[] items =
new string[]
96 Dialog.List<
string>(
"dialogTermsOfUse".lang(), items, (
string j) => j, delegate(
int c,
string d)
105 this.ini.Global[
"agreed"] =
"yes";
112 Debug.Log(
"Uploading map");
113 string text = this.inputId.text;
114 string text2 = this.inputPassword.text;
117 Net.UploadFile(text, text2,
ELayer.pc.NameBraced,
ELayer._zone.Name,
this.savePath, Lang.langCode);
118 LayerUploader.nextUpload = (int)Time.realtimeSinceStartup +
this.limitSec;
122 public static int nextUpload;
125 public static char[] InvalidChars =
new char[]
151 public InputField inputId;
154 public InputField inputPassword;
160 public UIText textInvalidId;
163 public UIText textInvalidPass;
166 public UIText textNextUpload;
169 public UIButton buttonUpload;
172 public UIButton buttonSave;
178 public HashSet<string> invalidIds =
new HashSet<string>();
186 public bool validPass;