public SandboxGameScreen() : base()
        {
            _stateChanges = new Queue <SimConnectStateChange>();

            Ucp = new UIUCP(this)
            {
                Y = ScreenHeight - 210
            };
            Ucp.SetInLot(false);
            Ucp.UpdateZoomButton();
            Ucp.MoneyText.Caption = "0";// PlayerAccount.Money.ToString();
            Add(Ucp);

            Title = new UIGameTitle();
            Title.SetTitle("");
            Add(Title);

            WindowContainer = new UIContainer();
            Add(WindowContainer);

            if (Content.GameContent.Get.TS1)
            {
                TS1NeighPanel = new UINeighborhoodSelectionPanel(4);
                TS1NeighPanel.OnHouseSelect += (house) =>
                {
                    ActiveFamily = Content.GameContent.Get.Neighborhood.GetFamilyForHouse((short)house);
                    InitializeLot(Path.Combine(Content.GameContent.Get.TS1BasePath, $"UserData/Houses/House{house.ToString().PadLeft(2, '0')}.iff"), false);// "UserData/Houses/House21.iff"
                    Remove(TS1NeighPanel);
                };
                Add(TS1NeighPanel);
            }
        }
Exemple #2
0
        public void CleanupLastWorld()
        {
            if (vm == null)
            {
                return;
            }

            //clear our cache too, if the setting lets us do that
            DiscordRpcEngine.SendFSOPresence(gizmo.CurrentAvatar.Value.Avatar_Name, null, 0, 0, 0, 0, gizmo.CurrentAvatar.Value.Avatar_PrivacyMode > 0);
            TimedReferenceController.Clear();
            TimedReferenceController.Clear();

            if (ZoomLevel < 4)
            {
                ZoomLevel = 5;
            }
            vm.Context.Ambience.Kill();
            foreach (var ent in vm.Entities)   //stop object sounds
            {
                var threads = ent.SoundThreads;
                for (int i = 0; i < threads.Count; i++)
                {
                    threads[i].Sound.RemoveOwner(ent.ObjectID);
                }
                threads.Clear();
            }
            vm.CloseNet(VMCloseNetReason.LeaveLot);
            Driver.OnClientCommand -= VMSendCommand;
            GameFacade.Scenes.Remove(World);
            World.Dispose();
            LotControl.Dispose();
            this.Remove(LotControl);
            ucp.SetPanel(-1);
            ucp.SetInLot(false);
            vm.SuppressBHAVChanges();
            vm         = null;
            World      = null;
            Driver     = null;
            LotControl = null;
            CityRenderer.DisposeOnLot();
        }
Exemple #3
0
        public void CleanupLastWorld()
        {
            if (vm == null)
            {
                return;
            }

            //clear our cache too, if the setting lets us do that
            TimedReferenceController.Clear();
            TimedReferenceController.Clear();
            VM.ClearAssembled();

            vm.Context.Ambience.Kill();
            foreach (var ent in vm.Entities)
            { //stop object sounds
                var threads = ent.SoundThreads;
                for (int i = 0; i < threads.Count; i++)
                {
                    threads[i].Sound.RemoveOwner(ent.ObjectID);
                }
                threads.Clear();
            }
            vm.CloseNet(VMCloseNetReason.LeaveLot);
            //Driver.OnClientCommand -= VMSendCommand;
            GameFacade.Scenes.Remove(World);
            World.Dispose();
            LotControl.Dispose();
            this.Remove(LotControl);
            ucp.SetPanel(-1);
            ucp.SetInLot(false);
            vm.SuppressBHAVChanges();
            vm         = null;
            World      = null;
            Driver     = null;
            LotControl = null;

            SandServer?.Shutdown();
            SandCli?.Disconnect();
            SandServer = null;
            SandCli    = null;
        }
 public void CleanupLastWorld()
 {
     if (ZoomLevel < 4)
     {
         ZoomLevel = 5;
     }
     vm.Context.Ambience.Kill();
     foreach (var ent in vm.Entities)   //stop object sounds
     {
         var threads = ent.SoundThreads;
         for (int i = 0; i < threads.Count; i++)
         {
             threads[i].Sound.RemoveOwner(ent.ObjectID);
         }
         threads.Clear();
     }
     vm.CloseNet(VMCloseNetReason.LeaveLot);
     GameFacade.Scenes.Remove(World);
     this.Remove(LotController);
     ucp.SetPanel(-1);
     ucp.SetInLot(false);
 }
        public LotDebugScreen()
        {
            var lotInfo = XmlHouseData.Parse(GameFacade.GameFilePath("housedata/blueprints/restaurant01_00.xml"));

            World = new World(GameFacade.Game.GraphicsDevice);
            GameFacade.Scenes.Add(World);

            vm = new TSO.Simantics.VM(new VMContext(World));
            vm.Init();

            var activator = new VMWorldActivator(vm, World);
            var blueprint = activator.LoadFromXML(lotInfo);

            World.InitBlueprint(blueprint);
            vm.Context.Blueprint = blueprint;

            var sim = activator.CreateAvatar();

            //sim.Position = new Vector3(31.5f, 55.5f, 0.0f);
            sim.Position = new Vector3(26.5f, 41.5f, 0.0f);

            VMDebug = new UIButton()
            {
                Caption = "Simantics",
                Y       = 45,
                Width   = 100,
                X       = GlobalSettings.Default.GraphicsWidth - 110
            };
            VMDebug.OnButtonClick += new ButtonClickDelegate(VMDebug_OnButtonClick);
            this.Add(VMDebug);

            LotController = new UILotControl(vm, World);
            this.AddAt(0, LotController);

            ucp   = new UIUCP(this);
            ucp.Y = ScreenHeight - 210;
            ucp.SetInLot(true);
            ucp.SetMode(UIUCP.UCPMode.LotMode);
            ucp.SelectedAvatar = sim;
            ucp.SetPanel(1);

            //ucp.ZoomLevel = 1;
            //ucp.OnZoomChanged += new UCPZoomChangeEvent(ucp_OnZoomChanged);
            //ucp.OnRotateChanged += new UCPRotateChangeEvent(ucp_OnRotateChanged);
            this.Add(ucp);
        }
