Ejemplo n.º 1
0
        public void Prepare()
        {
            try
            {
                //PixelsMap.DisComInit();
                lock (_oLock)
                {
                    if (_bPrepared)
                    {
                        (new Logger()).WriteWarning("Credits has already prepared!");
                        return;
                    }
                    _bPrepared = true;
                }
                (new Logger()).WriteDebug("prepare:in");
                btl.Roll cRoll = _cPreferences.cRoll;

                cRoll.Stopped += _cRoll_Stopped;
                btl.Text      cText;
                btl.Animation cAnim;
                //btl.Roll.Keyframe[] aKFHold = new btl.Roll.Keyframe[1] { new btl.Roll.Keyframe() { eType = Roll.Keyframe.Type.hold, nFrame = 0, nPosition = 0 } };



                bool bFirstTime = true;
                bool bLastTime  = false;
                int  nOdd       = 1;
                //cRoll.nDuration = 200;

                foreach (helpers.data.Data.WeatherItem cWI in _cPreferences.aWeatherItems)
                {
                    if (cWI == _cPreferences.aWeatherItems[_cPreferences.aWeatherItems.Count - 1])
                    {
                        bLastTime = true;
                    }
                    if (bFirstTime)
                    {
                        cRoll.EffectAdd(_cPreferences.ahItems["backgr_intro"].cVideo, null, false, false);
                        cRoll.Prepare(53);
                    }
                    // city
                    cText = (btl.Text)_cPreferences.ahItems["text_city_" + nOdd].cVideo;
                    cRoll.RemoveEffect(cText);
                    IdleEffect(cText);
                    cText.sText = cWI.sCity;
                    cText.iMask = _cPreferences.ahItems["mask_city_loop_" + nOdd].cVideo;
                    IdleEffect(cText.iMask);
                    cRoll.EffectAdd(cText, _cPreferences.ahItems["text_city_" + nOdd].aKFs[0], float.MinValue, false, 0, false, false);
                    cRoll.Prepare(3);
                    // time  81
                    cAnim = (btl.Animation)_cPreferences.ahItems["backgr_pink"].cVideo;
                    cRoll.RemoveEffect(cAnim);
                    IdleEffect(cAnim);
                    cRoll.EffectAdd(_cPreferences.ahItems["backgr_pink"].cVideo, null, false, false);

                    cText = (btl.Text)_cPreferences.ahItems["text_time"].cVideo;
                    cRoll.RemoveEffect(cText);
                    IdleEffect(cText);
                    cText.sText = cWI.sTime;
                    cText.iMask = _cPreferences.ahItems["mask_time"].cVideo;
                    IdleEffect(cText.iMask);
                    cRoll.EffectAdd(cText, _cPreferences.ahItems["text_time"].aKFs[0], float.MinValue, false, 0, false, false);
                    cRoll.Prepare(2);
                    // temperature
                    if (bFirstTime)
                    {
                        cRoll.EffectAdd(_cPreferences.ahItems["backgr_black_in"].cVideo, null, false, false);
                    }

                    cText = (btl.Text)_cPreferences.ahItems["text_temperature"].cVideo;
                    cRoll.RemoveEffect(cText);
                    cText.bWaitForOutDissolve = false;
                    IdleEffect(cText);
                    cText.sText = cWI.sTemperature.StartsWith("-") || cWI.sTemperature.StartsWith("+") ? cWI.sTemperature.Substring(0, 1) + " " + cWI.sTemperature.Substring(1) : cWI.sTemperature;
                    if (bFirstTime)
                    {
                        cText.iMask = _cPreferences.ahItems["mask_tempr_in"].cVideo;
                        IdleEffect(cText.iMask);
                    }
                    if (bFirstTime)
                    {
                        cRoll.EffectAdd(cText, _cPreferences.ahItems["text_temperature"].aKFs[0], float.MinValue, false, 0, false, false);
                    }
                    else if (bLastTime)
                    {
                        cRoll.EffectAdd(cText, _cPreferences.ahItems["text_temperature"].aKFs[1], float.MinValue, false, 0, false, false);
                    }
                    else
                    {
                        cRoll.EffectAdd(cText, _cPreferences.ahItems["text_temperature"].aKFs[2], float.MinValue, false, 0, false, false);
                    }
                    cRoll.Prepare(2);
                    // icon
                    try
                    {
                        cAnim = (btl.Animation)btl.Effect.EffectGet(_cPreferences.ahItems["animation_icon"].XMLReplace("{%FOLDER%}", cWI.sIcon));
                        cRoll.EffectAdd(cAnim, _cPreferences.ahItems["animation_icon"].aKFs[0], float.MinValue, false, 0, false, false);
                    }
                    catch (Exception ex)
                    {
                        (new Logger()).WriteError("icon problem [icon=" + cWI.sIcon + "]<br>" + ex);
                    }
                    cRoll.Prepare(6);
                    // ---
                    if (bFirstTime)
                    {
                        cRoll.EffectAdd(_cPreferences.ahItems["backgr_black_loop"].cVideo, null, false, false);
                        cRoll.EffectAdd(_cPreferences.ahItems["backgr_final_loop"].cVideo, null, false, false);
                        bFirstTime = false;
                    }
                    cRoll.Prepare(68);

                    nOdd = nOdd == 1 ? 2 : 1;
                }
                //cRoll.Prepare(5);
                StopEffect(_cPreferences.ahItems["backgr_black_loop"].cVideo);
                cAnim = (btl.Animation)_cPreferences.ahItems["backgr_black_out"].cVideo;
                StopEffect(cAnim);
                cRoll.EffectAdd(_cPreferences.ahItems["backgr_black_out"].cVideo, null, false, false);
                cText = (btl.Text)_cPreferences.ahItems["text_yandex"].cVideo;
                cRoll.EffectAdd(cText, null, false, false);
                cRoll.Prepare(110);
                cAnim = (btl.Animation)_cPreferences.ahItems["backgr_final_pink"].cVideo;
                StopEffect(cAnim);
                cRoll.EffectAdd(cAnim, null, false, false);
                cRoll.Prepare(8);
                StopEffect(_cPreferences.ahItems["backgr_final_loop"].cVideo);
                StopEffect(cText);
                cRoll.Prepare(20);

                if (null != Prepared)
                {
                    Plugin.EventSend(Prepared, this);
                }
                (new Logger()).WriteDebug("prepare:out");
            }
            catch (Exception ex)
            {
                (new Logger()).WriteError(ex);
            }
        }
