public LevelSelect(GameModel gameModel, GraphicsDeviceManager graphics, LoadedContent content) { this.content = content; this.gameModel = gameModel; this.graphics = graphics; BuildSeriesPanel(); }
private void UnloadContentItem(KeyValuePair <string, object> item) { LoadedContent.Remove(item.Key); if (item.Value is IDisposable disposable) { disposable.Dispose(); } }
public void LoadAtRoute(string route) { Content = UmbracoContext.ContentCache.GetByRoute(route, true); if (Content == null) { throw new Exception("Can't find content at route " + route); } LoadedContent?.Invoke(this, EventArgs.Empty); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); AudioBox.ItemsSource = AudioList; if ((int)localSettings.Values[Settings.ACTIONACTION] == Settings.Actions.CREATE) { return; } using (var context = new TaskSchedulerDbContext()) { Models.Action action = context.Actions.Where(x => x.Id == (int)localSettings.Values[Settings.ACTIONID]).First(); switch (action.Type) { case ActionType.URI: { UriAction uriAction = context.UriActions.Where(x => x.Id == action.ActionId).First(); Uri = uriAction.Uri; Index = 0; }; break; case ActionType.NOTIFICATION: { NotificationAction notificationAction = context.NotificationActions.Where(x => x.Id == action.ActionId).First(); Text = notificationAction.Text; Image = notificationAction.Image; Audio = notificationAction.Audio.GetValueOrDefault(0); if (notificationAction.Timeout.HasValue) { Timeout = notificationAction.Timeout.Value.ToString(); } Index = 1; }; break; case ActionType.APPLICATION: { ApplicationAction applicationAction = context.ApplicationActions.Where(x => x.Id == action.ActionId).First(); appListProvider.IsDoneTask.ContinueWith(async(result) => { await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { bool ok = appListProvider.AppList.Where(x => x.Package.Id.FullName == applicationAction.ApplicationName).Any(); if (ok) { AppEntry entry = appListProvider.AppList.Where(x => x.Package.Id.FullName == applicationAction.ApplicationName).First(); LoadedContent.SelectedItem = entry; LoadedContent.ScrollIntoView(entry); } }); }); Index = 2; }; break; } } }
public GameScene(GraphicsDeviceManager graphics, LoadedContent content, GameModel gameModel) { textureBlocks = content.BlocksTextures; font = content.Font; this.graphics = graphics; this.gameModel = gameModel; gameModel.LevelLoaded += () => { field = new Field(gameModel.GetAllGameObjects(), gameModel.SizeOfStoreroom, textureBlocks); field.Init(new Point(40, 60), new Point(graphics.PreferredBackBufferWidth - 80, graphics.PreferredBackBufferHeight - 120)); }; }
/// <summary> /// Get a content item that was loaded with Load() /// </summary> /// <param name="key"></param> /// <returns></returns> public T GetLoadedContent <T>(string key) { if (key is null) { throw new ArgumentNullException(nameof(key)); } if (key.Length == 0) { throw new ArgumentException("key.Length must be > 0", nameof(key)); } if (LoadedContent.TryGetValue(key, out var value)) { if (value is T ret) { return(ret); } throw new InvalidOperationException($"Content with key \"{key}\" is not type {typeof(T)}"); } throw new ArgumentException($"Content with key \"{key}\" is not loaded", nameof(key)); }
public ActionResult extend() { LoadedContent jscontent = new LoadedContent(); if (HttpContext.Cache[Request.Path] == null) { var extend = JsLoader.Instance.LoadFeatures("extend", "files.xml"); jscontent.filenames.AddRange(extend.filenames); jscontent.content = string.Concat(jscontent.content, extend.content); var jqgrid = JsLoader.Instance.LoadFeatures("jqgrid", "files.xml"); jscontent.filenames.AddRange(jqgrid.filenames); jscontent.content = string.Concat(jscontent.content, jqgrid.content); var main = JsLoader.Instance.LoadFeatures("main", "files.xml"); jscontent.filenames.AddRange(main.filenames); jscontent.content = string.Concat(jscontent.content, main.content); var offline = JsLoader.Instance.LoadFeatures("offline", "files.xml"); jscontent.filenames.AddRange(offline.filenames); jscontent.content = string.Concat(jscontent.content, offline.content); HttpContext.Cache.Insert(Request.Path, jscontent, new CacheDependency(jscontent.filenames.ToArray())); } else { jscontent = (LoadedContent)HttpContext.Cache[Request.Path]; } // handle caching Response.AddFileDependencies(jscontent.filenames.ToArray()); Response.Cache.SetLastModifiedFromFileDependencies(); Response.Cache.SetETagFromFileDependencies(); Response.Cache.SetCacheability(HttpCacheability.Public); Response.Cache.SetExpires(DateTime.UtcNow.AddDays(1)); return(Content(jscontent.content, CONTENT_TYPE_JAVASCRIPT)); }
private void LoadContentItem(ContentItem item) { object loaded = null; switch (item.Type.Name) { default: throw new NotImplementedException($"No case for loading content of type {item.Type.Name}"); case nameof(ShaderModule): loaded = LoadShaderModule(item.Path); break; case nameof(Texture2D): loaded = LoadTexture(item.Key, item.Path); break; } if (loaded is null) { throw new NotImplementedException($"{nameof(loaded)} was never set for content {item.Key} of type {item.Type.Name}"); } LoadedContent.Add(item.Key, loaded); }
public SceneManager(ContentManager contentManager, LoadedContent loadedContent, GraphicsDeviceManager graphics) { UserInterface.Initialize(contentManager, BuiltinThemes.editor); gameModel = new GameModel(); this.graphics = graphics; pause = new Pause(); mainMenu = new MainMenu(); gameScene = new GameScene(graphics, loadedContent, gameModel); levelSelect = new LevelSelect(gameModel, graphics, loadedContent); gameModel.LevelCompleted += () => { currentScene = levelSelect; levelSelect.Call(); }; textureBackground = loadedContent.TextureBackground; mainMenu.StartButtonPressed += () => { currentScene = levelSelect; levelSelect.Call(); }; mainMenu.ExitButtonPressed += () => Exit(); levelSelect.GameStart += () => { currentScene = gameScene; }; pause.ContinueButtonPressed += () => currentScene = gameScene; pause.MainMenuButtonPressed += mainMenu.Call; pause.RestartButtonPressed += () => { gameModel.Restart(); currentScene = gameScene; }; currentScene = mainMenu; }
private void DoLoadContent() { LoadingContent.Raise(this); LoadContent(); LoadedContent.Raise(this); }
internal static void InvokeLoadedContent(ContentManager contentManager) { LoadedContent?.Invoke(null, new LoadedContentEventArgs(contentManager)); }
public virtual void LoadContent() { LoadedContent?.Invoke(this, EventArgs.Empty); }