Ejemplo n.º 1
0
        // 現在の状態を文字列に出力する
        internal StatusCollection dumpStatus(Int64 now)
        {
            var expireExceed       = this.expireExceed;
            var remainExpireExceed = expireExceed - now;
            var hasExceed          = remainExpireExceed > 0L;
            var expectedReset      = giftHistory.expectedReset(now);

            var sc = new StatusCollection();

            sc.addRun($"{itemName} 所持数 {giftCounts.sumInTime( now )?.ToString() ?? "不明"} ");
            giftHistory.addCountTo(sc, hasExceed);

            /*
             *          var hyperLink = new Hyperlink() {
             *              NavigateUri = new Uri( $"stargarner://{itemNameEn}/settings" )
             *          };
             *          hyperLink.Inlines.Add( "設定" );
             *          hyperLink.RequestNavigate += (sender, e) => window.openSetting(this);
             *          sc.addLink( hyperLink );
             */
            giftHistory.addTo(sc);


            var eventList = new List <EventTime>();

            if (hasExceed)
            {
                eventList.Add(new EventTime(1, "制限解除", expireExceed, remainExpireExceed));
            }

            if (!hasExceed || expectedReset > expireExceed)
            {
                var delta = expectedReset - now;
                if (delta > 0L)
                {
                    eventList.Add(new EventTime(2, "解除予測", expectedReset, delta));
                }
            }

            do
            {
                var st = liveStarts.current(now);

                if (st == null)
                {
                    break; // 配信予定がない
                }
                var firstLap = st.time + st.offset - UnixTime.hour1 * 2L;
                var delta    = firstLap - now;
                if (delta > 0L)
                {
                    eventList.Add(new EventTime(3, "1周目集め", firstLap, delta));
                    break;
                }

                var dropTime = st.time + st.offset - UnixTime.hour1;
                delta = dropTime - now;
                if (delta > 0L)
                {
                    eventList.Add(new EventTime(4, "捨て時刻", dropTime, delta));
                    break;
                }

                delta = st.time - now;
                if (delta > 0L)
                {
                    eventList.Add(new EventTime(5, "配信開始", st.time, delta));
                    break;
                }

                var thrdLapStart = st.time + st.offset;
                delta = thrdLapStart - now;
                // 3周目は過去になっても表示する
                eventList.Add(new EventTime(6, "3周目開始", thrdLapStart, delta));
            } while (false);

            eventList.Sort();

            foreach (var ev in eventList)
            {
                sc.add($"{ev.time.formatTime()} 残{ev.remain.formatDuration()} {ev.name}");
            }

            return(sc);
        }