Ejemplo n.º 1
0
            private void InviteGuestsIfHostAtHomeEx()
            {
                try
                {
                    bool failure = false;

                    if ((!Common.kDebugging) && (!IsAnyHostAtHome()))
                    {
                        failure = true;
                    }
                    else if (!InviteGuestsEx())
                    {
                        failure = true;
                    }

                    if ((failure) && (SimClock.HoursPassedOfDay < 23f))
                    {
                        mAlarmRetryInviteGuests = AlarmManager.AddAlarm(ForeignVisitorsSituation.kRetryInviteGuestsNoHostsHomeFrequency, TimeUnit.Minutes, InviteGuestsIfHostAtHomeEx, "Retry invite foreign visitors", AlarmType.AlwaysPersisted, Parent.Host);
                        AlarmManager.AlarmWillYield(mAlarmRetryInviteGuests);
                    }
                    else
                    {
                        Parent.SetState(new FailedToStart(Parent));
                    }
                }
                catch (Exception e)
                {
                    Common.Exception("InviteGuestsIfHostAtHomeEx", e);
                }
            }
Ejemplo n.º 2
0
            public override void Init(ForeignVisitorsSituation parent)
            {
                try
                {
                    if (parent.Host.IsSelectable)
                    {
                        StyledNotification.Show(new StyledNotification.Format(Localization.LocalizeString("Gameplay/Situations/InviteForeignVisitors:GoPrepare", new object[] { parent.Host }), StyledNotification.NotificationStyle.kGameMessagePositive));
                    }

                    parent.Host.Motives.CreateMotive(parent.PreparationMotive());
                    parent.OnPreparation();

                    float time = SimClock.ElapsedTime(TimeUnit.Hours, SimClock.CurrentTime(), Parent.StartTime) - parent.GetParams().HoursBeforePartyToInvite;
                    if (time <= 0f)
                    {
                        Parent.SetState(new TryInviteEx(Parent));
                    }
                    else
                    {
                        mAlarmGuestInvite = AlarmManager.AddAlarm(time, TimeUnit.Hours, TimeToInviteGuestsEx, "Invite Guests To Foreign Visitors Situation", AlarmType.AlwaysPersisted, Parent.Host);
                        AlarmManager.AlarmWillYield(mAlarmGuestInvite);
                    }
                }
                catch (Exception e)
                {
                    Common.Exception("PrepareEx:Init", e);
                }
            }
Ejemplo n.º 3
0
 public override void Init(ForeignVisitorsSituation parent)
 {
     mAlarmRetryInviteGuests = AlarmManager.AddAlarm(0f, TimeUnit.Seconds, InviteGuestsIfHostAtHomeEx, "Invite foreign visitors", AlarmType.AlwaysPersisted, Parent.Host);
     AlarmManager.AlarmWillYield(mAlarmRetryInviteGuests);
 }