コード例 #1
0
        protected string CyclicBroadcastStartString(TickerState state, CyclicBroadcastType broadcastType, string location)
        {
            if (!ConfigurationManager.Instance.Settings.CyclicBriefingsAllowed || broadcastType == CyclicBroadcastType.None)
            {
                return(null);
            }

            // For the briefing, context doesn't matter much. It gets weird if you try to make these in the context of only day or only night.
            switch (state)
            {
            case TickerState.Enabled:
                return($"It is day time {location}.");

            case TickerState.Disabled:
                return($"It is night time {location}.");

            case TickerState.Disabling:
                return($"It will be night time {location} soon.");

            case TickerState.Enabling:
                return($"It will be day time {location} soon.");

            default:
                return(null);
            }
        }
コード例 #2
0
        protected void OnEarthState(TickerState oldState, TickerState newState)
        {
            string location          = "on Earth";
            CyclicBroadcastType type = GetCyclicBroadcastType(ConfigurationManager.Instance.Settings.EarthDayNotifications, ConfigurationManager.Instance.Settings.EarthNightNotifications);
            string broadcast         = oldState == TickerState.Uninitialized ? CyclicBroadcastStartString(newState, type, location) : CyclicBroadcastChangeString(newState, type, location);

            if (!string.IsNullOrEmpty(broadcast))
            {
                Broadcast(broadcast);
            }
        }
コード例 #3
0
        protected string CyclicBroadcastChangeString(TickerState state, CyclicBroadcastType broadcastType, string location)
        {
            switch (broadcastType)
            {
            case CyclicBroadcastType.All:
                switch (state)
                {
                case TickerState.Enabled:
                    return($"Day time is starting {location}.");

                case TickerState.Disabled:
                    return($"Night time is starting {location}.");

                case TickerState.Disabling:
                    return($"Night time is starting {location} soon.");

                case TickerState.Enabling:
                    return($"Day time is starting {location} soon.");

                default:
                    return(null);
                }

            case CyclicBroadcastType.OnlyEnabled:
                switch (state)
                {
                case TickerState.Enabled:
                    return($"Day time is starting {location}.");

                case TickerState.Disabled:
                    return($"Day time is ending {location}.");

                case TickerState.Disabling:
                    return($"Day time is ending {location} soon.");

                case TickerState.Enabling:
                    return($"Day time is starting {location} soon.");

                default:
                    return(null);
                }

            case CyclicBroadcastType.OnlyDisabled:
                switch (state)
                {
                case TickerState.Enabled:
                    return($"Night time is ending {location}.");

                case TickerState.Disabled:
                    return($"Night time is starting {location}.");

                case TickerState.Disabling:
                    return($"Night time is starting {location} soon.");

                case TickerState.Enabling:
                    return($"Night time is ending {location} soon.");

                default:
                    return(null);
                }

            default:
                return(null);
            }
        }