示例#1
0
 private void OpenAnimalDoors(object sender, StardewModdingAPI.Events.TimeChangedEventArgs timeOfDayChanged)
 {
     if (timeOfDayChanged.NewTime >= ModConfig.Instance.AnimalDoorOpenTime && timeOfDayChanged.NewTime < ModConfig.Instance.AnimalDoorCloseTime)
     {
         Helper.Events.GameLoop.TimeChanged -= this.OpenAnimalDoors;
         SetAllAnimalDoorsState(Buildings.AnimalDoorState.OPEN);
     }
 }
示例#2
0
        private void CloseAnimalDoors(object sender, StardewModdingAPI.Events.TimeChangedEventArgs timeOfDayChanged)
        {
            if (timeOfDayChanged.NewTime >= ModConfig.Instance.AnimalDoorCloseTime)
            {
                List <Buildings.AnimalBuilding> eligibleAnimalBuildings = this.EligibleAnimalBuildings;
                foreach (Buildings.AnimalBuilding animalBuilding in eligibleAnimalBuildings)
                {
                    if (!animalBuilding.AreAllAnimalsHome())
                    {
                        return;
                    }
                }

                SetAllAnimalDoorsState(Buildings.AnimalDoorState.CLOSED);
                Helper.Events.GameLoop.TimeChanged -= this.CloseAnimalDoors;
            }
        }