Possible to make a Live Tile like this?

So I’m working on a game for Windows phone 8…

Currently I have a player pref that stores the total number of stars collected throughout the game.

So I want to have a live tile, that shows the total number of stars collected. Is it possible to make a tile like this?

I have the WP8 Plugin by blowfish studios which gives complete support for live tiles, but I am just not sure how to do this as all I understand about live tiles is that they are a set of images either in cyclic or flip form

Hi PuneetK,

The best way to do this would be using the Flip Template and have your games icon as the image, and then update the text every time you unlock a star. You could set the text to something like “You have collected X stars!”. Then on the live tile, it will show your games icon and then flip over to the back and show the text.

Take a look at http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202948(v=vs.105).aspx to see an example of the flip template and what it would look like.

-Kyle

thanks Kyle! I’ll check it out

Also another problem is that in your WP example I’m not able to get the IAP sample to run, it gives an error on the mobile.
So lets say I have a game, and I want levels 5 onwards to be unlocked only after I made an IAP

Please provide me some sample code to do the same by using your plugin. Thanks!

Kyle! Thanks for that I got it to work =)

Only thing is, I don’t want to load my tile images from the internet. I’m trying to load it locally (either directly from Unity, or from my VS asset folder). Not sure how exactly that will work

Hi PuneetK,

For the first issue with the IAP - you need to set up the app as a Beta app on the Windows Phone 8 store before IAP will work. You must also set up some actual IAP purchases that match up to the name used in the app. Look at the comments in WP8SampleGUI.cs (Line 128 at the IAP Buy Item button).

As for the tile images being loaded locally, set the URL to something like this:

appdata:/Assets/LiveTiles/11.png

That should do the trick (Assets = the Unity project assets directory).

-Kyle

Thanks! I went crazy yesterday… trying all sorts of ways to reference locally but none worked. I hope adding appdata works!

For the IAP. Im actually interested only in the isTrial. Provide something to help me on that

Kyle,

Solved the live tile Issue thanks a lot!

Please reply ASAP and let me know how to set up my trial version for my game and also what exact code I’d have to write in Unity for it.

Thanks a lot.

Trial version is very simple to use - something like this:

void LoadLevel(int levelNumber)
{
    if(levelNumber >= 5  WP8Goodies.IAP.IsTrial())
    {
        //Trying to load level 5 or higher, but it is a trial - don't proceed
        WP8Goodies.MessageBox.Show("Purchase the full game to play this level!", "Purchase Needed", false);
    }
    else
    {
        //You have purchased the game, or you are loading level 1-4, proceed
        //Loading code goes here
    }
}

Buddy listen, does appdata:/ path go to the Assets folder of Unity, or the Visual Studio solution?

I had thought I got it to work when I tested the same image for all flip tiles, but now when I put in the actual images, they aren’t seeming to load. The flip “content” is loading, but the images aren’t.

When I set them in Visual Studio’s assets folder, it loads the large (wide) image, and the small image, but not the medium (square) one.

Also, the front tiles are being loaded from my VS folder. But if I keep the backtiles there, it doesnt use them in the game.

Is there a specific naming scheme for the tile images?

The path appdata:/Assets/ goes to the Unity assets directory as I already mentioned. It won’t behave any differently for small, medium, wide, back front any image will all behave in the same way. If it is not loading the image for a certain image type then you should check that the file name is correct and the file exists, and also that the file format and size is correct, it should be the correct dimensions, file type, and file size.

Take another look at the url I posted - http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202948(v=vs.105).aspx - it has details on the file sizes that should be used for each tile position, as well as guides for how to make the tile look its best.

Hope this helps,

-Kyle

Everything is the way it should be.
I’ve named my Unity folder as WpTiles, and the visual studio folder is Tiles.
If I reference Wptiles, I dont get any image on any of the tiles.
If I reference Tiles, I get the same exact images from the VS solution.

Could you please verify that it refers to the unity tiles folder?

EDIT:
Here is the code I am using

I did some tests and here’s what I found…

  1. If I turn off my script for the LiveTile, it will take only the small and medium tile from the VS folder, for the front tile
  2. If I turn on my script and reference it to WPTiles, none of the tiles will have images, but it will flip, and display text as expected.
  3. If I turn on script and reference to “appdata:/Assets/Tiles/__.png” it will load the images from VS solution, but only the front images, but it will flip properly. But the back images don’t show up, just the text.

Hi PuneetK,

