Example #1
0
        public void Prepare()
        {
            try
            {
                DisCom.Init();

                _cRoll = new btl.Roll();
                _cRoll.eDirection = _cPreferences.eDirection;
                _cRoll.nSpeed = _cPreferences.nSpeed;
                _cRoll.stArea = _cPreferences.stArea;
                _cRoll.bCUDA = _cPreferences.bRollCuda;
                _cRoll.nLayer = _cPreferences.nLayer;
                _cRoll.bOpacity = false;
                _cRoll.Prepare();

                _aItems = new List<Item>();
                _cTimerRequest = new System.Threading.Timer(TickRequest);
                TickRequest(null);
				_cRollFeed = new Thread(RollFeed);
				_cRollFeed.IsBackground = true;
				_cRollFeed.Start();

                if (null != Prepared)
                    Plugin.EventSend(Prepared, this);
                (new Logger()).WriteDebug3("ok");
            }
            catch (Exception ex)
            {
                (new Logger()).WriteError(ex);
            }
        }
Example #2
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);
            }
        }
Example #3
0
        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);
            }
        }