private void ForgetBtnClick(object sender, RoutedEventArgs e) { if (accountText.Text == "" | emailText.Text == "") { DialogShow.ShowOkDialog("Warning", "Have item empty!"); return; } AccountProcess account = new AccountProcess(); (string password, string errorType) = account.SearchPassword(accountText.Text, emailText.Text); if (password != "") { DialogShow.ShowOkDialog("Your password", password); } else { switch (errorType) { case "NOACCOUNT": DialogShow.ShowOkDialog("Warning", "Your account not found, please register."); break; case "ERRORMATCH": DialogShow.ShowOkDialog("Warning", "Your account is not registered by this email."); break; default: break; } } }
public void OpenFile() { FileOpenDialog dialog = new FileOpenDialog(); dialog.structSize = Marshal.SizeOf(dialog); dialog.filter = "exe files\0*.exe\0All Files\0*.*\0\0"; dialog.file = new string(new char[256]); dialog.maxFile = dialog.file.Length; dialog.fileTitle = new string(new char[64]); dialog.maxFileTitle = dialog.fileTitle.Length; dialog.initialDir = UnityEngine.Application.dataPath; //默认路径 dialog.title = "Open File Dialog"; dialog.defExt = "exe"; //显示文件的类型 //注意一下项目不一定要全选 但是0x00000008项不要缺少 dialog.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008; //OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_ALLOWMULTISELECT|OFN_NOCHANGEDIR if (DialogShow.GetOpenFileName(dialog)) { Debug.Log(dialog.file); } }
public void ShowDialog(Dialog dialog, DialogShow option = DialogShow.REPLACE_CURRENT) { if (current != null) { if (option == DialogShow.DONT_SHOW_IF_OTHERS_SHOWING) { Destroy(dialog.gameObject); return; } else if (option == DialogShow.REPLACE_CURRENT) { current.Close(); } else if (option == DialogShow.STACK) { current.Hide(); } } current = dialog; if (option != DialogShow.SHOW_PREVIOUS) { current.onDialogOpened += OnOneDialogOpened; current.onDialogClosed += OnOneDialogClosed; dialogs.Push(current); } current.Show(); if (onDialogsOpened != null) { onDialogsOpened(); } }
// Use this for initialization void Start() { _dialog = GameObject.Find("Dialog").GetComponent <DialogShow>(); WelcomeLabel.Text = "Welcome, " + ParseUser.CurrentUser.Username; LogoutButton.Click += LogoutButton_Click; LobbyButton.Click += new MouseEventHandler(LobbyButton_Click); StatisticsButton.Click += new MouseEventHandler(StatisticsButton_Click); }
public void ShowOkDialog(string title, string content, Action onOkListener, DialogShow option = DialogShow.REPLACE_CURRENT) { var dialog = (OkDialog)GetDialog(DialogType.Ok); if (dialog.title != null) { dialog.title.SetText(title); } if (dialog.message != null) { dialog.message.SetText(content); } dialog.onOkClick = onOkListener; ShowDialog(dialog, option); }
private void LoginBtnClick(object sender, RoutedEventArgs e) { AccountProcess account = new AccountProcess(); if (accountText.Text == "" | passwordText.Password == "") { DialogShow.ShowOkDialog("warning", "Have item empty!"); return; } else if (account.Login(accountText.Text, passwordText.Password)) { this.Hide(); OrderWindow a = new OrderWindow(); a.ShowDialog(); this.Close(); } else { DialogShow.ShowOkDialog("Error", "Not match account or password"); } }
public static string OpenFile(string types) { FileOpenDialog dialog = new FileOpenDialog(); dialog.structSize = Marshal.SizeOf(dialog); string[] type = types.Split('|'); dialog.filter = ""; for (int i = 0; i < type.Length; ++i) { dialog.filter += type[i] + " file\0*." + type[i]; if (i < type.Length - 1) { dialog.filter += "\0"; } } dialog.filter += "\0All Files\0*.*\0\0"; dialog.file = new string(new char[256]); dialog.maxFile = dialog.file.Length; dialog.fileTitle = new string(new char[64]); dialog.maxFileTitle = dialog.fileTitle.Length; dialog.initialDir = UnityEngine.Application.dataPath; //默认路径 dialog.title = "Open File Dialog"; dialog.defExt = type[0]; dialog.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008; if (DialogShow.GetOpenFileName(dialog)) { // Debug.Log(dialog.file); return(dialog.file); } return(""); }
private void RegisterAccountBtnClick(object sender, RoutedEventArgs e) { Console.WriteLine(passwordText.Password); if (accountText.Text == "" | passwordText.Password == "" | passwordConfirmText.Password == "" | emailText.Text == "") { DialogShow.ShowOkDialog("warning", "Have item empty!"); return; } else if (passwordText.Password != passwordConfirmText.Password) { DialogShow.ShowOkDialog("warning", "Password and Confirm Password not same!"); return; } AccountProcess account = new AccountProcess(); bool result = account.Register(accountText.Text, passwordText.Password, emailText.Text); if (result == false) { DialogShow.ShowOkDialog("warning", "Account has already exist!"); return; } }
// outPath: Resource 下的路径 private static void ImportVideoFile(string outDir, string prefix) { FileOpenDialog dialog = new FileOpenDialog(); dialog.structSize = Marshal.SizeOf(dialog); dialog.filter = ".mp4\0*.mp4\0webm文件\0*.webm"; dialog.file = new string(new char[256]); dialog.maxFile = dialog.file.Length; dialog.fileTitle = new string(new char[64]); dialog.maxFileTitle = dialog.fileTitle.Length; dialog.initialDir = UnityEngine.Application.streamingAssetsPath; //默认路径 dialog.title = "Open File Dialog"; //dialog.defExt = "mp4";//显示文件的类型 //注意一下项目不一定要全选 但是0x00000008项不要缺少 dialog.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008; //OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_ALLOWMULTISELECT|OFN_NOCHANGEDIR if (DialogShow.GetOpenFileName(dialog)) { string destDir = Application.streamingAssetsPath + "/Resources/" + outDir + "/Videos/"; string videoName = prefix + "_" + dialog.fileTitle; File.Copy(dialog.file, destDir + videoName, true); Debug.Log("复制成功:" + destDir + videoName); GameObject.Find("GetImage").GetComponent <GetImage>().GeneratePreviewImage( ResAPI.Instance.FillVideoPath(videoName), Application.streamingAssetsPath + "/Resources/" + outDir + "/Thumbnails/" ); } }
private static void ImportImageFile(string outDir, string prefix) { FileOpenDialog dialog = new FileOpenDialog(); dialog.structSize = Marshal.SizeOf(dialog); dialog.filter = "png\0*.png\0jpg\0*.jpg"; dialog.file = new string(new char[256]); dialog.maxFile = dialog.file.Length; dialog.fileTitle = new string(new char[64]); dialog.maxFileTitle = dialog.fileTitle.Length; dialog.initialDir = Application.streamingAssetsPath; //默认路径 dialog.title = "Open File Dialog"; dialog.defExt = "png"; //显示文件的类型 dialog.flags = 0x00080000 | 0x00001000 | 0x00000800 | 0x00000200 | 0x00000008; //OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST| OFN_ALLOWMULTISELECT|OFN_NOCHANGEDIR if (DialogShow.GetOpenFileName(dialog)) { string destDir = Path.Combine(Application.streamingAssetsPath, "Resources", outDir, "Images/"); string name = prefix + "_" + dialog.fileTitle /*+ ".png"*/; string fullPath = Path.Combine(destDir, name); File.Copy(dialog.file, fullPath, true); Debug.Log("复制成功:" + fullPath); } }
protected virtual void OnDialogShow(EventArgs e) { DialogShow?.Invoke(this, e); }
// Use this for initialization void Start() { this._panel = GetComponent <dfPanel>(); _dialog = GameObject.Find("Dialog").GetComponent <DialogShow>(); BattleButton.Disable(); // _panel.transform.Find("NewBrainButton").GetComponent<dfButton>().Click += button_Click; var q = new ParseQuery <Brain>().WhereEqualTo("userId", ParseUser.CurrentUser.ObjectId).OrderBy("createdAt"); q.FindAsync().ContinueWith(t => { IEnumerable <Brain> result = t.Result; // Dictionary<string, Brain> allBrains = new Dictionary<string, Brain>(); foreach (Brain brain in result) { if (brain.Population != null) { print("FILE: " + brain.Population.Name + ", URL: " + brain.Population.Url); // StartCoroutine(WaitForRequest(brain)); } if (brain.ParentId != null) { result.Where(b => b.ObjectId == brain.ParentId).First().Children.Add(brain); } else { rootBrains.Add(brain); } } allBrains = result; DataLoaded = true; }); GameObject.Find("Back Button").GetComponent <dfButton>().Click += AddBrainButtons_Click; slot1 = GameObject.Find("Slot 1").GetComponent <dfPanel>(); slot1Color = slot1.BackgroundColor; slot2 = GameObject.Find("Slot 2").GetComponent <dfPanel>(); slot2Color = slot2.BackgroundColor; slot3 = GameObject.Find("Slot 3").GetComponent <dfPanel>(); slot3Color = slot3.BackgroundColor; slot4 = GameObject.Find("Slot 4").GetComponent <dfPanel>(); slot4Color = slot4.BackgroundColor; slot1.DragDrop += slot1_DragDrop; slot1.DragEnter += slot1_DragEnter; slot1.DragLeave += slot1_DragLeave; slot2.DragDrop += slot1_DragDrop; slot2.DragEnter += slot1_DragEnter; slot2.DragLeave += slot1_DragLeave; slot3.DragDrop += slot1_DragDrop; slot3.DragEnter += slot1_DragEnter; slot3.DragLeave += slot1_DragLeave; slot4.DragDrop += slot1_DragDrop; slot4.DragEnter += slot1_DragEnter; slot4.DragLeave += slot1_DragLeave; BlankBrainButton.Click += new MouseEventHandler(BlankBrainButton_Click); }
public void ShowYesNoDialog(string title, string content, Action onYesListener, Action onNoListenter, DialogShow option = DialogShow.REPLACE_CURRENT) { var dialog = (YesNoDialog)GetDialog(DialogType.YesNo); if (dialog.title != null) { dialog.title.SetText(title); } if (dialog.message != null) { dialog.message.SetText(content); } dialog.onYesClick = onYesListener; dialog.onNoClick = onNoListenter; ShowDialog(dialog, option); }
public void ShowDialog(DialogType type, DialogShow option = DialogShow.REPLACE_CURRENT) { Dialog dialog = GetDialog(type); ShowDialog(dialog, option); }