Thats intersting - it worked for me previously and for others have got it working so not sure why its not working for you. Firstly, are you certain you don’t have any typos in the file names? In the code you copied, one of the back tiles has a lower case “WpTiles” and the rest are all uppercase “WPTiles”. Double check that to make sure it all matches.

Secondly, you won’t be able to use a Large tile until you enable it in the Visual Studio manifest settings for the project.

Thirdly, try just using images by URL as a test to see if they are all showing up at all - just point them to a small image, google logo or anything on the web publicly available. Then run it and see which tiles get the image. Note that it can take a bit of time to download the image before it is displayed - you should remove the live tile fully, then run the new test with URL’s being used.

-Kyle

Alright, tried some more stuff. Ultimately, the only way to make it work, is to reference to “appdata:/Tiles/__.png”
And it will only work for the images which are named in the default sense (that is, “FlipCycleTileMedium.png”)

I tested this by naming my square tile as “FlipCycleTileSquare.png” in VS and referenced to it in my Unity Script. The rest of the (front) tiles worked, except the Square one.
I then renamed the Square tile to the default name of “FlipCycleTileMedium.png” in VS and voila! It worked.

So, right now the easiest way for me is to name the back tiles in Visual Studio according to Microsoft’s default nomenclature.
I tried a few different file names but none seem to work.

So could you please do the following
a) Look into your plugin and see what’s wrong
b) Let me know the default name for the back tiles in Visual Studio, so I can try out that option
c) Let me know if I have to do any setting changes in VS to make sure everything will work fine, as my VS project file is completely untouched except for the images

Hi PuneetK,

I apologise - I was wrong with where appdata: was pointing, it is in the Visual Studio project Asset folder, not the Unity Assets folder. So to get the images loading correctly:

  • Keep your code as it is posted above linking to appdata:/Assets/buttons/WPTiles/***
  • Build the project in unity, then open up the WP8 solution in Visual Studios
  • In the Solution Explorer, create a new folder under Assets called buttons, and another folder under that calls WPTiles (So you will have Assets/buttons/WPTiles/. By default it will create Assets/Tiles and have a few images in there)
  • Copy your 5 images into that folder (named exactly as you have specified in code)
  • Select all 5 images and in the Properties window change the setting for Copy to Output Directory to equal Copy if newer
  • Build the game and make sure the images are working

Let me know if this is still not working for you.

-Kyle

Hi Kyle!

So, yes, the new method did work. And I strongly suggest you add it into your Plugin Documentation. Add another step in there to right click on project and “show all folders in solution”. It took me a while to figure that out so that I could view all the images/folders.

Some more questions regarding your plugin:

  1. I’ve built my file, and uploaded to Microsoft dev center as a beta app. But I’m unable to test the isTrial feature from a beta version. What do you suggest I do in order to test the istrial? I’ve tested my code with a local boolean instead of isTrial, and it works fine without any errors. But I want to test an actual instore version. So tell me what to do.

  2. Is there any way to change the options of “OK” and “Cancel” on the Message boxes to something like “Not Now” or “Maybe Later?”

Hi PuneetK,

  1. Unfortunately there is no way to test this in a real environment nicely - the best you can do is as you have mentioned and just returning a local boolean value of ‘true’ for isTrial. The only alternative is to submit it to the store but choose the option Hidden so people cannot search for it until you are ready to officially release it. See http://blogs.windows.com/windows_phone/b/wpdev/archive/2013/11/27/options-for-publishing-windows-phone-beta-apps-and-testing-in-app-purchase.aspx for the blog post that details this option.

  2. The built in functionality provided by Microsoft for message boxes only allows for OK and Cancel. There are some custom-made boxes that allow for any text to be entered, but at this point there are no plans to integrate one of those solutions into this plugin.

-Kyle

Kyle,

Have implemented whatever I wanted for the most part, but still stuck on a few things, and am currently just hacking around to get them to work.

  1. I want to prompt the user to Review my app only if he hasn’t reviewed it already. Is there a way to check this? Possibly a boolean or something.
  2. Is there a function I can call, on message box cancel button press?
  1. No, there is no way of knowing if the user has reviewed your app. The best you can do is track if you have shown them the request for a review, and dont show it again. For this feature you would have to request it from Microsoft directly, as it is not available to developers.

  2. What exactly do you mean by this? There is an event that gets fired, WP8Goodies.MessageBox.OnMessageBoxButtonSelected, which can be used to identify what button was pressed (will return true if user pressed OK, or false if they pressed Cancel / back button).

Oh, it gives false if they pressed cancel? I thought it’s false as long as you don’t press ok.