public void ShowCredits() { var screen = Kernel.Get <Credits>(); GameFacade.Screens.RemoveCurrent(); GameFacade.Screens.AddScreen(screen); DiscordRpcEngine.SendFSOPresence("Viewing Credits"); }
public void EnterSandboxMode(string lotName, bool external) { var screen = new SandboxGameScreen(); GameFacade.Screens.RemoveCurrent(); GameFacade.Screens.AddScreen(screen); screen.Initialize(lotName, external); DiscordRpcEngine.SendFSOPresence("Playing Sandbox Mode"); }
/// <summary> /// Go to the person selection page /// </summary> public void ShowPersonSelection() { if (GlobalSettings.Default.CompatState == -1) { GlobalSettings.Default.CompatState = 0; GlobalSettings.Default.Save(); } ChangeState <PersonSelection, PersonSelectionController>((view, controller) => { DiscordRpcEngine.SendFSOPresence("In Select A Sim"); }); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { GameThread.UpdateExecuting = true; DiscordRpcEngine.Update(); if (HITVM.Get() != null) { HITVM.Get().Tick(); } base.Update(gameTime); GameThread.UpdateExecuting = false; }
/// <summary> /// Show the login screen /// </summary> public void ShowLogin() { ChangeState <LoginScreen, LoginController>((view, controller) => { DiscordRpcEngine.SendFSOPresence("In Main Menu"); }); /* * var screen = Kernel.Get<LoginScreen>(); * GameFacade.Screens.RemoveCurrent(); * GameFacade.Screens.AddScreen(screen); */ }
private void SetTitle() { var title = LotControl.GetLotTitle(); Title.SetTitle(title); if (lastLotTitle != title) { DiscordRpcEngine.SendFSOPresence( vm.LotName, (int)FindController <CoreGameScreenController>().GetCurrentLotID(), vm.Entities.Count(x => x is VMAvatar && x.PersistID != 0), vm.LotName.StartsWith("{job:") ? 4 : 24, vm.TSOState.PropertyCategory ); lastLotTitle = title; } }
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(); }
private void SetTitle() { var title = LotControl.GetLotTitle(); Title.SetTitle(title); if (lastLotTitle != title) { bool isPrivate = false; if (gizmo.CurrentAvatar.Value.Avatar_PrivacyMode > 0) { isPrivate = true; } DiscordRpcEngine.SendFSOPresence( gizmo.CurrentAvatar.Value.Avatar_Name, vm.LotName, (int)FindController <CoreGameScreenController>().GetCurrentLotID(), vm.Entities.Count(x => x is VMAvatar && x.PersistID != 0), vm.LotName.StartsWith("{job:") ? 4 : 24, vm.TSOState.PropertyCategory, isPrivate ); lastLotTitle = title; } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { var kernel = new StandardKernel( new RegulatorsModule(), new NetworkModule(), new CacheModule() ); FSOFacade.Kernel = kernel; var settings = GlobalSettings.Default; if (FSOEnvironment.SoftwareDepth) { settings.GraphicsWidth = (int)(GraphicsDevice.Viewport.Width / FSOEnvironment.DPIScaleFactor); settings.GraphicsHeight = (int)(GraphicsDevice.Viewport.Height / FSOEnvironment.DPIScaleFactor); } //manage settings if (settings.LightingMode == -1) { if (settings.Lighting) { if (settings.Shadows3D) { settings.LightingMode = 2; } else { settings.LightingMode = 1; } } else { settings.LightingMode = 0; } settings.Save(); } LotView.WorldConfig.Current = new LotView.WorldConfig() { LightingMode = settings.LightingMode, SmoothZoom = settings.SmoothZoom, SurroundingLots = settings.SurroundingLotMode, AA = settings.AntiAlias, }; FeatureLevelTest.UpdateFeatureLevel(GraphicsDevice); if (!FSOEnvironment.TexCompressSupport) { settings.TexCompression = 0; } else if ((settings.TexCompression & 2) == 0) { settings.TexCompression = 1; } FSOEnvironment.TexCompress = (!IffFile.RETAIN_CHUNK_DATA) && (settings.TexCompression & 1) > 0; //end settings management OperatingSystem os = Environment.OSVersion; PlatformID pid = os.Platform; GameFacade.Linux = (pid == PlatformID.MacOSX || pid == PlatformID.Unix); FSO.Content.Content.TS1Hybrid = GlobalSettings.Default.TS1HybridEnable; FSO.Content.Content.TS1HybridBasePath = GlobalSettings.Default.TS1HybridPath; FSO.Content.Content.Init(GlobalSettings.Default.StartupPath, GraphicsDevice); VMContext.InitVMConfig(); base.Initialize(); GameFacade.GameThread = Thread.CurrentThread; SceneMgr = new _3DLayer(); SceneMgr.Initialize(GraphicsDevice); FSOFacade.Controller = kernel.Get <GameController>(); GameFacade.Screens = uiLayer; GameFacade.Scenes = SceneMgr; GameFacade.GraphicsDevice = GraphicsDevice; GameFacade.GraphicsDeviceManager = Graphics; GameFacade.Emojis = new Common.Rendering.Emoji.EmojiProvider(GraphicsDevice); GameFacade.Cursor = new CursorManager(GraphicsDevice); if (!GameFacade.Linux) { GameFacade.Cursor.Init(FSO.Content.Content.Get().GetPath(""), false); } /** Init any computed values **/ GameFacade.Init(); //init audio now HITVM.Init(); var hit = HITVM.Get(); hit.SetMasterVolume(HITVolumeGroup.FX, GlobalSettings.Default.FXVolume / 10f); hit.SetMasterVolume(HITVolumeGroup.MUSIC, GlobalSettings.Default.MusicVolume / 10f); hit.SetMasterVolume(HITVolumeGroup.VOX, GlobalSettings.Default.VoxVolume / 10f); hit.SetMasterVolume(HITVolumeGroup.AMBIENCE, GlobalSettings.Default.AmbienceVolume / 10f); GameFacade.Strings = new ContentStrings(); FSOFacade.Controller.StartLoading(); GraphicsDevice.RasterizerState = new RasterizerState() { CullMode = CullMode.None }; try { var audioTest = new SoundEffect(new byte[2], 44100, AudioChannels.Mono); //initialises XAudio. audioTest.CreateInstance().Play(); } catch (Exception e) { //MessageBox.Show("Failed to initialize audio: \r\n\r\n" + e.StackTrace); } this.IsMouseVisible = true; this.IsFixedTimeStep = true; WorldContent.Init(this.Services, Content.RootDirectory); DGRP3DMesh.InitRCWorkers(); if (!FSOEnvironment.SoftwareKeyboard) { AddTextInput(); } base.Screen.Layers.Add(SceneMgr); base.Screen.Layers.Add(uiLayer); GameFacade.LastUpdateState = base.Screen.State; //Bind ninject objects kernel.Bind <FSO.Content.Content>().ToConstant(FSO.Content.Content.Get()); kernel.Load(new ClientDomainModule()); //Have to be eager with this, it sets a singleton instance on itself to avoid packets having //to be created using Ninject for performance reasons kernel.Get <cTSOSerializer>(); var ds = kernel.Get <DataService>(); ds.AddProvider(new ClientAvatarProvider()); this.Window.Title = "FreeSO"; DiscordRpcEngine.Init(); if (!GlobalSettings.Default.Windowed && !GameFacade.GraphicsDeviceManager.IsFullScreen) { GameFacade.GraphicsDeviceManager.ToggleFullScreen(); } }
public CoreGameScreen() : base() { DiscordRpcEngine.SendFSOPresence(null, 0, 0, 0, 0); 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(); ControllerUtils.BindController <GizmoController>(gizmo); 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; ControllerUtils.BindController <PersonPageController>(PersonPage); WindowContainer.Add(PersonPage); LotPage = new UILotPage(); LotPage.Visible = false; ControllerUtils.BindController <LotPageController>(LotPage); WindowContainer.Add(LotPage); Bookmarks = new UIBookmarks(); Bookmarks.Visible = false; ControllerUtils.BindController <BookmarksController>(Bookmarks); WindowContainer.Add(Bookmarks); Relationships = new UIRelationshipDialog(); Relationships.Visible = false; ControllerUtils.BindController <RelationshipDialogController>(Relationships); WindowContainer.Add(Relationships); Inbox = new UIInbox(); Inbox.Visible = false; ControllerUtils.BindController <InboxController>(Inbox); WindowContainer.Add(Inbox); }