public void Prepare() { try { //PixelsMap.DisComInit(); lock (_oLock) { if (_bPrepared) { (new Logger()).WriteWarning("Hashtags has already prepared!"); return; } _bPrepared = true; } (new Logger()).WriteDebug("prepare:in"); _cPreferences.cRoll.Stopped += _cRoll_Stopped; _cPreferences.cRoll.EffectAdd(_cPreferences.cPlaylist, null, 0); _cCurrentTI = _cPreferences.aTextItems[0]; _cPreferences.cRoll.Prepare(2); AddTransition(Transition.Initial); _cThreadWorker = new System.Threading.Thread(Worker); _cThreadWorker.IsBackground = true; _cThreadWorker.Priority = System.Threading.ThreadPriority.Normal; _cThreadWorker.Start(); if (null != Prepared) { Plugin.EventSend(Prepared, this); } (new Logger()).WriteDebug("prepare:out"); } catch (Exception ex) { (new Logger()).WriteError(ex); } }
private void AddTransition(Transition eTrans) { switch (eTrans) { case Transition.Initial: _cPreferences.cRoll.EffectAdd(_cCurrentTI.cBTLText, _cCurrentTI.cNode); _nNormTop = 0; _nDifTop = (_cCurrentTI.cBTLText.stArea.nHeight * 0.67F - _nNormTop) / _cCurrentTI.nTransDuration; _nNormBot = _cCurrentTI.cBTLText.nPressBottom; _nDifBot = (140 - _nNormBot) / _cCurrentTI.nTransDuration; for (int nI = 0; nI <= _cCurrentTI.nTransDuration; nI++) { _cCurrentTI.cBTLText.nPressBottom = 140 - _nDifBot * nI; _cPreferences.cRoll.Prepare(1); } while (_cPreferences.cRoll.nPrerenderQueueCount < (ulong)_cPreferences.nRollPrerenderQueueMax) { _cPreferences.cRoll.Prepare(1); } break; case Transition.Normal: Preferences.TextItem cPrevious = _cCurrentTI; _cCurrentTI = _cCurrentTI.cNext; _cPreferences.cRoll.EffectAdd(_cCurrentTI.cBTLText, _cCurrentTI.cNode); for (int nI = 0; nI < _cCurrentTI.nTransDuration; nI++) { cPrevious.cBTLText.nPressBottom = _nNormBot + _nDifBot * (nI + 1); _cPreferences.cRoll.SetKeyframesToEffect(cPrevious.cBTLText, new Roll.Keyframes(null, new Roll.Keyframe[1] { new Roll.Keyframe() { eType = Roll.Keyframe.Type.hold, nFrame = 0, nPosition = _nNormTop + _nDifTop * (nI + 1) } })); _cCurrentTI.cBTLText.nPressBottom = 140 - _nDifBot * nI; _cPreferences.cRoll.Prepare(1); } _cCurrentTI.cBTLText.nPressBottom = _nNormBot; cPrevious.cBTLText.Stop(); _cPreferences.cRoll.Prepare(1); cPrevious.cBTLText.Idle(); cPrevious.cBTLText.nPressBottom = _nNormBot; break; case Transition.Final: for (int nI = 0; nI < _cCurrentTI.nTransDuration; nI++) { if (nI == 2) { _cPreferences.cPlaylist.Skip(true, 0); } _cCurrentTI.cBTLText.nPressBottom = _nNormBot + _nDifBot * (nI + 1); //_cPreferences.cRoll.SetKeyframesToEffect(_cCurrentTI.cBTLText, new Roll.Keyframe[1] { new Roll.Keyframe() { eType = Roll.Keyframe.Type.hold, nFrame = 0, nPosition = _nNormTop + _nDifTop * nI } }); _cPreferences.cRoll.Prepare(1); } _cCurrentTI.cBTLText.Stop(); _cPreferences.cRoll.Prepare(1); break; default: break; } }