Esempio n. 1
0
        public static void StoreChanges(ShowStage stage, Logger log)
        {
            try
            {
                if ((stage.mSimThatSetupStage == null) && (stage.mPerformingSim == null))
                {
                    List <Slot> remove = new List <Slot>();

                    foreach (KeyValuePair <Slot, ObjectWithOrientation> pair in stage.mVenueStageLayout)
                    {
                        if (pair.Value == null)
                        {
                            continue;
                        }

                        if (pair.Value.mGameObject == null)
                        {
                            remove.Add(pair.Key);
                        }
                        else if (pair.Value.mGameObject.Proxy == null)
                        {
                            remove.Add(pair.Key);
                        }
                    }

                    foreach (Slot slot in remove)
                    {
                        stage.mVenueStageLayout.Remove(slot);
                    }

                    stage.LoadStage();
                    stage.mVenueStageLayout.Clear();
                    stage.SaveStage(stage.mVenueStageLayout);

                    if (log != null)
                    {
                        log(" Stored Stage Changes");
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception(stage, e);
            }
        }
Esempio n. 2
0
        public static void SetupSimFest(ShowStage ths)
        {
            Common.StringBuilder msg = new Common.StringBuilder("SetupSimFest");

            try
            {
                if ((ths.OwnerProprietor == null) || (ths.OwnerProprietor.HasBeenDestroyed))
                {
                    if (ths.CurrentRole == null)
                    {
                        return;
                    }

                    ths.OwnerProprietor = ths.CurrentRole.SimInRole;
                    if ((ths.OwnerProprietor == null) || (ths.OwnerProprietor.HasBeenDestroyed))
                    {
                        return;
                    }
                }

                CommonSpace.Helpers.ShowStageEx.Cleanup(ths, null);

                msg += "C";

                List <Sim> list = new List <Sim>();
                foreach (Sim sim in LotManager.Actors)
                {
                    if (ths.BasicNPCPerformerTest(sim))
                    {
                        list.Add(sim);
                    }
                }

                ths.LoadStage();
                PerformanceCareer.PerformanceAudiencePosture standing = PerformanceCareer.PerformanceAudiencePosture.Standing;
                ths.PreShowSetup();
                foreach (IShowFloor floor in ths.LotCurrent.GetObjects <IShowFloor>())
                {
                    floor.ResetShowFloor();
                    switch (standing)
                    {
                    case PerformanceCareer.PerformanceAudiencePosture.Standing:
                        floor.SetupShowFloorWithStandingLocations();
                        break;

                    case PerformanceCareer.PerformanceAudiencePosture.Sitting:
                        floor.SetupShowFloorWithSittingLocations();
                        break;
                    }
                }

                msg += "A";

                foreach (ICrowdMonster monster in ths.LotCurrent.GetObjects <ICrowdMonster>())
                {
                    switch (standing)
                    {
                    case PerformanceCareer.PerformanceAudiencePosture.Standing:
                        monster.CreateStandingCrowdMonster();
                        break;

                    case PerformanceCareer.PerformanceAudiencePosture.Sitting:
                        monster.CreateSittingCrowdMonster();
                        break;
                    }
                }

                msg += "B";

                ths.mDoesPerformanceAllowDancing = false;
                ths.Controller.PostEvent(ShowEventType.kShowSetup);
                string titleText = ShowStage.LocalizeString(ths.OwnerProprietor.IsFemale, "AnnounceSimFestStart", new object[] { ths.LotCurrent.Name });
                StyledNotification.Format format = new StyledNotification.Format(titleText, ths.OwnerProprietor.ObjectId, StyledNotification.NotificationStyle.kSystemMessage);
                StyledNotification.Show(format);
                ths.AddSimFestMapTags();

                msg += "D";

                bool addedAlarm = false;
                for (int i = 0x0; i < 0x3; i++)
                {
                    // Custom
                    Sim item = CreateAnNPCPerformer(ths);
                    if (item != null)
                    {
                        list.Add(item);
                        if (item.WasCreatedByAService && !addedAlarm)
                        {
                            addedAlarm = true;
                            new Common.AlarmTask(9, TimeUnit.Hours, HibernateServiceSims);
                        }
                    }
                }

                msg += "E";

                foreach (Sim sim3 in list)
                {
                    if (sim3 != null)
                    {
                        ths.PushWatchTheShowOntoSim(sim3);
                    }
                }

                msg += "F";

                int audienceSize = ths.GetSimFestDesiredAudienceSize() - list.Count;
                if (audienceSize > 0x0)
                {
                    ths.PullAudienceToLot(audienceSize);
                }

                msg += "G";

                ths.mSimFestStartAlarm = ths.AddAlarmRepeating(10f, TimeUnit.Minutes, ths.SimFestWaitForPerformers, "SimFestWaitForPerformers", AlarmType.AlwaysPersisted);
                ShowStage.SimFestWait entry = ShowStage.SimFestWait.Singleton.CreateInstance(ths, ths.OwnerProprietor, new InteractionPriority(InteractionPriorityLevel.RequiredNPCBehavior), ths.OwnerProprietor.IsNPC, false) as ShowStage.SimFestWait;

                msg += "H";

                entry.mAction = ShowStage.SimFestWait.SimFestWaitAction.WaitForPerformers;
                ths.OwnerProprietor.InteractionQueue.AddNext(entry);

                Common.DebugWriteLog(msg);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(msg, e);
            }
        }
Esempio n. 3
0
        public static void StoreChanges(ShowStage stage, Logger log)
        {
            try
            {
                if ((stage.mSimThatSetupStage == null) && (stage.mPerformingSim == null))
                {
                    List<Slot> remove = new List<Slot>();

                    foreach (KeyValuePair<Slot, ObjectWithOrientation> pair in stage.mVenueStageLayout)
                    {
                        if (pair.Value == null) continue;

                        if (pair.Value.mGameObject == null)
                        {
                            remove.Add(pair.Key);
                        }
                        else if (pair.Value.mGameObject.Proxy == null)
                        {
                            remove.Add(pair.Key);
                        }
                    }

                    foreach (Slot slot in remove)
                    {
                        stage.mVenueStageLayout.Remove(slot);
                    }

                    stage.LoadStage();
                    stage.mVenueStageLayout.Clear();
                    stage.SaveStage(stage.mVenueStageLayout);

                    if (log != null)
                    {
                        log(" Stored Stage Changes");
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception(stage, e);
            }
        }
Esempio n. 4
0
        public static void SetupSimFest(ShowStage ths)
        {
            Common.StringBuilder msg = new Common.StringBuilder("SetupSimFest");

            try
            {
                if ((ths.OwnerProprietor == null) || (ths.OwnerProprietor.HasBeenDestroyed))
                {
                    if (ths.CurrentRole == null) return;

                    ths.OwnerProprietor = ths.CurrentRole.SimInRole;
                    if ((ths.OwnerProprietor == null) || (ths.OwnerProprietor.HasBeenDestroyed))
                    {
                        return;
                    }
                }               

                CommonSpace.Helpers.ShowStageEx.Cleanup(ths, null);

                msg += "C";

                List<Sim> list = new List<Sim>();
                foreach (Sim sim in LotManager.Actors)
                {
                    if (ths.BasicNPCPerformerTest(sim))
                    {
                        list.Add(sim);
                    }
                }

                ths.LoadStage();
                PerformanceCareer.PerformanceAudiencePosture standing = PerformanceCareer.PerformanceAudiencePosture.Standing;
                ths.PreShowSetup();
                foreach (IShowFloor floor in ths.LotCurrent.GetObjects<IShowFloor>())
                {
                    floor.ResetShowFloor();
                    switch (standing)
                    {
                        case PerformanceCareer.PerformanceAudiencePosture.Standing:
                            floor.SetupShowFloorWithStandingLocations();
                            break;

                        case PerformanceCareer.PerformanceAudiencePosture.Sitting:
                            floor.SetupShowFloorWithSittingLocations();
                            break;
                    }
                }

                msg += "A";

                foreach (ICrowdMonster monster in ths.LotCurrent.GetObjects<ICrowdMonster>())
                {
                    switch (standing)
                    {
                        case PerformanceCareer.PerformanceAudiencePosture.Standing:
                            monster.CreateStandingCrowdMonster();
                            break;

                        case PerformanceCareer.PerformanceAudiencePosture.Sitting:
                            monster.CreateSittingCrowdMonster();
                            break;
                    }
                }

                msg += "B";

                ths.mDoesPerformanceAllowDancing = false;
                ths.Controller.PostEvent(ShowEventType.kShowSetup);
                string titleText = ShowStage.LocalizeString(ths.OwnerProprietor.IsFemale, "AnnounceSimFestStart", new object[] { ths.LotCurrent.Name });
                StyledNotification.Format format = new StyledNotification.Format(titleText, ths.OwnerProprietor.ObjectId, StyledNotification.NotificationStyle.kSystemMessage);
                StyledNotification.Show(format);
                ths.AddSimFestMapTags();

                msg += "D";

                bool addedAlarm = false;
                for (int i = 0x0; i < 0x3; i++)
                {
                    // Custom
                    Sim item = CreateAnNPCPerformer(ths);
                    if (item != null)
                    {
                        list.Add(item);
                        if (item.WasCreatedByAService && !addedAlarm)
                        {                            
                            addedAlarm = true;
                            new Common.AlarmTask(9, TimeUnit.Hours, HibernateServiceSims);
                        }
                    }                    
                }

                msg += "E";

                foreach (Sim sim3 in list)
                {
                    if (sim3 != null)
                    {                        
                        ths.PushWatchTheShowOntoSim(sim3);
                    }
                }

                msg += "F";

                int audienceSize = ths.GetSimFestDesiredAudienceSize() - list.Count;
                if (audienceSize > 0x0)
                {                    
                    ths.PullAudienceToLot(audienceSize);
                }

                msg += "G";

                ths.mSimFestStartAlarm = ths.AddAlarmRepeating(10f, TimeUnit.Minutes, ths.SimFestWaitForPerformers, "SimFestWaitForPerformers", AlarmType.AlwaysPersisted);
                ShowStage.SimFestWait entry = ShowStage.SimFestWait.Singleton.CreateInstance(ths, ths.OwnerProprietor, new InteractionPriority(InteractionPriorityLevel.RequiredNPCBehavior), ths.OwnerProprietor.IsNPC, false) as ShowStage.SimFestWait;

                msg += "H";                

                entry.mAction = ShowStage.SimFestWait.SimFestWaitAction.WaitForPerformers;
                ths.OwnerProprietor.InteractionQueue.AddNext(entry);

                Common.DebugWriteLog(msg);                
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(msg, e);
            }
        }