예제 #1
0
        static void Main(string[] args)
        {
            SeasonEnum season = SeasonEnum.Autumn;

            Console.WriteLine($"Now the season is {season}");

            if (season == SeasonEnum.Winter)
            {
                Console.WriteLine("it must be cold");
            }
            else
            {
                Console.WriteLine("I guess, it's not that cold");
            }

            //from int to enum
            int        userInput   = 2;
            SeasonEnum seasonTest1 = (SeasonEnum)userInput;

            Console.WriteLine($"Test1 season is {seasonTest1}");

            //from enum to int
            SeasonEnum seasonTest2 = SeasonEnum.Winter;
            int        userTest2   = (int)seasonTest2;

            Console.WriteLine($"The numeration for {seasonTest2} is {userTest2}");
        }
 /// <summary>
 /// Get player stats summaries. One summary is returned per queue type.
 /// </summary>
 public static async Task<IEnumerable<IPlayerStatsSummary>> GetPlayerStatsSummariesAsync(
     this IRoster roster,
     SeasonEnum? season = null,
     RegionEnum? region = null)
 {
     return await GetPlayerStatsSummariesAsync(roster, roster.OwnerId, season, region);
 }
 /// <summary>
 /// Get player stats summaries. One summary is returned per queue type.
 /// </summary>
 public static async Task<IEnumerable<IPlayerStatsSummary>> GetPlayerStatsSummariesAsync(
     this IHasSummonerId summoner,
     SeasonEnum? season = null,
     RegionEnum? region = null)
 {
     return await GetPlayerStatsSummariesAsync(summoner, summoner.SummonerId, season, region);
 }
 /// <summary>
 /// Get ranked stats. Includes statistics for Twisted Treeline and Summoner's Rift.
 /// </summary>
 public static async Task<IRankedStats> GetRankedStatsSummariesAsync(
     this IRoster roster,
     SeasonEnum? season = null,
     RegionEnum? region = null)
 {
     return await GetRankedStatsSummariesAsync(roster, roster.OwnerId, season, region);
 }
 /// <summary>
 /// Get ranked stats. Includes statistics for Twisted Treeline and Summoner's Rift.
 /// </summary>
 public static async Task<IRankedStats> GetRankedStatsSummariesAsync(
     this IHasSummonerId summoner,
     SeasonEnum? season = null,
     RegionEnum? region = null)
 {
     return await GetRankedStatsSummariesAsync(summoner, summoner.SummonerId, season, region);
 }
예제 #6
0
        public static Texture2D GetSeasonTexture(Texture2D seasonTexture, Texture2D T)
        {
            if (_bufferSeason != CurrentSeason)
            {
                _bufferSeason = CurrentSeason;
                _seasonTextureBuffer.Clear();
            }

            if ((T == null) == false)
            {
                if (_seasonTextureBuffer.ContainsKey(T))
                {
                    return(_seasonTextureBuffer[T]);
                }

                int x = 0;
                int y = 0;
                switch (CurrentSeason)
                {
                case SeasonEnum.Winter:
                    x = 0;
                    y = 0;
                    break;

                case SeasonEnum.Spring:
                    x = 2;
                    y = 0;
                    break;

                case SeasonEnum.Summer:
                    x = 0;
                    y = 2;
                    break;

                case SeasonEnum.Fall:
                    x = 2;
                    y = 2;
                    break;
                }

                Color[] inputColors = new []
                {
                    new Color(0, 0, 0),
                    new Color(85, 85, 85),
                    new Color(170, 170, 170),
                    new Color(255, 255, 255)
                }.Reverse().ToArray();
                List <Color> outputColors = new List <Color>();

                Color[] data = new Color[4];
                seasonTexture.GetData(0, new Rectangle(x, y, 2, 2), data, 0, 4);

                _seasonTextureBuffer.Add(T, T.ReplaceColors(inputColors, data));
                return(_seasonTextureBuffer[T]);
            }
            return(null);
        }
