void UpdateRecentlyLoadedMapsList(string name) { string[] oldList = recentlyLoadedMaps.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); List <string> newList = new List <string>(); newList.Add(name); foreach (string mapName in oldList) { if (!newList.Contains(mapName) && VirtualFile.Exists(mapName)) { newList.Add(mapName); } if (newList.Count >= 3) { break; } } recentlyLoadedMaps = ""; foreach (string mapName in newList) { recentlyLoadedMaps += mapName + "|"; } }
public static byte[] image_load(string filename, out int width, out int height, out int bytes) { width = height = bytes = 0; string path = "data/" + filename; if (!VirtualFile.Exists(path)) { return(null); } byte[] p = null; Bitmap bitmap = Bitmap.FromFile(path); if (bitmap != null) { bitmap.RotateFlip(RotateFlipType.RotateNoneFlipY); BitmapData bitmapData = bitmap.LockBits(bitmap.PixelRectangle, ImageLockMode.ReadOnly, Alt.Sketch.PixelFormat.Format32bppArgb); if (bitmapData != null) { width = bitmapData.PixelWidth; height = bitmapData.PixelHeight; bytes = bitmapData.ByteDepth; p = bitmapData.Scan0; bitmap.UnlockBits(bitmapData); } } return(p); }
private static void WorldLoad(TextBlock textBlock) { string text = null; foreach (TextBlock current in textBlock.Children) { if (current.IsAttributeExist("sourceMapVirtualFileName")) { text = current.GetAttribute("sourceMapVirtualFileName"); break; } } if (text == null) { return; } string directoryName = Path.GetDirectoryName(text); string str = directoryName + "\\LogicSystemCache"; string logicSystemCacheDllPath = str + "\\" + directoryName.Replace('/', '_').Replace('\\', '_') + "_LogicSystem.dll"; if (VirtualFile.Exists(logicSystemCacheDllPath)) { Assembly assembly = LoadAssembly(logicSystemCacheDllPath); if (assembly != null) { EntitySystemWorld.Instance.Internal_SetLogicSystemScriptsAssembly(assembly); } } }
public void ButtonNextLevel_Click(UIButton sender) { // Get next level file name. string nextLevel; { var currentLevel = VirtualPathUtility.NormalizePath( Component_Scene.First.HierarchyController.CreatedByResource.Owner.Name ); var fileName = Path.GetFileName( VirtualPathUtility.NormalizePath( currentLevel ) ); string numberStr = new String(fileName.Where(Char.IsDigit).ToArray()); int number = int.Parse(numberStr) + 1; nextLevel = Path.Combine(Path.GetDirectoryName(currentLevel), $"SimpleGameLevel{number}.scene"); //nextLevel = @"Samples\Simple Game\SimpleGameLevel2.scene"; } if (VirtualFile.Exists(nextLevel)) { // Load next level without changing current GUI screen. if (PlayScreen.Instance.Load(nextLevel, false)) { InitializeSceneEvents(); } } else ScreenMessages.Add("No more levels."); }
void listBox_SelectedIndexChanged(object sender) { Texture texture = null; if (listBox.SelectedIndex != -1) { string mapDirectory = Path.GetDirectoryName((string)listBox.SelectedItem); string textureName = mapDirectory + "\\Description\\Preview"; string textureFileName = null; bool finded = false; string[] extensions = new string[] { "dds", "tga", "png", "jpg" }; foreach (string extension in extensions) { textureFileName = textureName + "." + extension; if (VirtualFile.Exists(textureFileName)) { finded = true; break; } } if (finded) { texture = TextureManager.Instance.Load(textureFileName); } } window.Controls["Preview"].Controls["TexturePlacer"].BackTexture = texture; UpdateButtonsEnabledFlag(); }
public static IntPtr fs_open(string path) { IntPtr fid = IntPtr.Zero; //if (mode == "r") { string fn = "Data/" + path; if (VirtualFile.Exists(fn)) { System.IO.Stream fs = VirtualFile.OpenRead(fn); if (fs != null) { fid = new IntPtr(m_LastFileID++); byte[] buffer = new byte[fs.Length]; fs.Read(buffer, 0, (int)fs.Length); fs.Close(); fs = new System.IO.MemoryStream(buffer, false); m_Files.Add(fid, new FileDescription(fs)); return(fid); } } } return(fid); }
/// <summary> /// Play music. /// </summary> /// <param name="fileName">The file name.</param> /// <param name="loop">Looping flag.</param> public static void MusicPlay(string fileName, bool loop) { Init(); if (musicSound != null && string.Compare(musicSound.Name, fileName, true) == 0) { return; } MusicStop(); if (!string.IsNullOrEmpty(fileName) && VirtualFile.Exists(fileName)) { SoundMode mode = SoundMode.Stream; if (loop) { mode |= SoundMode.Loop; } musicSound = SoundWorld.Instance.SoundCreate(fileName, mode); if (musicSound != null) { musicChannel = SoundWorld.Instance.SoundPlay(musicSound, musicChannelGroup, .5f); } } }
static void FirstTickActions() { string playFile = ""; if (SystemSettings.CommandLineParameters.TryGetValue("-play", out playFile)) { try { if (Path.IsPathRooted(playFile)) { playFile = VirtualPathUtility.GetVirtualPathByReal(playFile); } } catch { } } if (!string.IsNullOrEmpty(playFile) && VirtualFile.Exists(playFile)) { PlayFile(playFile); } else { //default start screen if (!string.IsNullOrEmpty(ProjectSettings.Get.InitialUIScreen.GetByReference)) { ChangeUIScreen(ProjectSettings.Get.InitialUIScreen.GetByReference); } } }
static string GetComponentsTextureName(ImportContext context, string type) { var foundList = new List <string>(); foreach (var item in context.json.Components) { if (item.Type == type) { foreach (var uri in item.Uris) { foreach (var resolution in uri.Resolutions) { foreach (var format in resolution.Formats) { var fileName = Path.Combine(context.directoryName, VirtualPathUtility.NormalizePath(format.Uri)); if (VirtualFile.Exists(fileName)) { foundList.Add(fileName); } } } } } } return(SelectTextureFromList(foundList)); }
public AltGUIGwenComplexDemoControl() { // BackgroundBrush string bgFileName = "AltData/BG.jpg"; if (VirtualFile.Exists(bgFileName)) { Canvas.Background = new TextureBrush(Bitmap.FromFile(bgFileName)); } else { #if (!WINDOWS_PHONE && !WINDOWS_PHONE_7 && !WINDOWS_PHONE_71) RadialGradientBrush brush = new RadialGradientBrush(); brush.GradientOrigin = new Vector2(0.186, 0.311); brush.GradientStops.Add(new GradientStop(0, Color.FromArgb(128, Color.Parse("#FF5C8AE6")))); brush.GradientStops.Add(new GradientStop(1, Color.FromArgb(192, Color.Parse("#FF1254A3") * 1.3))); Canvas.Background = brush; #else Canvas.Background = new SolidColorBrush(Color.Parse("#FF1254A3") * 1.3); #endif } Child = m_ExamplesHolder = new ExamplesHolder(Canvas); m_IntervalTimer.Reset(); }
private void checkBoxShowAIMaps_CheckedChange(CheckBox sender) { if (GameNetworkServer.Instance != null) { //dynamic map example //listBoxMaps.Items.Add(new MapItem(dynamicMapExampleText, false)); //if (lastMapName == dynamicMapExampleText) // listBoxMaps.SelectedIndex = listBoxMaps.Items.Count - 1; listBoxMaps.Items.Clear(); string[] mapList = VirtualDirectory.GetFiles("", "*.map", SearchOption.AllDirectories); foreach (string mapName in mapList) { //check for network support if (VirtualFile.Exists(string.Format("{0}\\NoNetworkSupport.txt", Path.GetDirectoryName(mapName)))) { continue; } if (mapName.Contains("Demo")) { continue; } if (checkBoxShowAIMaps.Checked == false && mapName.Contains("AI")) { continue; } bool recommended = mapName.Contains("AKMaps"); //mapName.Contains( "JigsawPuzzleGame" ) || mapName.Contains( "TankDemo" ) || //mapName.Contains( "DeathmatchDemo" ); listBoxMaps.Items.Add(new MapItem(mapName, recommended, false)); if (mapName == lastMapName) { listBoxMaps.SelectedIndex = listBoxMaps.Items.Count - 1; } } listBoxMaps.SelectedIndexChange += listBoxMaps_SelectedIndexChange; if (listBoxMaps.Items.Count != 0 && listBoxMaps.SelectedIndex == -1) { listBoxMaps.SelectedIndex = 0; } } else { listBoxMaps.Enable = false; } }
void CreateScene(ContentBrowser.Item item) { try { var prefix = VirtualDirectory.Exists("Scenes") ? @"Scenes\" : ""; string fileName = null; for (int n = 1; ; n++) { string f = prefix + string.Format(@"New{0}.scene", n > 1 ? n.ToString() : ""); if (!VirtualFile.Exists(f)) { fileName = f; break; } } if (!string.IsNullOrEmpty(fileName)) { var realFileName = VirtualPathUtility.GetRealPathByVirtual(fileName); var template = (Component_Scene.NewObjectSettingsScene.TemplateClass)item.Tag; string name = template.Name + ".scene"; var sourceFile = VirtualPathUtility.GetRealPathByVirtual(@"Base\Tools\NewResourceTemplates\" + name); //copy scene file var text = File.ReadAllText(sourceFile); var directoryName = Path.GetDirectoryName(realFileName); if (!Directory.Exists(directoryName)) { Directory.CreateDirectory(directoryName); } File.WriteAllText(realFileName, text); //copy additional folder if exist var sourceFolderPath = sourceFile + "_Files"; if (Directory.Exists(sourceFolderPath)) { var destFolderPath = realFileName + "_Files"; IOUtility.CopyDirectory(sourceFolderPath, destFolderPath); } EditorAPI.SelectFilesOrDirectoriesInMainResourcesWindow(new string[] { realFileName }); EditorAPI.OpenFileAsDocument(realFileName, true, true); } } catch (Exception e) { EditorMessageBox.ShowWarning(e.Message); //Log.Warning( e.Message ); return; } }
public void LoadSc(String sc) { string nextLevel = "Store\\AndreyKorolev\\5MinGame\\" + sc + ".scene"; if (VirtualFile.Exists(nextLevel)) { PlayScreen.Instance.Load(nextLevel, false); ResetCmr(); } else { ScreenMessages.Add("No scene"); } }
///////////////////////////////////////// static string GetTextureName(Welcome json, string directoryName, string type) { if (json.Components != null) { Component GetComponent() { foreach (var c2 in json.Components) { if (c2.Type == type) { return(c2); } } return(null); } var c = GetComponent(); if (c != null && c.Uris != null) { foreach (var uri in c.Uris) { if (uri.Resolutions != null) { foreach (var res in uri.Resolutions) { if (res.Formats != null) { foreach (var format in res.Formats) { if (!string.IsNullOrEmpty(format.Uri)) { var fileName = Path.Combine(directoryName, format.Uri); if (VirtualFile.Exists(fileName)) { //!!!!what to select when more than one file exists. exr, jpg. return(fileName); } } } } } } } } } return(""); }
protected override void OnUpdate(float delta) { base.OnUpdate(delta); // Update background scene. if (currentDisplayBackgroundSceneOption != SimulationApp.DisplayBackgroundScene) { currentDisplayBackgroundSceneOption = SimulationApp.DisplayBackgroundScene; if (currentDisplayBackgroundSceneOption && EngineApp.ApplicationType == EngineApp.ApplicationTypeEnum.Simulation) { var fileName = BackgroundScene.GetByReference; if (!string.IsNullOrEmpty(fileName) && VirtualFile.Exists(fileName)) { LoadScene(fileName); } else { LoadScene(""); } } else { LoadScene(""); } } // Update sound listener. if (scene != null && sceneViewport != null) { var settings = sceneViewport.CameraSettings; SoundWorld.SetListener(scene, settings.Position, Vector3.Zero, settings.Rotation); } else { SoundWorld.SetListenerReset(); } // Scene simulation. if (scene != null && scene.HierarchyController != null) { scene.HierarchyController.PerformSimulationSteps(); } if (!firstRender) { fadeInTimer += delta; } }
public static void Init(string fileName) { if (ToolsLocalization.Ek) { Log.Fatal("ToolsLocalization: Init: Already initialized."); } if (VirtualFile.Exists(fileName)) { ToolsLocalization.Ek = true; ToolsLocalization.EL = fileName; ToolsLocalization.EM = new Dictionary <string, ToolsLocalization.GroupItem>(); ToolsLocalization.El = false; ToolsLocalization.A(); } }
public void listBox_SelectedIndexChanged(object sender) { Texture texture = null; string description = ""; ListBox listBox = (ListBox)Owner.MainControl.Controls["List"]; if (listBox.SelectedIndex != -1) { string mapName = (string)listBox.SelectedItem; string mapDirectory = System.IO.Path.GetDirectoryName(mapName); //get texture string textureName = mapDirectory + "\\Description\\Preview"; string textureFileName = null; string[] extensions = new string[] { "dds", "tga", "png", "jpg" }; foreach (string extension in extensions) { string fileName = textureName + "." + extension; if (VirtualFile.Exists(fileName)) { textureFileName = fileName; break; } } if (textureFileName != null) { texture = TextureManager.Instance.Load(textureFileName); } //get description text string descriptionFileName = mapDirectory + "\\Description\\Description.config"; if (VirtualFile.Exists(descriptionFileName)) { string error; TextBlock block = TextBlockUtils.LoadFromVirtualFile(descriptionFileName, out error); if (block != null) { description = block.GetAttribute("description"); } } ActivateTeleporter(mapName); } Owner.MainControl.Controls["Preview"].BackTexture = texture; Owner.MainControl.Controls["Description"].Text = description; }
public static void PlayFile(string virtualFileName) { if (!string.IsNullOrEmpty(virtualFileName) && VirtualFile.Exists(virtualFileName)) { //load Play screen if (ChangeUIScreen(@"Base\UI\Screens\PlayScreen.ui")) { var playScreen = CurrentUIScreen as PlayScreen; if (playScreen != null) { playScreen.Load(virtualFileName, true); playScreen.ResetCreateTime(); } } } }
static string GetBillboardsTextureName(ImportContext context, string type) { var foundList = new List <string>(); foreach (var item in context.json.Billboards) { if (item.Type == type && !string.IsNullOrEmpty(item.Uri)) { var fileName = Path.Combine(context.directoryName, VirtualPathUtility.NormalizePath(item.Uri)); if (VirtualFile.Exists(fileName)) { foundList.Add(fileName); } } } return(SelectTextureFromList(foundList)); }
void Save(string fileName) { if (VirtualFile.Exists(fileName)) { //overwrite check by MessageBox need here } if (!GameEngineApp.Instance.WorldSave(fileName)) { return; } string text = string.Format("World saved to \n\"{0}\".", fileName); GameEngineApp.Instance.ControlManager.Controls.Add( new MessageBoxWindow(text, "Load/Save", null)); SetShouldDetach(); }
public void LoadGame(String filename) { if (!VirtualFile.Exists("Store\\AndreyKorolev\\5MinGame\\Saves\\" + filename + ".lvldata")) { ScreenMessages.Add("No file"); return; } TextBlock block = TextBlockUtility.LoadFromVirtualFile("Store\\AndreyKorolev\\5MinGame\\Saves\\" + filename + ".lvldata"); EnemiesKill = int.Parse(block.FindChild("EnemiesKill").Data); ScreenMessages.Add("EnemiesKill = " + EnemiesKill); Level = int.Parse(block.FindChild("Level").Data); ScreenMessages.Add("Level = " + Level); CheckPoint = block.FindChild("CheckPoint").Data; ScreenMessages.Add("CheckPoint = " + CheckPoint); hasWeapon = bool.Parse(block.FindChild("hasWeapon").Data); ScreenMessages.Add("hasWeapon = " + hasWeapon); ShowWin(false); AddEK(0); if (Level == 1) { LoadSc("File"); } else if (Level == 2) { LoadSc("File2"); } else { ScreenMessages.Add("No level"); } var sc = Component_Scene.First; var chpoint = (Component_Sensor)sc?.GetComponentByPath(CheckPoint); var chr = (Component_Character)sc?.GetComponentByPath("Character"); var chrcol = (Component_RigidBody)sc?.GetComponentByPath("Character\\Collision Body"); chrcol.Transform = chrcol.TransformV.UpdatePosition(new Vector3(chpoint.TransformV.Position.X, chpoint.TransformV.Position.Y, chr.TransformV.Position.Z)); GetWeapon(sc, chr, hasWeapon); ScreenMessages.Add("Load Done"); }
void CreateUIControl() { try { var prefix = VirtualDirectory.Exists("UI") ? @"UI\" : ""; string fileName = null; for (int n = 1; ; n++) { string f = prefix + string.Format(@"New{0}.ui", n > 1 ? n.ToString() : ""); if (!VirtualFile.Exists(f)) { fileName = f; break; } } if (!string.IsNullOrEmpty(fileName)) { var realFileName = VirtualPathUtility.GetRealPathByVirtual(fileName); var sourceFile = VirtualPathUtility.GetRealPathByVirtual(@"Base\Tools\NewResourceTemplates\UIControl.ui"); var text = VirtualFile.ReadAllText(sourceFile); var directoryName = Path.GetDirectoryName(realFileName); if (!Directory.Exists(directoryName)) { Directory.CreateDirectory(directoryName); } File.WriteAllText(realFileName, text); EditorAPI.SelectFilesOrDirectoriesInMainResourcesWindow(new string[] { realFileName }); EditorAPI.OpenFileAsDocument(realFileName, true, true); } } catch (Exception e) { EditorMessageBox.ShowWarning(e.Message); //Log.Warning( e.Message ); return; } }
/// <summary> /// Creates the background world. /// </summary> void CreateMap() { DestroyMap(); string mapName = "Maps\\Demos\\Village Demo\\Map\\Map.map"; if (VirtualFile.Exists(mapName)) { WorldType worldType = EntityTypes.Instance.GetByName("SimpleWorld") as WorldType; if (worldType == null) { Log.Fatal("MainMenuWindow: CreateMap: \"SimpleWorld\" type is not exists."); } if (GameEngineApp.Instance.ServerOrSingle_MapLoad(mapName, worldType, true)) { mapInstance = Map.Instance; EntitySystemWorld.Instance.Simulation = true; } } }
public void LoadNext() { if (Level > 1) { ScreenMessages.Add("No next scene"); return; } string nextLevel = "Store\\AndreyKorolev\\5MinGame\\File2.scene"; if (VirtualFile.Exists(nextLevel)) { Level = 2; PlayScreen.Instance.Load(nextLevel, false); ResetCmr(); } else { ScreenMessages.Add("No scene"); } }
static void FirstTickActions() { string playFile = ""; if (SystemSettings.CommandLineParameters.TryGetValue("-play", out playFile)) { try { if (Path.IsPathRooted(playFile)) { playFile = VirtualPathUtility.GetVirtualPathByReal(playFile); } } catch { } } if (!string.IsNullOrEmpty(playFile) && VirtualFile.Exists(playFile)) { //load Play screen if (ChangeUIScreen(@"Base\UI\Screens\PlayScreen.ui")) { var playScreen = CurrentUIScreen as PlayScreen; if (playScreen != null) { playScreen.Load(playFile, true); playScreen.ResetCreateTime(); } } } else { //default start screen if (!string.IsNullOrEmpty(ProjectSettings.Get.InitialUIScreen.GetByReference)) { ChangeUIScreen(ProjectSettings.Get.InitialUIScreen.GetByReference); } } }
public void SetScene(Component_Scene scene, bool canChangeUIControl) { this.scene = scene; sceneViewport = ParentContainer.Viewport; scene.ViewportUpdateBegin += Scene_ViewportUpdateBegin; scene.ViewportUpdateGetCameraSettings += Scene_ViewportUpdateGetCameraSettings; scene.RenderEvent += Scene_RenderEvent; sceneViewport.AttachedScene = scene; //init GameMode gameMode = scene.GetComponent <Component_GameMode>(onlyEnabledInHierarchy: true); // Load UI screen of the scene. if (canChangeUIControl) { var uiScreen = scene.UIScreen.Value; if (uiScreen != null) { //if( uiScreen.ParentRoot != scene.ParentRoot ) //{ var fileName = uiScreen.HierarchyController?.CreatedByResource?.Owner.Name; if (!string.IsNullOrEmpty(fileName) && VirtualFile.Exists(fileName)) { uiControl = ResourceManager.LoadSeparateInstance <UIControl>(fileName, false, null); if (uiControl != null) { AddComponent(uiControl); } } //} //else //{ // //!!!!impl? //} } } }
protected override bool OnInitLibrary(bool allowHardwareAcceleration, bool editor) { instance = this; NativeLibraryManager.PreLoadLibrary("ode"); //int maxIterationCount = 20; //int hashSpaceMinLevel = 2;// 2^2 = 4 minimum cell size //int hashSpaceMaxLevel = 8;// 2^8 = 256 maximum cell size if (VirtualFile.Exists("Base/Constants/PhysicsSystem.config")) { TextBlock block = TextBlockUtils.LoadFromVirtualFile("Base/Constants/PhysicsSystem.config"); if (block != null) { TextBlock odeBlock = block.FindChild("odeSpecific"); if (odeBlock != null) { if (odeBlock.IsAttributeExist("maxIterationCount")) { defaultMaxIterationCount = int.Parse(odeBlock.GetAttribute("maxIterationCount")); } if (odeBlock.IsAttributeExist("hashSpaceMinLevel")) { hashSpaceMinLevel = int.Parse(odeBlock.GetAttribute("hashSpaceMinLevel")); } if (odeBlock.IsAttributeExist("hashSpaceMaxLevel")) { hashSpaceMaxLevel = int.Parse(odeBlock.GetAttribute("hashSpaceMaxLevel")); } } } } Ode.dInitODE2(0); return(true); }
public bool Load(string fileName, bool canChangeUIControl) { DestroyLoadedObject(canChangeUIControl); playFileName = fileName; SoundWorld.SetListenerReset(); if (!string.IsNullOrEmpty(playFileName) && VirtualFile.Exists(playFileName)) { string extension = Path.GetExtension(PlayFileName).Replace(".", "").ToLower(); if (extension == "scene") { return(LoadScene(canChangeUIControl)); } if (extension == "ui") { return(LoadUIControl()); } } return(false); }
private void initConfig() { string p = string.Format("Base/Constants/{0}.config", Program.ExecutableName); Log.Info(">> 配置文件: {0}", p); string defaultMapTypeName = typeof(DefaultMap).Name; if (VirtualFile.Exists(p)) { TextBlock textBlock = TextBlockUtils.LoadFromVirtualFile(p); if (textBlock != null) { this.MapTypeName = textBlock.GetAttribute("mapTypeForNewMaps", defaultMapTypeName); } } if (string.IsNullOrEmpty(this.MapTypeName)) { this.MapTypeName = defaultMapTypeName; } Log.Info(">> 缺省地图类型: {0}", this.MapTypeName); }
protected override void OnEnabledInSimulation() { instance = this; if (Components["Button Scenes"] != null) { ((UIButton)Components["Button Scenes"]).Click += ButtonScenes_Click; } if (Components["Button Options"] != null) { ((UIButton)Components["Button Options"]).Click += ButtonOptions_Click; } if (Components["Button Exit"] != null) { ((UIButton)Components["Button Exit"]).Click += ButtonExit_Click; } //play buttons if (Components["Button Play Sci-fi Demo"] != null) { var button = (UIButton)Components["Button Play Sci-fi Demo"]; var fileName = @"Samples\Sci-fi Demo\Scenes\Sci-fi Demo.scene"; button.AnyData = fileName; button.Click += ButtonPlay_Click; if (button.Visible) { button.Visible = VirtualFile.Exists(fileName); } } if (Components["Button Play Nature Demo"] != null) { var button = (UIButton)Components["Button Play Nature Demo"]; var fileName = @"Samples\Nature Demo\Scenes\Nature Demo.scene"; button.AnyData = fileName; button.Click += ButtonPlay_Click; if (button.Visible) { button.Visible = VirtualFile.Exists(fileName); } } if (Components["Button Play Simple Game"] != null) { var button = (UIButton)Components["Button Play Simple Game"]; var fileName = @"Samples\Simple Game\SimpleGameLevel1.scene"; button.AnyData = fileName; button.Click += ButtonPlay_Click; if (button.Visible) { button.Visible = VirtualFile.Exists(fileName); } } if (Components["Button Play Character Scene"] != null) { var button = (UIButton)Components["Button Play Character Scene"]; var fileName = @"Samples\Starter Content\Scenes\Character.scene"; button.AnyData = fileName; button.Click += ButtonPlay_Click; if (button.Visible) { button.Visible = VirtualFile.Exists(fileName); } } if (Components["Button Play Spaceship 2D"] != null) { var button = (UIButton)Components["Button Play Spaceship 2D"]; var fileName = @"Samples\Starter Content\Scenes\Spaceship control 2D.scene"; button.AnyData = fileName; button.Click += ButtonPlay_Click; if (button.Visible) { button.Visible = VirtualFile.Exists(fileName); } } if (Components["Button Play Character 2D"] != null) { var button = (UIButton)Components["Button Play Character 2D"]; var fileName = @"Samples\Starter Content\Scenes\Character 2D.scene"; button.AnyData = fileName; button.Click += ButtonPlay_Click; if (button.Visible) { button.Visible = VirtualFile.Exists(fileName); } } // Update sound listener. SoundWorld.SetListenerReset(); // Load background scene. currentDisplayBackgroundSceneOption = SimulationApp.DisplayBackgroundScene; if (currentDisplayBackgroundSceneOption && EngineApp.ApplicationType == EngineApp.ApplicationTypeEnum.Simulation) { var fileName = BackgroundScene.GetByReference; if (!string.IsNullOrEmpty(fileName) && VirtualFile.Exists(fileName)) { LoadScene(fileName); } else { LoadScene(""); } } else { LoadScene(""); } }