Пример #1
0
    static void Main(string[] args)
    {
        BirthdayInfo birth = new BirthdayInfo();

        birth.Name     = "아이유";
        birth.Birthday = new DateTime(1993, 6, 28);

        Console.WriteLine($"Name : {birth.Name}");
        Console.WriteLine($"Birthday : {birth.Birthday}");
        Console.WriteLine($"Age : {birth.Age}");
    }
 void ActivateBirthday(BirthdayInfo birthday)
 {
     currentBirthday = birthday;
     if (currentBirthday.type == spawnType.Plant || currentBirthday.type == spawnType.Effect)         //don't bother updating every minute if its a one time spawn thing
     {
         currentBirthday.toSpawn.SetActive(true);
     }
     if (currentBirthday.type == spawnType.Animal)
     {
         AnimationSpawner.instance.on = false;
         AnimationSpawner.instance.ClearAnimations();
         SceneManager.instance.OnNewMin += MakeAnimalSpawnAttempt;
         MakeAnimalSpawnAttempt();
     }
 }
Пример #3
0
        public async Task <bool> TryAddInfoAsync(ulong userId, string name, int birthDay, int birthMonth, int birthYear)
        {
            if (membersBirthdays.ContainsKey(userId))
            {
                return(false);
            }
            var info = new BirthdayInfo()
            {
                Name             = name,
                BirthDay         = birthDay,
                BirthMonth       = birthMonth,
                BirthYear        = birthYear,
                LastYearNotified = DateTime.Now.Year - 1
            };

            membersBirthdays.Add(userId, info);
            await SaveAsync();

            return(true);
        }
Пример #4
0
        private async void MainButtonClick(object sender)
        {
            bool Birthday = false;

            ShowLoader();
            await Task.Run(() =>
            {
                UpdateTextBoxes();
                Birthday = BirthdayInfo.IsBirthday(ChosenDate);
            });

            HideLoader();
            if (AgeInfo.Length == 0)
            {
                MessageBox.Show("Your entered date of birth is incorrect! The computed age can not be lower or qual to 0 and higher than 135 years old. Try again!");
            }
            else if (Birthday)
            {
                MessageBox.Show("Hey, it`s your birthday today! Congratulations!");
            }
        }
Пример #5
0
 private bool IsBirthdayToday(BirthdayInfo info, DateTime currentDate)
 {
     return(currentDate.Year != info.LastYearNotified &&
            currentDate.Day == info.BirthDay &&
            currentDate.Month == info.BirthMonth);
 }