Exemple #6
0
        public void InitTestLot()
        {
            var lotInfo = XmlHouseData.Parse(GameFacade.GameFilePath("housedata/blueprints/restaurant08_00.xml"));

            World = new World(GameFacade.Game.GraphicsDevice);
            GameFacade.Scenes.Add(World);

            vm = new TSO.Simantics.VM(new VMContext(World));
            vm.Init();

            var activator = new VMWorldActivator(vm, World);
            var blueprint = activator.LoadFromXML(lotInfo);

            World.InitBlueprint(blueprint);
            vm.Context.Blueprint = blueprint;

            var sim = activator.CreateAvatar();

            sim.Position = new Vector3(26.5f, 41.5f, 0.0f);

            var sim2 = activator.CreateAvatar();

            sim2.Position = new Vector3(27.5f, 41.5f, 0.0f);

            LotController = new UILotControl(vm, World);
            this.AddAt(0, LotController);

            vm.Context.Clock.Hours = 6;

            ucp.SelectedAvatar = sim;
            ucp.SetInLot(true);
            if (m_ZoomLevel > 3)
            {
                World.Visible = false;
            }
        }
Exemple #7
0
        public CoreGameScreen()
        {
            /** City Scene **/
            ListenForMouse(new Rectangle(0, 0, ScreenWidth, ScreenHeight), new UIMouseEvent(MouseHandler));

            CityRenderer = new Terrain(GameFacade.Game.GraphicsDevice); //The Terrain class implements the ThreeDAbstract interface so that it can be treated as a scene but manage its own drawing and updates.

            String city = "Queen Margaret's";

            if (PlayerAccount.CurrentlyActiveSim != null)
            {
                city = PlayerAccount.CurrentlyActiveSim.ResidingCity.Name;
            }

            CityRenderer.m_GraphicsDevice = GameFacade.GraphicsDevice;

            CityRenderer.Initialize(city, new CityDataRetriever());
            CityRenderer.RegenData = true;

            CityRenderer.LoadContent(GameFacade.GraphicsDevice);

            /**
             * Music
             */
            CityMusic = new string[] {
                GlobalSettings.Default.StartupPath + "\\music\\modes\\map\\tsobuild1.mp3",
                GlobalSettings.Default.StartupPath + "\\music\\modes\\map\\tsobuild3.mp3",
                GlobalSettings.Default.StartupPath + "\\music\\modes\\map\\tsomap2_v2.mp3",
                GlobalSettings.Default.StartupPath + "\\music\\modes\\map\\tsomap3.mp3",
                GlobalSettings.Default.StartupPath + "\\music\\modes\\map\\tsomap4_v1.mp3"
            };
            m_ZoomLevel = 5; //screen always starts at far zoom, city visible.
            PlayBackgroundMusic(CityMusic);

            VMDebug = new UIButton()
            {
                Caption = "Simantics",
                Y       = 45,
                Width   = 100,
                X       = GlobalSettings.Default.GraphicsWidth - 110
            };
            VMDebug.OnButtonClick += new ButtonClickDelegate(VMDebug_OnButtonClick);
            this.Add(VMDebug);

            ucp   = new UIUCP(this);
            ucp.Y = ScreenHeight - 210;
            ucp.SetInLot(false);
            ucp.UpdateZoomButton();
            this.Add(ucp);

            gizmo   = new UIGizmo();
            gizmo.X = ScreenWidth - 500;
            gizmo.Y = ScreenHeight - 300;
            this.Add(gizmo);

            Title = new UIGameTitle();
            Title.SetTitle(city);
            this.Add(Title);

            //OpenInbox();

            MessageUI = new UIMessageController();
            this.Add(MessageUI);

            MessageUI.PassMessage("Whats His Face", "you suck");
            MessageUI.PassMessage("Whats His Face", "no rly");
            MessageUI.PassMessage("Whats His Face", "jk im just testing message recieving please love me");

            MessageUI.PassMessage("Yer maw", "dont let whats his face get to you");
            MessageUI.PassMessage("Yer maw", "i will always love you");

            MessageUI.PassEmail("M.O.M.I", "Ban Notice", "You have been banned for playing too well. \r\n\r\nWe don't know why you still have access to the game, but it's probably related to you playing the game pretty well. \r\n\r\nPlease stop immediately.\r\n\r\n - M.O.M.I. (this is just a test message btw, you're not actually banned)");

            GameFacade.Scenes.Add((_3DAbstract)CityRenderer);
        }
