Beispiel #1
0
        private TimeSpan GetNextTimerInterval()
        {
            int interval            = Settings.Instance.InfoWindowRefreshInterval;
            int secondsToNextUpdate = 0;

            if (Settings.Instance.InfoWindowItemProgressBarType == 0)
            {
                // ProgressBar を動かす必要がないので、 次にステートが変わるまでの最小時間を探す
                int nowSeconds  = TickToSecond(DateTime.Now.Ticks);
                int level1Ticks = nowSeconds + Settings.Instance.InfoWindowItemLevel1Seconds;
                int level2Ticks = Settings.Instance.InfoWindowItemFilterLevel > 1 ? nowSeconds + Settings.Instance.InfoWindowItemLevel2Seconds : int.MaxValue;
                int level3Ticks = Settings.Instance.InfoWindowItemFilterLevel > 2 ? nowSeconds + Settings.Instance.InfoWindowItemLevel3Seconds : int.MaxValue;
                secondsToNextUpdate = ReserveList.Select(x => x.OnAirOrRecStart < level1Ticks ? -1 :
                                                         x.OnAirOrRecStart < level2Ticks ? x.OnAirOrRecStart - level1Ticks :
                                                         x.OnAirOrRecStart < level3Ticks ? x.OnAirOrRecStart - level2Ticks : x.OnAirOrRecStart - level3Ticks)
                                      .Where(x => x > 0L)
                                      .OrderBy(x => x)
                                      .FirstOrDefault();

                // Timer の誤差を考慮して、1更新間隔分前に一度更新されるようにしておく
                secondsToNextUpdate -= interval;
            }
            if (secondsToNextUpdate <= 0)
            {
                secondsToNextUpdate = interval - DateTime.Now.Second % interval;
            }

            System.Diagnostics.Debug.WriteLine(DateTime.Now + " Sleep: " + secondsToNextUpdate + " [sec]");

            return(new TimeSpan(0, 0, secondsToNextUpdate));
        }
Beispiel #2
0
        private void UpdateReserveList()
        {
            if (ReserveList == null)
            {
                return;
            }

            int nowSeconds = TickToSecond(DateTime.Now.Ticks);

            ReserveList.ForEach(item => item.Update(nowSeconds));
        }
Beispiel #3
0
        public ReserveDataAppend GetReserveDataAppend(ReserveData master)
        {
            if (master == null)
            {
                return(null);
            }

            if (reserveAppendList == null)
            {
                reserveAppendList             = ReserveList.ToDictionary(data => data.Key, data => new ReserveDataAppend());
                updateReserveAppendEpgAuto    = true;
                updateReserveAppendManualAuto = true;
            }
            //キーワード予約が更新された場合
            if (updateReserveAppendEpgAuto == true)
            {
                foreach (ReserveDataAppend data in reserveAppendList.Values)
                {
                    data.EpgAutoList.Clear();
                }
                foreach (EpgAutoAddData item in EpgAutoAddList.Values)
                {
                    item.GetReserveList().ForEach(info => reserveAppendList[info.ReserveID].EpgAutoList.Add(item));
                }
            }
            //プログラム予約が更新された場合
            if (updateReserveAppendManualAuto == true)
            {
                foreach (ReserveDataAppend data in reserveAppendList.Values)
                {
                    data.ManualAutoList.Clear();
                }
                foreach (ManualAutoAddData item in ManualAutoAddList.Values)
                {
                    item.GetReserveList().ForEach(info => reserveAppendList[info.ReserveID].ManualAutoList.Add(item));
                }
            }
            //その他データの再構築
            if (updateReserveAppendEpgAuto == true || updateReserveAppendManualAuto == true)
            {
                foreach (ReserveDataAppend data in reserveAppendList.Values)
                {
                    data.UpdateData();
                }
                updateReserveAppendEpgAuto    = false;
                updateReserveAppendManualAuto = false;
            }

            ReserveDataAppend retv;

            reserveAppendList.TryGetValue(master.ReserveID, out retv);
            return(retv ?? new ReserveDataAppend());
        }
