protected void OnStageStateChanged(Stage_ManagerDef.EStage_State _eOldState, Stage_ManagerDef.EStage_State _eNewState) { //进入战场 if (_eNewState == Stage_ManagerDef.EStage_State.ESS_BATTLE) { int warId = GameLogicAPI.getConfigWarID(); int time = GameLogicAPI.getTimeCountKillInterval(warId); killIntervalTime = 15000; if (time > 0) { killIntervalTime = (UInt32)time; } //warGloryMomentvideoPath = ""; //videoType = EMScreenRECType.EMSS_Invalid; recType = EMScreenRECType.EMSS_Invalid; bRECValid = false; if (warGloryMomentvideoList != null) { warGloryMomentvideoList.Clear(); } warVideoCount = 0; } if (_eOldState == Stage_ManagerDef.EStage_State.ESS_BATTLE) { SwitchRECState(EMRECState.EMREC_STOP); } }
//标记视频,有效则编码,无效抛弃 public void SignValid(int killNum, int heroID) { if (killNum < 1) { return; } if (killNum == 1) { SwitchRECState(EMRECState.EMREC_RECORD); } else { if (killNum < 5 && recState == EMRECState.EMREC_STOP) { SwitchRECState(EMRECState.EMREC_RECORD); } if (heroID > 0) { recType = (EMScreenRECType)killNum; nHeroID = heroID; bRECValid = killNum > 2 ? true : false; if (killNum == (int)EMScreenRECType.EMSS_PentaKill) { SwitchRECState(EMRECState.EMREC_DELAY); } } } checkPointTime = GameLogicAPI.getSyncTickCount(); }
private void StopRecord() { string outFilePath = ""; if (bRECValid) { outFilePath = GetAppendFilePath(); RecordWarVideo(new SWarGloryMomentVideoData(recType, outFilePath)); } gameview_stop_screenCapture data = new gameview_stop_screenCapture(); data.nValid = bRECValid ? 1 : 0; data.szOutFilePath = outFilePath; ViewEventHelper.Instance.SendCommand <gameview_stop_screenCapture>(GameLogicDef.GVIEWCMD_SCREENOPEN_STOP, ref data); bRECValid = false; recType = EMScreenRECType.EMSS_Invalid; checkPointTime = 0; nHeroID = 0; recState = EMRECState.EMREC_STOP; }
private void StartRecord() { if (!bOpenREC) { return; } if (GameLogicAPI.isMainMap(SceneManager.Instance.getCurrentMapId())) { return; } string rootPath = ViewConfigManager.DataUserPath; if (rootPath == "") { return; } string tempPath = rootPath + "/" + szTempPathName; if (!Directory.Exists(tempPath)) { Directory.CreateDirectory(tempPath); } gameview_start_screenCapture data = new gameview_start_screenCapture(); if (Application.isEditor) { data.point_x = 0; data.point_y = 0; int width, height; ImageSetting.GetMainMonitorSize(out width, out height); data.width = width; data.height = height; } else { RECTAPI rect = new RECTAPI(); GameLogicAPI.GetWindowRect(Initialize.m_WindowHwnd, ref rect); data.point_x = rect.left; data.point_y = rect.top; int titleHeight = GameLogicAPI.GetSystemMetrics((int)ESystemMetrics.SM_CYCAPTION); //int frameBorder = GameLogicAPI.GetSystemMetrics((int)ESystemMetrics.SM_CXFRAME); data.width = rect.right - rect.left; data.height = rect.bottom - rect.top; if (rect.top > 0) { data.point_y += titleHeight; data.height -= titleHeight; } } data.width = Mathf.Abs(data.width % 2 == 0 ? data.width : data.width - 1); data.height = Mathf.Abs(data.height % 2 == 0 ? data.height : data.height - 1); data.szTempFilePath = tempPath; ViewEventHelper.Instance.SendCommand <gameview_start_screenCapture>(GameLogicDef.GVIEWCMD_SCREENOPEN_OPEN, ref data); bRECValid = false; nHeroID = 0; checkPointTime = 0; recType = EMScreenRECType.EMSS_Invalid; recState = EMRECState.EMREC_RECORD; }
public SWarGloryMomentVideoData(EMScreenRECType type, string path) { videoType = type; szVideoPath = path; }