Ejemplo n.º 1
0
        /// <summary>
        /// Start up things when the game is loaded or a new controller is added
        /// </summary>
        public void StartUpOrSwitch()
        {
            try
            {
                //Only do this part for the active family
                if (this.LotCurrent.Household != null && this.LotCurrent.Household.IsActive)
                {
                    // List<Abstracts.Door> doors = ApartmentController.ReturnLockedDoors(this);

                    //set the active households rent
                    ApartmentFamily activeFamily = this.Families.Find(
                        delegate(ApartmentFamily f) { return(f.IsActive == true); });
                    if (activeFamily != null)
                    {
                        if (firstLoad)
                        {
                            firstLoad = false;

                            if (ControllerSettings.alwaysDisableRoommateService)
                            {
                                //Event Hanlders
                                World.OnAddLotPostLoadCallback += new System.EventHandler(World_OnWorldQuitEventHandler);

                                ApartmentController.StopAcceptingRoommates();
                            }
                            //  ApartmentController.LoadActiveHousehold(activeFamily, this);
                        }
                    }
                }

                //Handle rent payment
                DaysOfTheWeek   daysOfTheWeek = DaysOfTheWeek.None;
                DaysOfTheWeek[] array         = Mailbox.kBillingDaysOfWeek;
                for (int i = 0; i < array.Length; i++)
                {
                    DaysOfTheWeek daysOfTheWeek2 = array[i];
                    daysOfTheWeek |= daysOfTheWeek2;
                }

                if (this.mBills == AlarmHandle.kInvalidHandle)
                {
                    this.mBills = AlarmManager.Global.AddAlarmDay(ControllerSettings.timeOfRent, ControllerSettings.rentDay, new AlarmTimerCallback(RentAlarm), "anisBillAndRentAlarm", AlarmType.NeverPersisted, null);
                }
            }
            catch (System.Exception ex)
            {
                CommonMethods.PrintMessage("bill handling: " + ex.Message);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// World quitting, remove listeners
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void World_OnWorldQuitEventHandler(object sender, System.EventArgs e)
 {
     ApartmentController.StopAcceptingRoommates();
 }
Ejemplo n.º 3
0
        public override bool Run()
        {
            ApartmentController.StopAcceptingRoommates();

            return(true);
        }