public bool doSplit(Process game) { data.UpdateAll(game); //check for loading byte _load = Convert.ToByte(data["TimerBool"].Current); if (_load == 0 && isLoading == false) { LoadStart?.Invoke(this, EventArgs.Empty); isLoading = true; } else if (_load == 1 && isLoading == true) { LoadEnd?.Invoke(this, EventArgs.Empty); isLoading = false; } //check for update to room byte _door = Convert.ToByte(data["DoorEnter"].Current); if (_door == 1 && inDoor == false) { NextLevel = Convert.ToInt32(data["DoorDest"].Current); inDoor = true; } else if (_door == 0 && inDoor == true) { CurrentLevel = NextLevel; inDoor = false; } //check for splits foreach (var _split in splits) { int count = 0; foreach (var _trigger in _split.Triggers) { if (_trigger.Key == "CurrentLevel") { if (CurrentLevel == _trigger.Value) { count++; } } else if (_trigger.Key == "NextLevel") { if (NextLevel == _trigger.Value) { count++; } } else { int _int = Convert.ToInt32(data[_trigger.Key].Current); if (_int == _trigger.Value) { count++; } } } if (count == _split.Triggers.Count) { splits.Remove(_split); return(true); } } return(false); }
private void FireLoaded() { LoadEnd?.Invoke(this, new LoadEndEventArgs(MainFrame)); }
/// <summary> /// JS消息传回 (注意:JS的消息0~10为内部消息,请使用以外的消息值) /// </summary> /// <param name="p_Msg"></param> /// <returns></returns> virtual protected string JsRecvData(IntPtr hWnd, int msg, int param_int, string param_str, string data) { try { if (hWnd != this.Handle) { return(""); } //页面载入完成 if (msg == 1) { string s_Js = @""; s_Js += "function Cef(nMsg, nParam, sParam, sData) { "; s_Js += "var o_cefobj = new cef.cefmsg.msg_object; "; s_Js += "var vParam = sParam == 'undefined'?' ':sParam; "; s_Js += "var vData = sData == 'undefined'?' ':sData; "; s_Js += "return o_cefobj.SendMessage(" + this.Handle.ToString() + ", nMsg, nParam, vParam, vData); "; s_Js += "} "; Js(s_Js); if (LoadEnd != null) { LoadEnd.Invoke(this); } return(""); } //事件回调 if (msg == 2 && param_int == 1) { if (param_str.Trim() != "undefined") { if (m_dicJsEventEvents.ContainsKey(param_str)) { if (m_dicJsEventEvents[param_str] != null) { return(m_dicJsEventEvents[param_str].Invoke(data)); } } } return(""); } //JSON回调 if (msg == 2 && param_int == 2) { if (param_str.Trim() != "undefined" && data.Trim() != "undefined") { if (m_dicJsonEvents.ContainsKey(param_str)) { if (m_dicJsonEvents[param_str] != null) { m_dicJsonEvents[param_str].Invoke(data); } m_dicJsonEvents.Remove(param_str); } } return(""); } if (RecvData != null) { return(RecvData.Invoke(hWnd, msg, param_int, param_str, data)); } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(""); }