// 验证性连接服务器 int TestConnectServer(out string strError) { strError = ""; MessageBar _messageBar = null; _messageBar = new MessageBar(); _messageBar.TopMost = false; _messageBar.Font = this.Font; _messageBar.BackColor = SystemColors.Info; _messageBar.ForeColor = SystemColors.InfoText; _messageBar.Text = "欢迎使用 dp2Catalog"; _messageBar.MessageText = "正在验证连接服务器,请等待 ..."; _messageBar.StartPosition = FormStartPosition.CenterScreen; _messageBar.Show(this); _messageBar.Update(); try { int nRet = TouchServer(true, out strError); if (nRet == -1) { return(-1); } return(0); } finally { _messageBar.Close(); _messageBar = null; } }
public void OnTriggerEnter2D(Collider2D collider) { if (!Application.isPlaying) { return; } foreach (var requiredInventoryItem in requiredInventoryItems) { if (requiredInventoryItem != null) { if (!model.HasInventoryItem(requiredInventoryItem.name)) { if (nullinventorymessage) { MessageBar.Show(noinventory); nullinventorymessage = false; } return; } } } foreach (var requiredStoryItem in requiredStoryItems) { if (requiredStoryItem != null) { if (!model.HasSeenStoryItem(requiredStoryItem.ID)) { return; } } } if (text != string.Empty) { MessageBar.Show(text); } if (ID != string.Empty) { model.RegisterStoryItem(ID); } if (audioClip == null) { UserInterfaceAudio.OnStoryItem(); } else { UserInterfaceAudio.PlayClip(audioClip); } if (disableWhenDiscovered) { gameObject.SetActive(false); } if (cutscenePrefab != null) { var cs = Instantiate(cutscenePrefab); if (cs.audioClip != null) { cs.OnFinish += (i) => model.musicController.CrossFade(model.musicController.audioClip); } } }
public void OnCollisionEnter2D(Collision2D collision) { MessageBar.Show($"You collected: {name} x {count}"); model.AddInventoryItem(this); UserInterfaceAudio.OnCollect(); gameObject.SetActive(false); }
void Update() { if (isInRange) { if (manage_it.firstTime) { displaymessage = true; StartCoroutine(WaitAndMakeTextDisappear(hideTextDuration)); } if (Input.GetKeyDown(interactKey)) { MessageBar.Show($"You collected: {name} x {count}"); if (this.CompareTag("pedra")) { pedra = true; Debug.Log("Dins de update" + pedra); //OnGUI(); StartCoroutine(WaitAndMakeTextDisappear(hideTextDuration)); } model.AddInventoryItem(this); UserInterfaceAudio.OnCollect(); gameObject.SetActive(false); Debug.Log("Key pressed"); } } }
public void OnTriggerEnter2D(Collider2D collider) { MessageBar.Show($"Вы получили: {name} x {count}"); model.AddInventoryItem(this); UserInterfaceAudio.OnCollect(); gameObject.SetActive(false); }
static void CrashReport(string strText) { // MainForm main_form = Form.ActiveForm as MainForm; MessageBar _messageBar = null; _messageBar = new MessageBar(); _messageBar.TopMost = false; //_messageBar.BackColor = SystemColors.Info; //_messageBar.ForeColor = SystemColors.InfoText; _messageBar.Text = "dp2Circulation 出现异常"; _messageBar.MessageText = "正在向 dp2003.com 发送异常报告 ..."; _messageBar.StartPosition = FormStartPosition.CenterScreen; _messageBar.Show(_mainForm); _messageBar.Update(); int nRet = 0; string strError = ""; try { string strSender = ""; if (_mainForm != null) { strSender = _mainForm.GetCurrentUserName() + "@" + _mainForm.ServerUID; } // 崩溃报告 nRet = LibraryChannel.CrashReport( strSender, "dp2circulation", strText, out strError); } catch (Exception ex) { strError = "CrashReport() 过程出现异常: " + ExceptionUtil.GetDebugText(ex); nRet = -1; } finally { _messageBar.Close(); _messageBar = null; } if (nRet == -1) { strError = "向 dp2003.com 发送异常报告时出错,未能发送成功。详细情况: " + strError; MessageBox.Show(_mainForm, strError); // 写入错误日志 if (_mainForm != null) { _mainForm.WriteErrorLog(strError); } else { WriteWindowsLog(strError, EventLogEntryType.Error); } } }
public void OnTriggerEnter2D(Collider2D collider) { MessageBar.Show($"You collected: {name} x {count}"); model.AddInventoryItem(this); UserInterfaceAudio.OnCollect(); gameObject.SetActive(false); tmp.glory += 1; tmp.blood += 100; tmp.strength += 1; }
static void CrashReport(string strText) { MessageBar _messageBar = null; _messageBar = new MessageBar { TopMost = false, Text = $"{ProgramName} 出现异常", MessageText = "正在向 dp2003.com 发送异常报告 ...", StartPosition = FormStartPosition.CenterScreen }; _messageBar.Show(MainForm); _messageBar.Update(); int nRet = 0; string strError = ""; try { string strSender = ""; if (MainForm != null) { strSender = MainForm.GetCurrentUserName() + "@" + MainForm.ServerUID; } // 崩溃报告 nRet = LibraryChannel.CrashReport( strSender, $"{ProgramName}", strText, out strError); } catch (Exception ex) { strError = "CrashReport() 过程出现异常: " + ExceptionUtil.GetDebugText(ex); nRet = -1; } finally { _messageBar.Close(); _messageBar = null; } if (nRet == -1) { strError = "向 dp2003.com 发送异常报告时出错,未能发送成功。详细情况: " + strError; MessageBox.Show(MainForm, strError); // 写入错误日志 WriteErrorLog(strError); } }
public void RewardItemsToPlayer() { foreach (var i in rewardItems) { MessageBar.Show($"You collected: {i.name} x {i.count}"); model.AddInventoryItem(i); UserInterfaceAudio.OnCollect(); i.gameObject.SetActive(false); } if (outroCutscenePrefab != null) { var cs = Instantiate(outroCutscenePrefab); if (cs.audioClip != null) { cs.OnFinish += (i) => model.musicController.CrossFade(model.musicController.audioClip); } } }
// 2015/9/15 public static void EnvironmentReport(MainForm mainForm) { #if NO MessageBar _messageBar = null; _messageBar = new MessageBar(); _messageBar.TopMost = false; //_messageBar.BackColor = SystemColors.Info; //_messageBar.ForeColor = SystemColors.InfoText; _messageBar.Text = "dp2Circulation 出现异常"; _messageBar.MessageText = "正在向 dp2003.com 发送异常报告 ..."; _messageBar.StartPosition = FormStartPosition.CenterScreen; _messageBar.Show(_mainForm); _messageBar.Update(); #endif int nRet = 0; string strError = ""; try { string strSender = ""; if (mainForm != null) { strSender = mainForm.GetCurrentUserName() + "@" + mainForm.ServerUID; } // 崩溃报告 nRet = LibraryChannel.CrashReport( strSender, "dp2circulation 环境报告", GetEnvironmentDescription().Replace("\t", " "), out strError); } catch (Exception ex) { strError = "CrashReport() 过程出现异常: " + ExceptionUtil.GetDebugText(ex); nRet = -1; } finally { #if NO _messageBar.Close(); _messageBar = null; #endif } #if NO if (nRet == -1) { strError = "向 dp2003.com 发送异常报告时出错,未能发送成功。详细情况: " + strError; MessageBox.Show(_mainForm, strError); // 写入错误日志 if (_mainForm != null) { _mainForm.WriteErrorLog(strError); } else { WriteWindowsLog(strError, EventLogEntryType.Error); } } #endif }
// parameters: // bLocal 是否从本地启动。 false 表示连安装带启动 public static void StartDp2libraryXe( IWin32Window owner, string strDialogTitle, Font font, bool bLocal) { MessageBar messageBar = null; messageBar = new MessageBar(); messageBar.TopMost = false; if (font != null) { messageBar.Font = font; } messageBar.BackColor = SystemColors.Info; messageBar.ForeColor = SystemColors.InfoText; messageBar.Text = "dp2 内务"; messageBar.MessageText = "正在启动 dp2Library XE,请等待 ..."; messageBar.StartPosition = FormStartPosition.CenterScreen; messageBar.Show(owner); messageBar.Update(); Application.DoEvents(); try { TimeSpan waitTime = new TimeSpan(0, 1, 0); string strShortcutFilePath = ""; if (bLocal == true) { strShortcutFilePath = PathUtil.GetShortcutFilePath("DigitalPlatform/dp2 V2/dp2Library XE"); } else { strShortcutFilePath = "http://dp2003.com/dp2libraryxe/v1/dp2libraryxe.application"; waitTime = new TimeSpan(0, 5, 0); // 安装需要的等待时间更长 } // TODO: detect if already started using (EventWaitHandle eventWaitHandle = new EventWaitHandle(false, EventResetMode.ManualReset, "dp2libraryXE V1 library host started")) { Application.DoEvents(); Process.Start(strShortcutFilePath); DateTime start = DateTime.Now; while (true) { Application.DoEvents(); // wait till started // http://stackoverflow.com/questions/6816782/windows-net-cross-process-synchronization if (eventWaitHandle.WaitOne(100, false) == true) { break; } // if timeout, prompt continue wait if (DateTime.Now - start > waitTime) { DialogResult result = MessageBox.Show(owner, "dp2libraryXE 暂时没有响应。\r\n\r\n是否继续等待其响应?", strDialogTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (result == System.Windows.Forms.DialogResult.No) { break; } start = DateTime.Now; // } } } } finally { messageBar.Close(); } }
// 验证性连接服务器 int TestConnectServer(out string strError) { strError = ""; // 如果是即将访问 dp2libraryXE 单机版,这里要启动它 if (string.Compare(this.textBox_server_dp2LibraryServerUrl.Text, CirculationLoginDlg.dp2LibraryXEServerUrl, true) == 0) { string strShortcutFilePath = PathUtil.GetShortcutFilePath("DigitalPlatform/dp2 V2/dp2Library XE"); if (File.Exists(strShortcutFilePath) == false) { // 安装和启动 DialogResult result = MessageBox.Show(this, "dp2libraryXE 在本机尚未安装。\r\ndp2Circulation (内务)即将访问 dp2LibraryXE 单机版服务器,需要安装它才能正常使用。\r\n\r\n是否立即从 dp2003.com 下载安装?", "dp2Circulation", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (result == System.Windows.Forms.DialogResult.Yes) { StartDp2libraryXe( this, "dp2Circulation", this.Font, false); } } else { if (HasDp2libraryXeStarted() == false) { StartDp2libraryXe( this, "dp2Circulation", this.Font, true); } } } MessageBar _messageBar = null; _messageBar = new MessageBar(); _messageBar.TopMost = false; _messageBar.Font = this.Font; _messageBar.BackColor = SystemColors.Info; _messageBar.ForeColor = SystemColors.InfoText; _messageBar.Text = "欢迎使用 dp2Circulation"; _messageBar.MessageText = "正在验证连接服务器,请等待 ..."; _messageBar.StartPosition = FormStartPosition.CenterScreen; _messageBar.Show(this); _messageBar.Update(); try { int nRet = TouchServer(true, out strError); if (nRet == -1) { return(-1); } return(0); } finally { _messageBar.Close(); _messageBar = null; } }