Exemple #8
0
        public CoreGameScreen() : base()
        {
            StateChanges = new Queue <SimConnectStateChange>();

            /**
             * Music
             */
            HITVM.Get().PlaySoundEvent(UIMusic.Map);

            /*VMDebug = new UIButton()
             * {
             *  Caption = "Simantics",
             *  Y = 45,
             *  Width = 100,
             *  X = GlobalSettings.Default.GraphicsWidth - 110
             * };
             * VMDebug.OnButtonClick += new ButtonClickDelegate(VMDebug_OnButtonClick);
             * this.Add(VMDebug);*/

            /*SaveHouseButton = new UIButton()
             * {
             *  Caption = "Save House",
             *  Y = 10,
             *  Width = 100,
             *  X = GlobalSettings.Default.GraphicsWidth - 110
             * };
             * SaveHouseButton.OnButtonClick += new ButtonClickDelegate(SaveHouseButton_OnButtonClick);
             * this.Add(SaveHouseButton);*/

            ucp   = new UIUCP(this);
            ucp.Y = ScreenHeight - 210;
            ucp.SetInLot(false);
            ucp.UpdateZoomButton();
            ucp.MoneyText.Caption = "0";// PlayerAccount.Money.ToString();
            this.Add(ucp);

            gizmo = new UIGizmo();
            gizmo.BindController <GizmoController>();
            gizmo.X = ScreenWidth - 430;
            gizmo.Y = ScreenHeight - 230;
            this.Add(gizmo);

            Title = new UIGameTitle();
            Title.SetTitle("");
            this.Add(Title);

            this.Add(FSOFacade.MessageController);

            MessageTray   = new UIMessageTray();
            MessageTray.X = ScreenWidth - 70;
            MessageTray.Y = 12;
            this.Add(MessageTray);

            WindowContainer = new UIContainer();
            Add(WindowContainer);

            PersonPage         = new UIPersonPage();
            PersonPage.Visible = false;
            PersonPage.BindController <PersonPageController>();
            WindowContainer.Add(PersonPage);

            LotPage         = new UILotPage();
            LotPage.Visible = false;
            LotPage.BindController <LotPageController>();
            WindowContainer.Add(LotPage);

            Bookmarks         = new UIBookmarks();
            Bookmarks.Visible = false;
            Bookmarks.BindController <BookmarksController>();
            WindowContainer.Add(Bookmarks);

            Relationships         = new UIRelationshipDialog();
            Relationships.Visible = false;
            Relationships.BindController <RelationshipDialogController>();
            WindowContainer.Add(Relationships);
        }
        public CoreGameScreen()
        {
            /** City Scene **/
            ListenForMouse(new Rectangle(0, 0, ScreenWidth, ScreenHeight), new UIMouseEvent(MouseHandler));

            CityRenderer = new Terrain(GameFacade.Game.GraphicsDevice); //The Terrain class implements the ThreeDAbstract interface so that it can be treated as a scene but manage its own drawing and updates.

            city = "Queen Margaret's";
            if (PlayerAccount.CurrentlyActiveSim != null)
            {
                city = PlayerAccount.CurrentlyActiveSim.ResidingCity.Name;
            }

            CityRenderer.m_GraphicsDevice = GameFacade.GraphicsDevice;

            CityRenderer.Initialize(city, GameFacade.CDataRetriever);
            CityRenderer.LoadContent(GameFacade.GraphicsDevice);
            CityRenderer.RegenData = true;

            CityRenderer.SetTimeOfDay(0.5);
            StateChanges = new Queue <SimConnectStateChange>();

            /**
             * Music
             */
            CityMusic = new string[] {
                GlobalSettings.Default.StartupPath + "\\music\\modes\\map\\tsobuild1.mp3",
                GlobalSettings.Default.StartupPath + "\\music\\modes\\map\\tsobuild3.mp3",
                GlobalSettings.Default.StartupPath + "\\music\\modes\\map\\tsomap2_v2.mp3",
                GlobalSettings.Default.StartupPath + "\\music\\modes\\map\\tsomap3.mp3",
                GlobalSettings.Default.StartupPath + "\\music\\modes\\map\\tsomap4_v1.mp3"
            };
            HITVM.Get().PlaySoundEvent(UIMusic.Map);

            /*VMDebug = new UIButton()
             * {
             *  Caption = "Simantics",
             *  Y = 45,
             *  Width = 100,
             *  X = GlobalSettings.Default.GraphicsWidth - 110
             * };
             * VMDebug.OnButtonClick += new ButtonClickDelegate(VMDebug_OnButtonClick);
             * this.Add(VMDebug);*/

            SaveHouseButton = new UIButton()
            {
                Caption = "Save House",
                Y       = 10,
                Width   = 100,
                X       = GlobalSettings.Default.GraphicsWidth - 110
            };
            SaveHouseButton.OnButtonClick += new ButtonClickDelegate(SaveHouseButton_OnButtonClick);
            this.Add(SaveHouseButton);

            ucp   = new UIUCP(this);
            ucp.Y = ScreenHeight - 210;
            ucp.SetInLot(false);
            ucp.UpdateZoomButton();
            ucp.MoneyText.Caption = PlayerAccount.Money.ToString();
            this.Add(ucp);

            gizmo   = new UIGizmo();
            gizmo.X = ScreenWidth - 500;
            gizmo.Y = ScreenHeight - 300;
            this.Add(gizmo);

            Title = new UIGameTitle();
            Title.SetTitle(city);
            this.Add(Title);

            //OpenInbox();

            this.Add(GameFacade.MessageController);
            GameFacade.MessageController.OnSendLetter  += new LetterSendDelegate(MessageController_OnSendLetter);
            GameFacade.MessageController.OnSendMessage += new MessageSendDelegate(MessageController_OnSendMessage);

            NetworkFacade.Controller.OnNewTimeOfDay += new OnNewTimeOfDayDelegate(Controller_OnNewTimeOfDay);
            NetworkFacade.Controller.OnPlayerJoined += new OnPlayerJoinedDelegate(Controller_OnPlayerJoined);

            //THIS IS KEPT HERE AS A DOCUMENTATION OF THE MESSAGE PASSING API FOR NOW.

            /*
             * MessageAuthor Author = new MessageAuthor();
             * Author.Author = "Whats His Face";
             * Author.GUID = Guid.NewGuid().ToString();
             *
             * GameFacade.MessageController.PassMessage(Author, "you suck");
             * GameFacade.MessageController.PassMessage(Author, "no rly");
             * GameFacade.MessageController.PassMessage(Author, "jk im just testing message recieving please love me");
             *
             * Author.Author = "yer maw";
             * Author.GUID = Guid.NewGuid().ToString();
             *
             * GameFacade.MessageController.PassMessage(Author, "dont let whats his face get to you");
             * GameFacade.MessageController.PassMessage(Author, "i will always love you");
             *
             * Author.Author = "M.O.M.I";
             * Author.GUID = Guid.NewGuid().ToString();
             *
             * GameFacade.MessageController.PassEmail(Author, "Ban Notice", "You have been banned for playing too well. \r\n\r\nWe don't know why you still have access to the game, but it's probably related to you playing the game pretty well. \r\n\r\nPlease stop immediately.\r\n\r\n - M.O.M.I. (this is just a test message btw, you're not actually banned)");
             */

            GameFacade.Scenes.Add(CityRenderer);

            ZoomLevel = 5; //screen always starts at far zoom, city visible.
        }
        public CoreGameScreen() : base()
        {
            /** City Scene **/
            ListenForMouse(new Rectangle(0, 0, ScreenWidth, ScreenHeight), new UIMouseEvent(MouseHandler));


            city = "Queen Margaret's";
            if (PlayerAccount.CurrentlyActiveSim != null)
            {
                city = PlayerAccount.CurrentlyActiveSim.ResidingCity.Name;
            }


            StateChanges = new Queue <SimConnectStateChange>();

            /**
             * Music
             */
            CityMusic = new string[] {
                GlobalSettings.Default.StartupPath + "\\music\\modes\\map\\tsobuild1.mp3",
                GlobalSettings.Default.StartupPath + "\\music\\modes\\map\\tsobuild3.mp3",
                GlobalSettings.Default.StartupPath + "\\music\\modes\\map\\tsomap2_v2.mp3",
                GlobalSettings.Default.StartupPath + "\\music\\modes\\map\\tsomap3.mp3",
                GlobalSettings.Default.StartupPath + "\\music\\modes\\map\\tsomap4_v1.mp3"
            };
            HITVM.Get().PlaySoundEvent(UIMusic.Map);

            /*VMDebug = new UIButton()
             * {
             *  Caption = "Simantics",
             *  Y = 45,
             *  Width = 100,
             *  X = GlobalSettings.Default.GraphicsWidth - 110
             * };
             * VMDebug.OnButtonClick += new ButtonClickDelegate(VMDebug_OnButtonClick);
             * this.Add(VMDebug);*/
            //InitializeMouse();


            CharacterInfos = new string[9];


            SaveHouseButton = new UIButton()
            {
                Caption = "Save House",
                Y       = 10,
                Width   = 100,
                X       = GlobalSettings.Default.GraphicsWidth - 110
            };
            SaveHouseButton.OnButtonClick += new ButtonClickDelegate(SaveHouseButton_OnButtonClick);
            this.Add(SaveHouseButton);
            SaveHouseButton.Visible = false;

            CreateChar = new UIButton()
            {
                Caption = "Create Sim",
                Y       = 10,
                Width   = 100,
                X       = GlobalSettings.Default.GraphicsWidth - 110
            };
            CreateChar.OnButtonClick += new ButtonClickDelegate(CreateChar_OnButtonClick);
            CreateChar.Visible        = true;
            this.Add(CreateChar);

            ucp   = new UIUCP(this);
            ucp.Y = ScreenHeight - 210;
            ucp.SetInLot(false);
            ucp.UpdateZoomButton();
            ucp.MoneyText.Caption = PlayerAccount.Money.ToString();
            this.Add(ucp);

            gizmo   = new UIGizmo();
            gizmo.X = ScreenWidth - 500;
            gizmo.Y = ScreenHeight - 300;
            this.Add(gizmo);

            Title = new UIGameTitle();
            Title.SetTitle(city);
            this.Add(Title);

            //OpenInbox();

            this.Add(GameFacade.MessageController);
            GameFacade.MessageController.OnSendLetter  += new LetterSendDelegate(MessageController_OnSendLetter);
            GameFacade.MessageController.OnSendMessage += new MessageSendDelegate(MessageController_OnSendMessage);

            NetworkFacade.Controller.OnNewTimeOfDay += new OnNewTimeOfDayDelegate(Controller_OnNewTimeOfDay);
            NetworkFacade.Controller.OnPlayerJoined += new OnPlayerJoinedDelegate(Controller_OnPlayerJoined);


            CityRenderer = new Neighborhood(GameFacade.Game.GraphicsDevice);
            CityRenderer.LoadContent();

            CityRenderer.Initialize(GameFacade.HousesDataRetriever);


            CityRenderer.SetTimeOfDay(0.5);

            GameFacade.Scenes.Add(CityRenderer);

            ZoomLevel = 4; //Nhood view.
        }