Beispiel #4
0
        public ReserveDataAppend GetReserveDataAppend(ReserveData master)
        {
            if (master == null)
            {
                return(null);
            }

            Dictionary <uint, ReserveDataAppend> dict = reserveAppendList;

            if (dict == null)
            {
                dict = ReserveList.ToDictionary(data => data.Key, data => new ReserveDataAppend());
                reserveAppendList = dict;

                foreach (EpgAutoAddData item in EpgAutoAddList.Values)
                {
                    item.GetReserveList().ForEach(info => dict[info.ReserveID].EpgAutoList.Add(item));
                }

                foreach (ManualAutoAddData item in ManualAutoAddList.Values)
                {
                    item.GetReserveList().ForEach(info => dict[info.ReserveID].ManualAutoList.Add(item));
                }

                foreach (ReserveData item in ReserveList.Values.Where(data => data.IsEpgReserve == true))
                {
                    UInt64 key = item.Create64PgKey();
                    dict[item.ReserveID].MultipleEPGList.AddRange(ReserveList.Values.Where(data => data.Create64PgKey() == key && data != item));
                }

                foreach (ReserveDataAppend data in dict.Values)
                {
                    data.UpdateData();
                }
            }

            ReserveDataAppend retv;

            if (dict.TryGetValue(master.ReserveID, out retv) == false)
            {
                retv = new ReserveDataAppend();
            }
            return(retv);
        }
Beispiel #5
0
        /// <summary>
        /// 予約情報の録画予定ファイル名のみ再読み込みする
        /// </summary>
        /// <returns></returns>
        public ErrCode ReloadReserveRecFileNameList(bool immediately = false, bool noRaiseChanged = false)
        {
            return(ReloadWork(UpdateNotifyItem.ReserveName, immediately, noRaiseChanged, ret =>
            {
                bool changed = false;
                if (ReserveList.Count > 0)
                {
                    var list = new List <ReserveData>();
                    try { ret = CommonManager.CreateSrvCtrl().SendEnumReserve(ref list); } catch { ret = ErrCode.CMD_ERR; }
                    if (ret != ErrCode.CMD_SUCCESS)
                    {
                        return ret;
                    }

                    foreach (ReserveData info in list)
                    {
                        if (ReserveList.ContainsKey(info.ReserveID))
                        {
                            if (ReserveList[info.ReserveID].RecFileNameList.Count != info.RecFileNameList.Count)
                            {
                                ReserveList[info.ReserveID].RecFileNameList = info.RecFileNameList;
                                changed = true;
                            }
                            else
                            {
                                for (int i = 0; i < info.RecFileNameList.Count; i++)
                                {
                                    if (ReserveList[info.ReserveID].RecFileNameList[i] != info.RecFileNameList[i])
                                    {
                                        ReserveList[info.ReserveID].RecFileNameList = info.RecFileNameList;
                                        changed = true;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
                ResetNotifyWork(UpdateNotifyItem.ReserveName, !changed || noRaiseChanged);
                return ret;
            }));
        }
Beispiel #6
0
    // Use this for initialization
    void Start()
    {
        for (int i = 0; i < 3; i++)
        {
            flowerLists[i]        = new ReserveList <float>();
            workingFlowerLists[i] = new List <Flower>();
            readyFlowerLists[i]   = new List <Flower>();
        }

        for (int i = 0; i < 10; i++)
        {
            for (var l = 0; l < 3; l++)
            {
                Flower flower = (Flower)Instantiate(FlowerPrefabs[l], new Vector3(-5f, 0, 0), Quaternion.identity);
                readyFlowerLists[l].Add(flower);
            }
        }

        InitHurdle();

        PlatformController.HurdleControllerReady = true;
    }