예제 #7
0
 public PriceCalculator(string[] input)
 {
     price    = decimal.Parse(input[0]);
     nights   = int.Parse(input[1]);
     season   = Enum.Parse <SeasonEnum>(input[2]);
     discount = DiscountEnum.None;
     if (input.Length == 4)
     {
         discount = Enum.Parse <DiscountEnum>(input[3]);
     }
 }
        private static async Task<IEnumerable<IPlayerStatsSummary>> GetPlayerStatsSummariesAsync(
            IApiModel leagueModel,
            long summonerId,
            SeasonEnum? season = null,
            RegionEnum? region = null)
        {
            if (leagueModel == null) throw new ArgumentNullException("leagueModel");

            var statsService = new StatsService(leagueModel.ApiConfiguration);
            return await statsService.GetPlayerStatsSummariesBySummonerIdAsync(summonerId, season, region);
        }
예제 #9
0
        /// <summary>
        /// Get ranked stats. Includes statistics for Twisted Treeline and Summoner's Rift.
        /// </summary>
        public async Task<IRankedStats> GetRankedStatsSummariesBySummonerIdAsync(
            long summonerId,
            SeasonEnum? season = null,
            RegionEnum? region = null)
        {
            var url = string.Format("by-summoner/{0}/ranked",
                summonerId);

            if (season.HasValue)
                url += string.Concat("?season=", season.ToString().ToUpper());

            return await GetResponseAsync<RankedStatsDto, IRankedStats>(region, url);
        }
예제 #10
0
    public PriceCalculator(string input)
    {
        string[] tokens = input.Split().ToArray();

        pricePerDay  = decimal.Parse(tokens[0]);
        numberOfDays = int.Parse(tokens[1]);
        season       = Enum.Parse <SeasonEnum>(tokens[2]);
        discountType = DiscountEnum.None;
        if (tokens.Length > 3)
        {
            discountType = Enum.Parse <DiscountEnum>(tokens[3]);
        }
    }
예제 #11
0
        /// <summary>
        /// Get player stats summaries. One summary is returned per queue type.
        /// </summary>
        public async Task<IEnumerable<IPlayerStatsSummary>> GetPlayerStatsSummariesBySummonerIdAsync(
            long summonerId,
            SeasonEnum? season = null,
            RegionEnum? region = null)
        {
            var url = string.Format("by-summoner/{0}/summary",
                summonerId);

            if (season.HasValue)
                url += string.Concat("?season=", season.ToString().ToUpper());

            return await GetResponseAsync<PlayerStatsSummaryListDto, IEnumerable<IPlayerStatsSummary>>(region, url);
        }
 public static string getSeasonName(SeasonEnum season)
 {
     if (season == SeasonEnum.Spring)
     {
         return("第1季");
     }
     else if (season == SeasonEnum.Summer)
     {
         return("第2季");
     }
     else if (season == SeasonEnum.Autumn)
     {
         return("第3季");
     }
     else // (season == SeasonEnum.Winter)
     {
         return("第4季");
     }
 }
예제 #13
0
파일: Program.cs 프로젝트: StasoStas/Course
        // Ex_1
        //static void Main(string[] args)
        //{
        //    GetFullName("Stanislav", "Staso", "Makaev");
        //    GetFullName("Tania", "Staso", "Banditov");
        //    GetFullName("Yura", "Staso", "Valeriev");
        //    GetFullName("Vlad", "Staso", "Krytoj");
        //}

        //static string GetFullName(string firstName, string lastName, string patronymic)
        //{

        //    string fullName = firstName + " " + lastName + " " + patronymic;

        //    Console.WriteLine(fullName);

        //    return fullName;
        //}


        ///////////////
        //static void Main(string[] args)
        //{
        //    int totalSum;

        //    Console.Write("Введите любое кол-во целых чисел через пробел: ");
        //    string numbersString = Console.ReadLine();

        //    totalSum = SumFromString(numbersString);
        //    Console.WriteLine($"Сумма всех ввденных чисел: {totalSum}");

        //    Console.ReadLine();
        //}

        ///// <summary>
        ///// Метод разделяет строку чисел на массив подстрок и после конвертации складывает их
        ///// </summary>
        ///// <param name="str">Строка чисел разделенных пробелом</param>
        ///// <returns></returns>
        //static int SumFromString(string str)
        //{
        //    int sum = 0;
        //    string[] strNumbers = str.Split(new char[] { ' ' });

        //    for (int i = 0; i < strNumbers.Length; i++)
        //    {
        //        sum += Convert.ToInt32(strNumbers[i]);
        //    }
        //    return sum;
        //}


        ////////////////////


        static void Main(string[] args)
        {
            SeasonEnum season    = SeasonEnum.Error;
            string     seasonRus = String.Empty;

            do
            {
                Console.Clear();
                if (season == SeasonEnum.Error)
                {
                    Console.WriteLine(seasonRus);
                }
                Console.Write("Введите порядковый номер текущего месяца: ");
                int monthNumber = Convert.ToInt32(Console.ReadLine());

                (season, seasonRus) = GetSeason(monthNumber);
            } while (season == SeasonEnum.Error);

            Console.WriteLine($"На дворе {seasonRus}");

            Console.ReadLine();
        }