Ejemplo n.º 2
0
			public void Init()
			{
				string sString = GetInfoSMSs();
				if (1 > sString.Length)
				{
					(new Logger()).WriteError("Init:GetInfoSMSs = ''");
					return;
				}
				lock (_cInfoCrawl = new Roll())
				{
					_cInfoCrawl.eDirection = Roll.Direction.Left;
					_cInfoCrawl.stArea = new helpers.Area(_cPreferences.stSize);
					_cCrawlText = new Text(sString, _cPreferences.cFont, _cPreferences.nBorderWidth);
					_cCrawlText.stColor = _cPreferences.stColor;
					_cCrawlText.stColorBorder = _cPreferences.stBorderColor;
					_cCrawlText.bCUDA = false;
					_cInfoCrawl.nSpeed = _cPreferences.nSpeed;
					_cInfoCrawl.nLayer = _cPreferences.nLayer;

					_cInfoCrawl.EffectIsOffScreen += new ContainerVideoAudio.EventDelegate(_cInfoCrawl_EffectIsOffScreen);
					_cInfoCrawl.EffectAdd(_cCrawlText);
					_cInfoCrawl.Prepare();
				}
			}
Ejemplo n.º 3
0
        private void RollFeed(object cState)
        {
            try
            {
                DateTime dtFirsItem = DateTime.MinValue;
                int      nLoop      = 0;
                bool     bFirsTime  = true;
                while (true)
                {
                    if (_cPreferences.nQueueLength > _cRoll.nEffectsQty)
                    {
                        Item[] aItems;
                        lock (_aItems)
                            aItems = _aItems.ToArray();
                        DateTime            dtNow = DateTime.Now;
                        Composite           cComposite;
                        ushort              nHeight, nTargetHeight, nLineHeight, nPauseDuration = 0, nPreviousPauseDuration = 0;
                        float               nSpeed = _cPreferences.nSpeed / 25;
                        uint                nFramesIn = 0;
                        int                 nDelay, nTransDelay = 0;
                        float               nMiddleRounded;
                        int                 nCorrectionPosition = 1;             //UNDONE   Через параметры!!
                        btl.Roll.Keyframe[] aKeyframes          = null;
                        nTransDelay = _cPreferences.nDelay / 40;

                        foreach (Item cItem in aItems.OrderBy(o => o.dt).Take(_cPreferences.nQueueLength - _cRoll.nEffectsQty).ToArray())
                        {
                            dtNow = DateTime.Now;

                            if (_cPreferences.nLoops > 0)                                                          // т.е. тормозимся сами по окончании проигрывания набора элементов столько-то раз
                            {
                                if (dtFirsItem == DateTime.MinValue && aItems.Count(o => o.dt == dtFirsItem) == 1) // 1-й луп был - это последний элемент лупа
                                {
                                    dtFirsItem = dtNow;
                                    nLoop      = 1;
                                }
                                else if (dtFirsItem > DateTime.MinValue && dtFirsItem == cItem.dt)                                    // очередной луп был  - это последний элемент лупа
                                {
                                    dtFirsItem = dtNow;
                                    nLoop++;
                                }
                                if (nLoop == _cPreferences.nLoops)
                                {
                                    _RollFeedStop = true;
                                }
                            }

                            cItem.dt          = dtNow.AddSeconds(1);
                            cComposite        = ItemParse(cItem);
                            cComposite.stArea = new Area(_stAreaComposite.nLeft, _stAreaComposite.nTop, cComposite.stArea.nWidth, cComposite.stArea.nHeight);
                            aKeyframes        = null;
                            if (0 < _cPreferences.nPause)
                            {
                                nPreviousPauseDuration = nPauseDuration;
                                nDelay        = _cRoll.nEffectsQty == 0 ? 0 : 1;
                                nTargetHeight = _cRoll.stArea.nHeight;

                                nHeight        = nLineHeight = cComposite.stArea.nHeight;
                                nPauseDuration = (ushort)(_cPreferences.nPause / 40);

                                nMiddleRounded = (float)Math.Round((nTargetHeight + nHeight) / 2F);
                                nFramesIn      = (uint)Math.Round(nMiddleRounded / nSpeed);
                                aKeyframes     = new btl.Roll.Keyframe[] {
                                    new btl.Roll.Keyframe()
                                    {
                                        eType     = btl.Roll.Keyframe.Type.linear,
                                        nFrame    = 0,
                                        nPosition = nTargetHeight
                                    },
                                    new btl.Roll.Keyframe()
                                    {
                                        eType     = btl.Roll.Keyframe.Type.linear,
                                        nFrame    = nFramesIn,
                                        nPosition = nTargetHeight - nMiddleRounded + nCorrectionPosition
                                    },
                                    new btl.Roll.Keyframe()
                                    {
                                        eType     = btl.Roll.Keyframe.Type.linear,
                                        nFrame    = nFramesIn + nPauseDuration,
                                        nPosition = nTargetHeight - nMiddleRounded + nCorrectionPosition
                                    },
                                    new btl.Roll.Keyframe()
                                    {
                                        eType     = btl.Roll.Keyframe.Type.linear,
                                        nFrame    = 2 * nFramesIn + nPauseDuration,
                                        nPosition = nTargetHeight - 2 * nMiddleRounded - 1
                                    }
                                };
                            }
                            if (bFirsTime)
                            {
                                bFirsTime = false;
                                if (_cPLBackground != null)
                                {
                                    btl.Roll.Keyframe[] aBackKeyframes = new BTL.Play.Roll.Keyframe[1] {
                                        new btl.Roll.Keyframe()
                                        {
                                            eType = btl.Roll.Keyframe.Type.hold, nFrame = 0, nPosition = 0
                                        }
                                    };
                                    _cRoll.EffectAdd(_cPLBackground, aBackKeyframes, 0, false);
                                }
                                if (_cPLMask != null)
                                {
                                    btl.Roll.Keyframe[] aMaskKeyframes = new BTL.Play.Roll.Keyframe[1] {
                                        new btl.Roll.Keyframe()
                                        {
                                            eType = btl.Roll.Keyframe.Type.hold, nFrame = 0, nPosition = 0
                                        }
                                    };
                                    _cPLMask.cMask = new Mask()
                                    {
                                        eMaskType = DisCom.Alpha.mask_all_upper
                                    };
                                    _cRoll.EffectAdd(_cPLMask, aMaskKeyframes, 0, false);
                                }
                            }
                            if (_cPreferences.nLoops > 0)
                            {
                                _cLastAddedEffect = cComposite;
                            }
                            _cRoll.EffectAdd(cComposite, aKeyframes, (ushort)((nTransDelay + nFramesIn / 2) > 0 ? (nTransDelay + nFramesIn / 2) : 0));
                            if (_RollFeedStop)
                            {
                                return;
                            }
                        }
                    }
                    Thread.Sleep(1000);
                }
            }
            catch (ThreadAbortException)
            { }
            catch (Exception ex)
            {
                (new Logger()).WriteError(ex);
            }
        }