/// <summary> /// 尝试加载策略 /// </summary> public void TryLoadStrategy() { string blue_ep, yellow_ep; if (blueInputField.text.Trim() == "") { blue_ep = "127.0.0.1"; } else { blue_ep = blueInputField.text; } if (yellowInputField.text.Trim() == "") { yellow_ep = "127.0.0.1"; } else { yellow_ep = yellowInputField.text; } try { playMain.LoadStrategy(blue_ep, yellow_ep); AnimInGame(); } catch (StrategyException e) { Debug.LogError(e); Win32Dialog.ShowMessageBox($"{(e.side == Side.Blue ? "蓝方" : "黄方")}策略连接失败", "Failed"); AnimOutGame(); } }
void FixedUpdate() { // TODO 使用回调完成 var e = playMain.FatalException; if (e != null) { Debug.LogError(e); Win32Dialog.ShowMessageBox("策略连接异常", "Strategy Connection"); StopMatchAndRemoveStrategy(false); playMain.FatalException = null; } }
void FixedUpdate() { // TODO 使用回调完成 var e = playMain.FatalException; if (e != null) { Debug.LogError(e); PauseMatchAndPushMenu(); Win32Dialog.ShowMessageBox("策略连接异常", "Strategy Connection"); playMain.FatalException = null; } }
public static string OpenFolder(string title = "Choose a folder") { if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { if (PrefersKdialog()) { return(KDialog.OpenFolder(title)); } return(Zenity.OpenFolder(title)); } if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { return(Win32Dialog.OpenFolder(title)); } throw new NoImplementationException(); }
public static string SaveFile(string title = "Enter the name of the file to save to", string filter = "") { if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { if (PrefersKdialog()) { return(KDialog.SaveFile(title)); } return(Zenity.SaveFile(title)); } if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { return(Win32Dialog.SaveFile(title, filter)); } throw new NoImplementationException(); }
public static List <string> OpenMultipleFiles(string title = "Choose one or more files") { if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { if (PrefersKdialog()) { return(KDialog.OpenMultipleFiles(title)); } return(Zenity.OpenMultipleFiles(title)); } if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { return(Win32Dialog.OpenMultipleFiles(title)); } throw new NoImplementationException(); }
/// <summary> /// 停止比赛并尝试移除策略 /// </summary> /// <param name="willNotifyStrategies">是否向策略发送通知,如果是由于策略出现错误需要停止比赛,可以指定为false。默认为true</param> public void StopMatchAndRemoveStrategy(bool willNotifyStrategies = true) { AnimOutGame(); recorder.Stop(); recorder.Clear(); try { playMain.StopMatch(willNotifyStrategies); } catch (Exception e) { Debug.LogError(e.Message); Win32Dialog.ShowMessageBox("通讯失败,强制卸载", "Remove Failed"); } finally { playMain.RemoveStrategy(); } }