예제 #14
0
파일: Program.cs 프로젝트: StasoStas/Course
        /// <summary>
        /// Метод - два в одном
        /// </summary>
        /// <param name="month">Порядковый номер месяца</param>
        /// <returns>season - значение из перечисления, msg - время года</returns>
        static (SeasonEnum, string) GetSeason(int month)
        {
            SeasonEnum season = SeasonEnum.Error;
            string     msg    = "Ошибка: введите число от 1 до 12";

            switch (month)
            {
            case 1:
            case 2:
            case 12:
                season = SeasonEnum.Winter;
                msg    = "Зима";
                return(season, msg);

            case 3:
            case 4:
            case 5:
                season = SeasonEnum.Spring;
                msg    = "Весна";
                return(season, msg);

            case 6:
            case 7:
            case 8:
                season = SeasonEnum.Summer;
                msg    = "Лето";
                return(season, msg);

            case 9:
            case 10:
            case 11:
                season = SeasonEnum.Autumn;
                msg    = "Осень";
                return(season, msg);
            }
            return(season, msg);
        }
예제 #15
0
        public double [] KansasCityTempData(SeasonEnum season)
        {
            // returns year or Average Mean Temperature for the seasons from
            // 1889 to 2004 for the specified Season in Kansas City, Mo., USA
            //
            // http://www.crh.noaa.gov/eax/climo/winyear.htm
            double [] Winter = new double[]
            {
                37.0, 34.0, 33.9, 25.2, 30.9, 29.0, 33.3, 33.5, 31.8, 26.1,
                30.2, 32.6, 27.7, 29.8, 29.2, 25.1, 34.0, 33.4, 35.0, 34.6,
                27.0, 33.6, 26.8, 31.8, 33.9, 30.1, 30.8, 32.1, 24.6, 36.0,
                29.7, 37.9, 33.0, 34.8, 33.0, 30.9, 34.2, 34.1, 32.9, 27.3,
                32.8, 38.4, 39.0, 34.9, 36.1, 33.3, 24.6, 31.0, 33.6, 34.8,
                28.2, 33.8, 34.6, 32.4, 34.0, 31.1, 33.2, 33.8, 31.1, 31.3,
                34.3, 32.0, 34.5, 36.1, 36.6, 33.7, 31.3, 33.6, 33.0, 30.8,
                33.3, 33.6, 28.8, 28.1, 32.8, 32.0, 35.2, 34.1, 32.0, 30.0,
                31.8, 32.7, 32.4, 29.4, 29.5, 30.0, 34.6, 26.2, 22.0, 21.5,
                29.8, 31.9, 25.0, 33.7, 25.4, 26.5, 29.2, 34.3, 29.9, 32.2,
                31.6, 30.2, 37.2, 29.1, 29.9, 33.4, 29.4, 29.1, 36.0, 34.3,
                36.0, 26.1, 36.2, 31.4, 31.4, 33.7,
            };

            // http://www.crh.noaa.gov/eax/climo/spryear.htm
            double [] Spring = new double[]
            {
                54.7, 52.9, 50.5, 49.9, 51.8, 56.7, 55.7, 56.4, 53.8, 54.3,
                52.1, 55.1, 53.3, 56.1, 55.2, 52.0, 56.9, 52.8, 53.0, 56.0,
                52.7, 58.0, 56.4, 52.0, 54.1, 55.1, 53.0, 54.6, 51.7, 56.5,
                54.2, 52.2, 57.9, 55.9, 52.2, 51.1, 56.2, 54.2, 55.6, 55.6,
                55.5, 55.6, 52.2, 53.7, 54.9, 56.8, 54.4, 58.1, 53.7, 57.9,
                56.7, 53.4, 56.7, 56.5, 52.9, 53.1, 55.6, 59.4, 51.1, 55.6,
                55.6, 52.7, 52.2, 53.3, 53.8, 54.6, 58.1, 56.2, 54.7, 53.8,
                57.2, 51.3, 51.5, 56.5, 58.6, 56.4, 54.7, 55.6, 55.9, 56.0,
                53.3, 57.2, 55.9, 57.2, 53.7, 56.2, 52.1, 53.7, 58.9, 51.7,
                52.4, 52.4, 55.5, 53.0, 49.7, 48.9, 57.0, 56.9, 58.2, 55.6,
                54.6, 52.9, 57.2, 54.2, 51.2, 54.8, 52.3, 51.6, 51.3, 54.8,
                53.5, 56.5, 55.5, 52.9, 54.7, 57.3,
            };

            // http://www.crh.noaa.gov/eax/climo/sumyear.htm
            double [] Summer = new double[]
            {
                74.0, 77.1, 72.5, 75.5, 74.5, 76.7, 74.2, 75.8, 76.9, 76.8,
                76.7, 77.1, 81.9, 74.8, 74.2, 73.5, 76.2, 75.5, 75.8, 74.4,
                77.3, 75.3, 79.4, 75.7, 80.9, 79.1, 71.6, 77.7, 75.5, 80.8,
                77.9, 74.7, 78.4, 77.6, 76.9, 75.1, 77.6, 76.9, 73.0, 74.7,
                76.5, 78.9, 79.1, 79.1, 79.6, 84.9, 79.6, 84.4, 80.4, 79.9,
                79.3, 77.5, 78.2, 77.5, 79.7, 77.4, 75.4, 78.2, 79.6, 77.9,
                78.3, 72.8, 75.1, 80.4, 81.3, 82.6, 79.3, 80.0, 79.9, 76.8,
                79.1, 77.5, 75.0, 77.3, 80.0, 77.4, 76.6, 77.2, 74.8, 78.3,
                76.9, 79.3, 78.0, 77.1, 76.1, 74.9, 78.3, 76.0, 76.2, 76.8,
                74.6, 80.3, 75.0, 74.5, 78.7, 76.5, 72.7, 76.1, 77.5, 80.2,
                74.8, 76.6, 78.1, 71.6, 76.2, 75.7, 76.6, 74.6, 75.1, 76.1,
                76.3, 76.6, 76.7, 78.7, 77.8, 72.7,
            };

            // http://www.crh.noaa.gov/eax/climo/falyear.htm
            double [] Fall = new double[]
            {
                53.2, 55.3, 55.8, 56.5, 57.1, 56.9, 55.8, 53.4, 61.6, 55.0,
                61.0, 59.0, 58.5, 58.0, 55.5, 59.6, 57.7, 56.9, 56.7, 57.9,
                59.3, 58.0, 55.9, 58.2, 58.4, 60.2, 60.6, 57.3, 55.5, 57.0,
                56.7, 58.2, 59.4, 60.1, 56.6, 58.5, 55.4, 55.3, 59.8, 57.6,
                55.1, 58.7, 63.5, 55.0, 60.3, 59.0, 55.9, 57.7, 56.3, 61.4,
                60.9, 58.8, 59.7, 57.9, 54.9, 59.5, 57.8, 59.4, 60.6, 58.7,
                58.3, 57.9, 54.4, 57.3, 61.6, 61.5, 57.9, 61.5, 55.5, 61.0,
                55.1, 60.6, 56.3, 58.3, 65.4, 58.9, 59.5, 59.2, 57.0, 56.8,
                57.8, 58.2, 61.2, 54.7, 57.6, 54.1, 56.1, 51.9, 55.6, 58.1,
                55.7, 56.0, 56.4, 55.0, 57.5, 55.6, 53.4, 55.5, 55.4, 55.8,
                54.5, 59.7, 54.4, 53.9, 51.9, 57.1, 54.1, 52.7, 55.9, 59.6,
                58.2, 55.7, 57.6, 55.0, 55.0, 58.2,
            };

            double [] seasonData = null;
            switch (season)
            {
            case SeasonEnum.Years:
            {
                // returns an array of the years for which temperature
                // data are available.
                int i = 0, j = 0;
                seasonData = (double[])Array.CreateInstance(typeof(double), 2004 - 1889 + 1);
                for (i = 1889; i <= 2004; i++)
                {
                    seasonData[j] = i;
                    j++;
                }
            }
            break;

            case SeasonEnum.Winter:
                // returns Winter Average Mean Temperatures
                seasonData = Winter;
                break;

            case SeasonEnum.Spring:
                // returns Spring Average Mean Temperatures
                seasonData = Spring;
                break;

            case SeasonEnum.Summer:
                // returns Summer Average Mean Temperatures
                seasonData = Summer;
                break;

            case SeasonEnum.Fall:
                seasonData = Fall;
                // returns Fall Average Mean Temperatures
                break;
            }
            return(seasonData);
        }
        static void Main(string[] args)
        {
            WeekdaysEnum weekday = WeekdaysEnum.Sat;

            //Create a program which will tell us to work on workdays and relax on weekdays
            switch (weekday)
            {
            case WeekdaysEnum.Mon:
            case WeekdaysEnum.Tue:
            case WeekdaysEnum.Wed:
            case WeekdaysEnum.Thu:
            case WeekdaysEnum.Fri:
                //this code will work for all of the work days
                Console.WriteLine("WORK");
                break;

            case WeekdaysEnum.Sat:
            case WeekdaysEnum.Sun:
                //this code will work for all of the weekend days
                Console.WriteLine("RELAX");
                break;

            default:
                break;
            }

            //switch (weekday)
            //{
            //    case WeekdaysEnum.Mon:
            //        Console.WriteLine("Hard work");
            //        break;
            //    case WeekdaysEnum.Tue:
            //        Console.WriteLine("Lazy work");
            //        break;
            //    case WeekdaysEnum.Wed:
            //        break;
            //    case WeekdaysEnum.Thu:
            //        break;
            //    case WeekdaysEnum.Fri:
            //        Console.WriteLine("Finally party day");
            //        break;
            //    case WeekdaysEnum.Sat:
            //        Console.WriteLine("Sleeping till dawn");
            //        break;
            //    case WeekdaysEnum.Sun:
            //        break;
            //    default:
            //        break;
            //}

            int        seasonNr       = 2; //user inputted
            SeasonEnum seasonFromUser = (SeasonEnum)seasonNr;

            Console.WriteLine(seasonFromUser);

            //SeasonEnum season = SeasonEnum.Summer;

            //if (season == SeasonEnum.Summer)
            //{
            //    Console.WriteLine("It should be hot!");
            //}
        }
예제 #17
0
        public static WeatherEnum GetRegionWeather(SeasonEnum season)
        {
            var r = Core.Random.Next(0, 100);

            switch (season)
            {
            case SeasonEnum.Winter:
                if (r < 20)
                {
                    return(WeatherEnum.Rain);
                }
                else if (r >= 20 && r < 50)
                {
                    return(WeatherEnum.Clear);
                }
                else
                {
                    return(WeatherEnum.Snow);
                }

            case SeasonEnum.Spring:
                if (r < 5)
                {
                    return(WeatherEnum.Snow);
                }
                else if (r >= 5 && r < 40)
                {
                    return(WeatherEnum.Rain);
                }
                else
                {
                    return(WeatherEnum.Clear);
                }

            case SeasonEnum.Summer:
                if (r < 10)
                {
                    return(WeatherEnum.Rain);
                }
                else
                {
                    return(WeatherEnum.Clear);
                }

            case SeasonEnum.Fall:
                if (r < 5)
                {
                    return(WeatherEnum.Snow);
                }
                else if (r >= 5 && r < 80)
                {
                    return(WeatherEnum.Rain);
                }
                else
                {
                    return(WeatherEnum.Clear);
                }
            }

            return(WeatherEnum.Clear);
        }