コード例 #1
0
        async Task CreateResources(Microsoft.Graphics.Canvas.UI.Xaml.CanvasAnimatedControl sender)
        {
            background = await CanvasBitmap.LoadAsync(sender, "Assets/floor.jpg");

            greenVirus = await CanvasBitmap.LoadAsync(sender, "Assets/Green_Virus.png");

            redVirus = await CanvasBitmap.LoadAsync(sender, "Assets/Red_Virus.png");

            BulletImg = await CanvasBitmap.LoadAsync(sender, "Assets/Red_Virus.png");

            List <CanvasBitmap> playerAssets = new List <CanvasBitmap>();
            List <CanvasBitmap> zombies      = new List <CanvasBitmap>();

            foreach (string aimAsset in GameAssets.PlayerAiming)
            {
                playerAssets.Add(await CanvasBitmap.LoadAsync(sender, aimAsset));
            }

            foreach (string zombieAsset in GameAssets.ZombieMoving)
            {
                zombies.Add(await CanvasBitmap.LoadAsync(sender, zombieAsset));
            }

            // need to add the bitmaps for reloading
            covidGame.SetBitmaps(playerAssets, new List <CanvasBitmap>(), zombies, null);
        }
コード例 #2
0
 async System.Threading.Tasks.Task LoadBitmaps(Microsoft.Graphics.Canvas.UI.Xaml.CanvasAnimatedControl sender)
 {
     try
     {
         Package       package           = Package.Current;
         StorageFolder installedLocation = package.InstalledLocation;
         string        folderName        = installedLocation.Path + "\\" + "Assets" + "\\";
         bitmaps = null;
         bitmaps = new List <Microsoft.Graphics.Canvas.CanvasBitmap>((int)BitmapIds.PlayerPicking + 1);
         // E, WE need to be redrawn to look like they are in the shade of the tent
         bitmaps.Add(await CanvasBitmap.LoadAsync(sender, folderName + @"BGTile_E.png"));      //bitmaps[(int)BitmapIds.E]
         bitmaps.Add(await CanvasBitmap.LoadAsync(sender, folderName + @"BGTile_WE.png"));     //bitmaps[(int)BitmapIds.WE]
         bitmaps.Add(await CanvasBitmap.LoadAsync(sender, folderName + @"BGTile_NWE.png"));    //bitmaps[(int)BitmapIds.NWE]
         bitmaps.Add(await CanvasBitmap.LoadAsync(sender, folderName + @"BGTile_NS.png"));     //bitmaps[(int)BitmapIds.NS]
         bitmaps.Add(await CanvasBitmap.LoadAsync(sender, folderName + @"BGTile_NSE.png"));    //bitmaps[(int)BitmapIds.NSE]
         bitmaps.Add(await CanvasBitmap.LoadAsync(sender, folderName + @"BGTile_S.png"));      //bitmaps[(int)BitmapIds.S]
         bitmaps.Add(await CanvasBitmap.LoadAsync(sender, folderName + @"BGTile_NSWE.png"));   //bitmaps[(int)BitmapIds.NSWE]
         bitmaps.Add(await CanvasBitmap.LoadAsync(sender, folderName + @"BGTile_NSW.png"));    //bitmaps[(int)BitmapIds.NSW]
         bitmaps.Add(await CanvasBitmap.LoadAsync(sender, folderName + @"BGTile_NW.png"));     //bitmaps[(int)BitmapIds.NW]
         // Add Tent Left and Tent Right, here (also insert relevant enums before BitmapIds.Berry)
         bitmaps.Add(await CanvasBitmap.LoadAsync(sender, folderName + @"Berry.png"));         // bitmaps[(int)BitmapIds.Berry]
         bitmaps.Add(await CanvasBitmap.LoadAsync(sender, folderName + @"Bug.png"));           // bitmaps[(int)BitmapIds.Bug]
         bitmaps.Add(await CanvasBitmap.LoadAsync(sender, folderName + @"PlayerIdle.png"));    // bitmaps[(int)BitmapIds.PlayerIdle]
         bitmaps.Add(await CanvasBitmap.LoadAsync(sender, folderName + @"PlayerPicking.png")); // bitmaps[(int)BitmapIds.PlayerPicking]
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
コード例 #3
0
        async Task CreateResources(Microsoft.Graphics.Canvas.UI.Xaml.CanvasAnimatedControl sender)
        {
            spaceImage = await CanvasBitmap.LoadAsync(sender, "Assets/spacepic.png");

            game.spaceImage     = spaceImage;
            mainMenu.spaceImage = spaceImage;
        }
コード例 #4
0
        private void canvas_CreateResources(
            Microsoft.Graphics.Canvas.UI.Xaml.CanvasAnimatedControl sender,
            Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
        {
            CanvasCommandList cl = new CanvasCommandList(sender);

            using (CanvasDrawingSession clds = cl.CreateDrawingSession())
            {
                canvas.Width             = 600;
                canvas.Height            = 600;
                canvas.TargetElapsedTime = TargetElapsedTime;
            }
        }
コード例 #5
0
 private void canvas1_CreateResources(Microsoft.Graphics.Canvas.UI.Xaml.CanvasAnimatedControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
 {
     cl = new CanvasCommandList(sender);
     using (CanvasDrawingSession clds = cl.CreateDrawingSession())
     {
         clds.DrawText("Demo", new Vector2((float)Frame.Height / 2, (float)Frame.Width / 2), Colors.Red);
         for (int i = 0; i < 100; i++)
         {
             clds.DrawText("Hello, World!", RndPosition(), Color.FromArgb(255, RndByte(), RndByte(), RndByte()));
             clds.DrawCircle(RndPosition(), RndRadius(), Color.FromArgb(255, RndByte(), RndByte(), RndByte()));
         }
     }
 }
コード例 #6
0
        async Task CreateResources(Microsoft.Graphics.Canvas.UI.Xaml.CanvasAnimatedControl sender)
        {
            bombImage = await CanvasBitmap.LoadAsync(sender, "Assets/Image/bomb.jpg");

            flagImage = await CanvasBitmap.LoadAsync(sender, "Assets/Image/flag.jpg");

            questionImage = await CanvasBitmap.LoadAsync(sender, "Assets/Image/Question.png");



            clickSound.Source    = createLocalMedia("Assets/Sound/click.mp3");
            flagSound.Source     = createLocalMedia("Assets/Sound/flag.mp3");
            gameLossSound.Source = createLocalMedia("Assets/Sound/game_loss.mp3");
            hornSound.Source     = createLocalMedia("Assets/Sound/PartyHorn.mp3");
            bruhSound.Source     = createLocalMedia("Assets/Sound/Bruh_Sound_Effect_2.mp3");
        }
 private void Canvas_Create_Resources(Microsoft.Graphics.Canvas.UI.Xaml.CanvasAnimatedControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
 {
 }
コード例 #8
0
ファイル: MainPage.xaml.cs プロジェクト: hunour/uwpgame
        async Task CreateResources(Microsoft.Graphics.Canvas.UI.Xaml.CanvasAnimatedControl sender)
        {
            picture = await CanvasBitmap.LoadAsync(sender, "Assets/breakout.PNG");

            pong.SetPicture(picture);
        }
コード例 #9
0
 private void CanvasAnimatedControl_CreateResources(Microsoft.Graphics.Canvas.UI.Xaml.CanvasAnimatedControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
 {
     args.TrackAsyncAction(CreateResourcesAsync(sender, args).AsAsyncAction());
 }
コード例 #10
0
 void ICanvasBitmapHolder.CreateResources(Microsoft.Graphics.Canvas.UI.Xaml.CanvasAnimatedControl sender,
                                          Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
 {
     args.TrackAsyncAction(CreateResourcesAsync(sender).AsAsyncAction());
 }
コード例 #11
0
 async System.Threading.Tasks.Task CreateResourcesAsync(
     Microsoft.Graphics.Canvas.UI.Xaml.CanvasAnimatedControl sender)
 {
     await LoadBitmaps(sender);
 }
コード例 #12
0
 protected void CanvasAnimatedControl_CreateResources(Microsoft.Graphics.Canvas.UI.Xaml.CanvasAnimatedControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
 {
     sender.TargetElapsedTime = TimeSpan.FromMilliseconds(1000 / 30);
     args.TrackAsyncAction(LoadResources(sender).AsAsyncAction());
 }
コード例 #13
0
        async Task CreateResources(Microsoft.Graphics.Canvas.UI.Xaml.CanvasAnimatedControl sender)
        {
            ballImage = await CanvasBitmap.LoadAsync(sender, "Assets/ball.png");

            pong.setBallImage(ballImage);
        }
コード例 #14
0
 private void BlurCanvas_CreateResources(Microsoft.Graphics.Canvas.UI.Xaml.CanvasAnimatedControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)
 {
     args.TrackAsyncAction(ReflashBackground(sender, CurrentTrack?.PictureUrl).AsAsyncAction());
 }