public Preferences(string sData) { (new Logger()).WriteDebug("[source=" + sData + "]"); XmlDocument cXmlDocument = new XmlDocument(); cXmlDocument.LoadXml(sData); XmlNode cNodeChild, cXmlNode = cXmlDocument.NodeGet("data"); _nVideoFramesDelay = cXmlNode.AttributeOrDefaultGet <ushort>("video_prepare_delay", 0); cNodeChild = cXmlNode.NodeGet("credits"); _sCredits = cNodeChild.ToStr(0); cNodeChild = cXmlNode.NodeGet("hashtag"); _cHashTag = new btl.Animation(cNodeChild); cNodeChild = cXmlNode.NodeGet("overlay_top"); _cOverTop = new btl.Animation(cNodeChild); cNodeChild = cXmlNode.NodeGet("overlay_bottom"); _cOverBot = new btl.Animation(cNodeChild); while (null != (cNodeChild = cXmlNode.NodeGet("roll", false))) { if (null == _aRoll) { _aRoll = new List <btl.Roll>(); } _aRoll.Add(new btl.Roll(cNodeChild)); cXmlNode.RemoveChild(cNodeChild); } }
public void Init() { Animation cBadgeIn = new Animation(_cPreferences.sBadgeIn, 1, false); if (0 == _cPreferences.stBadgeSize.Width) _cPreferences.stBadgeSize.Width = (int)cBadgeIn.stArea.nWidth; if (0 == _cPreferences.stBadgeSize.Height) _cPreferences.stBadgeSize.Height = (int)cBadgeIn.stArea.nHeight; _cPlaylistBadge = new Playlist(); _cPlaylistBadge.nLayer = _cPreferences.nBadgeLayer; _cPlaylistBadge.bStopOnEmpty = true; _cPlaylistBadge.OnPlaylistIsEmpty += OnPlaylistIsEmpty; _cPlaylistBadge.stArea = new Area(_cPreferences.stBadgeSize); _cPlaylistBadge.EffectAdd(cBadgeIn, 0); _cPlaylistBadge.EffectAdd(new Animation(_cPreferences.sBadgeLoop, 0, true), 0); _cPlaylistBadge.EffectAdd(new Animation(_cPreferences.sBadgeOut, 1, false), 0); _cPlaylistBadge.Prepare(); _cShowLoop = new Animation(_cPreferences.sShowLoop, 0, true); if (0 == _cPreferences.stShowSize.Width) _cPreferences.stShowSize.Width = (int)_cShowLoop.stArea.nWidth; if (0 == _cPreferences.stShowSize.Height) _cPreferences.stShowSize.Height = (int)_cShowLoop.stArea.nHeight; _cShowOut = new Animation(_cPreferences.sShowOut, 1, false); _cShowTransition = new Animation(_cPreferences.sShowTransition, 1, true); _cStandbyLoop = new Animation(_cPreferences.sStandbyLoop, 0, true); _cStandbyTransition = new Animation(_cPreferences.sStandbyTransition, 1, true); _cStandbyOut = new Animation(_cPreferences.sStandbyOut, 1, false); _cMatOut = new Animation(_cPreferences.sOut, 1, false); _cMatOut.stArea = new Area(_cPreferences.stOutSize); _cMatOut.nLayer = _cPreferences.nOutLayer; _cMatOut.Prepare(); Animation cStandbyIn = new Animation(_cPreferences.sStandbyIn, 1, false); cStandbyIn.Prepare(); _cStandbyLoop.Prepare(); _cPlaylistShow = new Playlist(); _cPlaylistShow.nLayer = _cPreferences.nShowLayer; _cPlaylistShow.bStopOnEmpty = true; _cPlaylistShow.OnPlaylistIsEmpty += OnPlaylistIsEmpty; _cPlaylistShow.stArea = new Area(_cPreferences.stShowSize); _cPlaylistShow.EffectAdd(cStandbyIn, 0); _cPlaylistShow.EffectAdd(_cStandbyLoop, 0); _cPlaylistShow.Prepare(); _cStandbyOut.Prepare(); _cShowOut.Prepare(); _cStandbyTransition.Prepare(); _cShowTransition.Prepare(); }
public void Init() { _aqMessages = new Queue<SMS>(); _aqMessagesVIP = new Queue<SMS>(); _aqMessageIDsDisplayed = new Queue<long>(); _aQueuedIDs = new List<long>(); _ahQueuedIDsDates = new Dictionary<long, DateTime>(); _cMaskSingle = new Animation(_cPreferences.sMaskPageSingle, 0, true) { stArea = new Area(_cPreferences.stSize) { nTop = 0, nLeft = 0 }, bCUDA = false }; _cMaskMulti = new Animation(_cPreferences.sMaskPageMulti, 0, true) { stArea = new Area(_cPreferences.stSize) { nTop = 0, nLeft = 0 }, bCUDA = false }; _cRoll = new Roll(); _cRoll.eDirection = Roll.Direction.Up; _cRoll.nSpeed = _cPreferences.nSpeed; _cRoll.stArea = new Area(_cPreferences.stSize); _cRoll.bCUDA = true; _cRoll.nLayer = _cPreferences.nLayer; _cRoll.EffectIsOffScreen += _cRoll_EffectIsOffScreen; _cRoll.EffectIsOnScreen += _cRoll_EffectIsOnScreen; _bVisible = false; }
public void AnimationAdd(Animation cAnimation, ushort nTransDur) { EffectAdd(new Item(cAnimation, nTransDur)); }
public Animation AnimationAdd(string sFileName, ushort nLoopsQty, bool bKeepAlive, ushort nTransDur) { Animation cRetVal = new Animation(sFileName, nLoopsQty, bKeepAlive); AnimationAdd(cRetVal, nTransDur); return cRetVal; }
public void StartPhotos() // (просьба была стартовать каждую минуту) { Animation cLoop = null; if (_bStopping) return; _cPLPhotoLeft.AnimationAdd(new Animation(Path.Combine(_cPreferences.sFolderMat, "voting_imagesL_in")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = false, bOpacity = false, nLoopsQty = 1 }, 0); lock (_aLoops) { cLoop = new Animation(Path.Combine(_cPreferences.sFolderMat, "voting_imagesL_loop")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = true, bOpacity = false, nLoopsQty = nLoopImages, oTag = "voting_imagesL_loop" }; _cPLPhotoLeft.AnimationAdd(cLoop, 0); _aLoops.Add(cLoop); } _cPLPhotoLeft.AnimationAdd(new Animation(Path.Combine(_cPreferences.sFolderMat, "voting_imagesL_out")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = false, bOpacity = false, nLoopsQty = 1, oTag = "voting_imagesL_out" }, 0); _cPLPhotoRight.AnimationAdd(new Animation(Path.Combine(_cPreferences.sFolderMat, "voting_imagesR_in")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = false, bOpacity = false, nLoopsQty = 1 }, 0); lock (_aLoops) { cLoop = new Animation(Path.Combine(_cPreferences.sFolderMat, "voting_imagesR_loop")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = true, bOpacity = false, nLoopsQty = nLoopImages, oTag = "voting_imagesR_loop" }; _cPLPhotoRight.AnimationAdd(cLoop, 0); _aLoops.Add(cLoop); } _cPLPhotoRight.AnimationAdd(new Animation(Path.Combine(_cPreferences.sFolderMat, "voting_imagesR_out")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = false, bOpacity = false, nLoopsQty = 1, oTag = "voting_imagesR_out" }, 0); _dtPhotosLastStart = DateTime.Now; }
void _cPLMatTop_EffectStarted(Effect cSender, Effect cEffect) { Animation cLoop = null; if (!_bStopping && cEffect is Animation && ((Animation)cEffect).oTag == "voting_top_loop1" && DateTime.Now.Subtract(_dtPhotosLastStart).TotalSeconds > _dtPhotosStartInterval) { StartPhotos(); } if (cEffect is Animation && ((Animation)cEffect).oTag == "voting_top_loop1") { if (_bStopping) { if (_bBottomStopping) { _cPLMatTop.AnimationAdd(new Animation(Path.Combine(_cPreferences.sFolderMat, "voting_top_loop1")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = true, bOpacity = false, nLoopsQty = nLoopTop }, 0); _cPLMatTop.AnimationAdd(new Animation(Path.Combine(_cPreferences.sFolderMat, "voting_top_out")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = false, bOpacity = false, nLoopsQty = 1 }, 0); _cPLMatTop.nDuration = _cPLMatTop.nFrameCurrent + _nEmergencyDuration; _cPLMatTop.Skip(true, 0); } else _cPLMatTop.AnimationAdd(new Animation(Path.Combine(_cPreferences.sFolderMat, "voting_top_loop1")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = true, bOpacity = false, nLoopsQty = 25, oTag = "voting_top_loop1" }, 0); return; } _cPLMatTop.AnimationAdd(new Animation(Path.Combine(_cPreferences.sFolderMat, "voting_top_switch1")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = false, bOpacity = false, nLoopsQty = 1, oTag = "voting_top_switch1" }, 0); lock (_aLoops) { cLoop = new Animation(Path.Combine(_cPreferences.sFolderMat, "voting_top_loop2")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = true, bOpacity = false, nLoopsQty = nLoopTop, oTag = "voting_top_loop2" }; _cPLMatTop.AnimationAdd(cLoop, 0); _aLoops.Add(cLoop); } _cPLMatTop.AnimationAdd(new Animation(Path.Combine(_cPreferences.sFolderMat, "voting_top_switch2")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = false, bOpacity = false, nLoopsQty = 1 }, 0); lock (_aLoops) { cLoop = new Animation(Path.Combine(_cPreferences.sFolderMat, "voting_top_loop1")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = true, bOpacity = false, nLoopsQty = nLoopTop, oTag = "voting_top_loop1" }; _cPLMatTop.AnimationAdd(cLoop, 0); _aLoops.Add(cLoop); } } }
void _cPLMatMiddle_EffectStarted(Effect cSender, Effect cEffect) { Animation cLoop = null; if (cEffect is Animation && ((Animation)cEffect).oTag == "new_votes_loop") // временные новые голоса { CopyTMPToNormalPlace(); lock (_aLoops) { cLoop = new Animation(Path.Combine(_cPreferences.sFolderVotes, "voting_mid_loop1")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = true, bOpacity = false, nLoopsQty = nLoopMid, oTag = "voting_mid_loop1" }; _cPLMatMiddle.AnimationAdd(cLoop, 0); _aLoops.Add(cLoop); } return; } if (cEffect is Animation && ((Animation)cEffect).oTag == "voting_mid_loop1") // старые голоса { if (_bStopping) { _cPLMatBottom.AnimationAdd(new Animation(Path.Combine(_cPreferences.sFolderMat, "voting_bot_loop")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = true, bOpacity = false, nLoopsQty = (ushort)(nLoopMid - 7) }, 0); // на 7 кадров раньше должен уходить чем мид _cPLMatBottom.AnimationAdd(new Animation(Path.Combine(_cPreferences.sFolderMat, "voting_bot_out")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = false, bOpacity = false, nLoopsQty = 1 }, 0); _cPLMatBottom.nDuration = _cPLMatBottom.nFrameCurrent + _nEmergencyDuration; _cPLMatBottom.Skip(true, 0); _bBottomStopping = true; _cPLMatMiddle.AnimationAdd(new Animation(Path.Combine(_cPreferences.sFolderVotes, "voting_mid_loop1")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = true, bOpacity = false, nLoopsQty = 10 }, 0); _cPLMatMiddle.AnimationAdd(new Animation(Path.Combine(_cPreferences.sFolderVotes, "voting_mid_out")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = false, bOpacity = false, nLoopsQty = 1 }, 0); _cPLMatMiddle.nDuration = _cPLMatMiddle.nFrameCurrent + _nEmergencyDuration; _cPLMatMiddle.Skip(false, 0); return; } if (_bBlenderDidNewVotes) { _bBlenderDidNewVotes = false; _cPLMatMiddle.AnimationAdd(new Animation(Path.Combine(_cPreferences.sFolderVotes, "!old_percents__new_votes")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = false, bOpacity = false, nLoopsQty = 1 }, 0); lock (_aLoops) { cLoop = new Animation(Path.Combine(_cPreferences.sFolderVotes, "!new_votes_loop")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = true, bOpacity = false, nLoopsQty = nLoopMid, oTag = "new_votes_loop" }; _cPLMatMiddle.AnimationAdd(cLoop, 0); _aLoops.Add(cLoop); } return; } lock (_aLoops) { cLoop = new Animation(Path.Combine(_cPreferences.sFolderVotes, "voting_mid_loop1")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = true, bOpacity = false, nLoopsQty = nLoopMid, oTag = "voting_mid_loop1" }; _cPLMatMiddle.AnimationAdd(cLoop, 0); _aLoops.Add(cLoop); } } if (!_bStopping && !_bBlenderDidNewVotes && !_bBlenderIsPreparing) { _bBlenderIsPreparing = true; PrepareVotes(); } }
public void PreparePlaylists() { _bBlenderDidNewVotes = false; _bBlenderIsPreparing = false; _cPLMatTop = new btl.Playlist() { bCUDA = _cPreferences.bCUDA, nLayer = _cPreferences.nLayer, nDelay = 0, cDock = new Dock(_cPreferences.nLeft, (short)(_cPreferences.nTop + 67)), bStopOnEmpty = true, bOpacity = false }; _cPLMatMiddle = new btl.Playlist() { bCUDA = _cPreferences.bCUDA, nLayer = _cPreferences.nLayer, nDelay = 34, cDock = new Dock((short)(_cPreferences.nLeft + 186), (short)(_cPreferences.nTop + 87)), bStopOnEmpty = true, bOpacity = false }; _cPLMatBottom = new btl.Playlist() { bCUDA = _cPreferences.bCUDA, nLayer = _cPreferences.nLayer, nDelay = 22, cDock = new Dock(_cPreferences.nLeft, (short)(_cPreferences.nTop + 87)), bStopOnEmpty = true, bOpacity = false }; _cPLPhotoLeft = new btl.Playlist() { bCUDA = _cPreferences.bCUDA, nLayer = _cPreferences.nLayer, nDelay = 50, cDock = new Dock(_cPreferences.nLeft, _cPreferences.nTop), bStopOnEmpty = false, bOpacity = false }; _cPLPhotoRight = new btl.Playlist() { bCUDA = _cPreferences.bCUDA, nLayer = _cPreferences.nLayer, nDelay = 50, cDock = new Dock((short)(_cPreferences.nLeft + 253), _cPreferences.nTop), bStopOnEmpty = false, bOpacity = false }; Animation cLoop; _cPLMatTop.AnimationAdd(new Animation(Path.Combine(_cPreferences.sFolderMat, "voting_top_in")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = false, bOpacity = false, nLoopsQty = 1 }, 0); cLoop = new Animation(Path.Combine(_cPreferences.sFolderMat, "voting_top_loop1")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = true, bOpacity = false, nLoopsQty = _nLoopTop, oTag = "voting_top_loop1" }; lock (_aLoops) _aLoops.Add(cLoop); _cPLMatTop.AnimationAdd(cLoop, 0); _cPLMatTop.EffectStarted += new ContainerVideoAudio.EventDelegate(_cPLMatTop_EffectStarted); _cPLMatTop.EffectStopped += new ContainerVideoAudio.EventDelegate(RemoveOnStopped); _cPLMatBottom.AnimationAdd(new Animation(Path.Combine(_cPreferences.sFolderMat, "voting_bot_in")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = false, bOpacity = false, nLoopsQty = 1 }, 0); _cPLMatBottom.AnimationAdd(new Animation(Path.Combine(_cPreferences.sFolderMat, "voting_bot_loop")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = true, bOpacity = false, nLoopsQty = 0 }, 0); _cPLMatMiddle.AnimationAdd(new Animation(Path.Combine(_cPreferences.sFolderVotes, "voting_mid_in")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = false, bOpacity = false, nLoopsQty = 1 }, 0); cLoop = new Animation(Path.Combine(_cPreferences.sFolderVotes, "voting_mid_loop1")) { bCUDA = _cPreferences.bCUDA, bKeepAlive = true, bOpacity = false, nLoopsQty = _nLoopMid, oTag = "voting_mid_loop1" }; _cPLMatMiddle.AnimationAdd(cLoop, 0); lock (_aLoops) _aLoops.Add(cLoop); _cPLMatMiddle.EffectStarted += new ContainerVideoAudio.EventDelegate(_cPLMatMiddle_EffectStarted); _cPLMatMiddle.EffectStopped += new ContainerVideoAudio.EventDelegate(RemoveOnStopped); _cPLMatTop.Stopped += new Effect.EventDelegate(PL_Stopped); _cPLMatBottom.Stopped += new Effect.EventDelegate(PL_Stopped); _cPLMatMiddle.Stopped += new Effect.EventDelegate(PL_Stopped); _cPLPhotoLeft.Stopped += new Effect.EventDelegate(PL_Stopped); _cPLPhotoRight.Stopped += new Effect.EventDelegate(PL_Stopped); _cPLPhotoLeft.EffectStopped += new ContainerVideoAudio.EventDelegate(RemoveOnStopped); _cPLPhotoRight.EffectStopped += new ContainerVideoAudio.EventDelegate(RemoveOnStopped); _cPLMatTop.Prepare(); _cPLMatBottom.Prepare(); _cPLMatMiddle.Prepare(); _cPLPhotoLeft.Prepare(); _cPLPhotoRight.Prepare(); _cPLPhotoLeft.Start(); _cPLPhotoRight.Start(); (new Logger()).WriteDebug3("ok"); }
private static void InitSmilesAnimations(string sWorkFolder) { if (null == _ahSmilesAnimationBinds) { _ahSmilesAnimationBinds = new Hashtable(); Animation cAnimSmile; foreach (DictionaryEntry ni in _ahSmilesBinds) { string sFolder = sWorkFolder + ni.Value.ToString(); if (Directory.Exists(sFolder)) { cAnimSmile = new Animation(sFolder, 0); cAnimSmile.bCUDA = false; cAnimSmile.Prepare(); _ahSmilesAnimationBinds.Add(ni.Key, cAnimSmile); } } } }
private static Animation GetAnimation(string sSml, string sWorkFolder) { string sFolder; Animation cRetVal = null; if (null != _ahSmilesBinds && _ahSmilesBinds.ContainsKey(sSml)) { sFolder = sWorkFolder + _ahSmilesBinds[sSml].ToString(); if (Directory.Exists(sFolder)) { cRetVal = new Animation(sFolder, 0); cRetVal.bCUDA = false; cRetVal.Prepare(); } } return cRetVal; }
public SMILE(string sSml, string sWorkFolder, POSITION stPos) { this.sWorkFolder = sWorkFolder; sText = sSml; stPosition = stPos; if (null == _ahSmilesBinds) InitSmiles(); cAnimation = GetAnimation(sText, sWorkFolder); }
private Animation GetFlagAnim(string sFolder) { cAnim = new Animation(sFolder, 0, true); cAnim.bCUDA = false; cAnim.Prepare(); return cAnim; }
public void Prepare() { try { //PixelsMap.DisComInit(); _cRoll = new btl.Roll(); _cRoll.eDirection = _cPreferences.eDirection; _cRoll.nSpeed = _cPreferences.nSpeed; _cRoll.stArea = _cPreferences.stArea; _cRoll.stMergingMethod = _cPreferences.stRollMerging; _cRoll.nLayer = _cPreferences.nLayer; _cRoll.bOpacity = false; _cRoll.EffectIsOnScreen += _cRoll_EffectIsOnScreen; _nWaitAndStop = 0; if (_cPreferences.cBackground != null) { _stAreaComposite = new Area((short)(_cPreferences.stArea.nLeft - _cPreferences.cBackground.stArea.nLeft), (short)(_cPreferences.stArea.nTop - _cPreferences.cBackground.stArea.nTop), _cPreferences.stArea.nWidth, _cPreferences.stArea.nHeight); _cRoll.stArea = _cPreferences.cBackground.stArea; _cAnimIn = new Animation(_cPreferences.cBackground.sIn, 1, false); _cAnimIn.Prepare(); _cAnimLoop = new Animation(_cPreferences.cBackground.sLoop, 0, true); _cAnimLoop.Prepare(); _cAnimOut = new Animation(_cPreferences.cBackground.sOut, 1, false); _cAnimOut.Prepare(); _cPLBackground = new Playlist(); _cPLBackground.bStopOnEmpty = true; _cPLBackground.EffectAdd(_cAnimIn); _cPLBackground.EffectAdd(_cAnimLoop); _cPLBackground.EffectAdd(_cAnimOut); _cPLBackground.Prepare(); if (_cPreferences.cBackground.sMaskIn != null && _cPreferences.cBackground.sMaskIn.Length > 0) { _cMaskIn = new Animation(_cPreferences.cBackground.sMaskIn, 1, false); _cMaskIn.Prepare(); _cMaskLoop = new Animation(_cPreferences.cBackground.sMaskLoop, 0, true); _cMaskLoop.Prepare(); _cMaskOut = new Animation(_cPreferences.cBackground.sMaskOut, 1, false); _cMaskOut.Prepare(); _cMaskAllOff = new Animation(_cPreferences.cBackground.sMaskAllOff, 0, true); _cMaskAllOff.Prepare(); _cPLMask = new Playlist(); _cPLMask.bStopOnEmpty = false; _cPLMask.EffectAdd(_cMaskIn); _cPLMask.EffectAdd(_cMaskLoop); _cPLMask.EffectAdd(_cMaskOut); _cPLMask.EffectAdd(_cMaskAllOff); _cPLMask.Prepare(); } } else { _stAreaComposite = new Area(0, 0, _cPreferences.stArea.nWidth, _cPreferences.stArea.nHeight); } _cRoll.Prepare(); _aItems = new List <Item>(); _cTimerRequest = new System.Threading.Timer(TickRequest); TickRequest(null); _cRollFeed = new Thread(RollFeed); _cRollFeed.IsBackground = true; _cRollFeed.Start(); _cTimerStop = new System.Threading.Timer(AsyncStop); if (null != Prepared) { Plugin.EventSend(Prepared, this); } (new Logger()).WriteDebug3("ok"); } catch (Exception ex) { (new Logger()).WriteError(ex); } }