Windows 8 object and windows 10 Universal export?

Get help using Construct 2

Post » Tue Aug 09, 2016 9:14 pm

Having a few issues and would like to know if the "windows 8" objects functions actually work with "Windows 10 Universal" Export? Or I need to drop back the export to 8.1 Universal.
Some games: https://play.google.com/store/search?q= ... s&hl=en_GB Feel free to show the panda some support, he would appreciate it :)
B
19
S
5
G
1
Posts: 155
Reputation: 1,619

Post » Wed Aug 10, 2016 10:33 am

As of r233, it should work correctly on both, so long as the features are available (e.g. charms were removed from Windows 10, so features relating to that won't work)
Scirra Founder
B
395
S
231
G
88
Posts: 24,367
Reputation: 193,694

Post » Wed Aug 10, 2016 12:08 pm

Excellent, yes I see that the test state is now working.

I have one question though, how do you edit the purchases that are available to test without an equivalent WindowsStoreProxy file so that you can set those prospective purchases to active?

Before in the Windows 8.1 universal export the file WindowsStoreProxy.xml was available to add in these IAP's. Without this I am always getting a return of "purchase finished but product not active"
Some games: https://play.google.com/store/search?q= ... s&hl=en_GB Feel free to show the panda some support, he would appreciate it :)
B
19
S
5
G
1
Posts: 155
Reputation: 1,619

Post » Wed Aug 10, 2016 1:16 pm

And I dont know if this is a bug, but exporting with Test mode it runs fine in VS

However turn off test mode, export and run in VS produces this error.

Image
Some games: https://play.google.com/store/search?q= ... s&hl=en_GB Feel free to show the panda some support, he would appreciate it :)
B
19
S
5
G
1
Posts: 155
Reputation: 1,619

Post » Wed Sep 14, 2016 10:25 pm

In answer to your question about the location of WindowsStoreProxy.xml in Windows 10 apps - it is now dynamically built and available in the packages path.

C:\Users\<username>\AppData\Local\Packages\<app package folder>\LocalState\Microsoft\Windows Store\ApiData\WindowsStoreProxy.xml

After export make sure you build/run visual studio at least once to so the <app package folder> is created. Browse in file explorer to C:\Users\<username>\AppData\Local\Packages\, sort by "Date created" and there it is!

You can then copy that file to the root of your Windows 10 project and it's editable from there.

https://msdn.microsoft.com/en-gb/window ... -purchases

Hope this helps!
B
7
S
2
Posts: 22
Reputation: 529

Post » Mon Nov 21, 2016 10:50 pm

Regarding your problem with Visual Studio crashing when not in "test" mode basically the call to IAP fails and takes out the runtime. I fixed this by altering my non-compressed c2runtime.js so that the calls to the windows IAP are wrapped in try catch statements. Not ideal, but got me through the problem!

Windows8Store.prototype.purchaseProduct = function (product_) {
if (product_ === "app") {
this.purchaseApp();
return;
}
var self = this;

try {
var productLicenses = this.currentApp["licenseInformation"]["productLicenses"];
this.currentApp["requestProductPurchaseAsync"](product_, false).then(
function () {
if (productLicenses["hasKey"](product_) && productLicenses["lookup"](product_)["isActive"]) {
console.log("[Construct 2] Product '" + product_ + "' purchased OK");
if (self.onpurchasesuccess)
self.onpurchasesuccess(product_);
}
else {
console.log("[Construct 2] Product '" + product_ + "' purchase failed (cancelled?)");
if (self.onpurchasefail)
self.onpurchasefail(product_, "failed");
}
},
function (msg) {
console.log("[Construct 2] Product '" + product_ + "' purchase failed: " + msg);
if (self.onpurchasefail)
self.onpurchasefail(product_, msg);
});
} catch (e) {
console.log("[Construct 2] Product '" + product_ + "' purchase failed - server not available");
if (self.onpurchasefail)
self.onpurchasefail(product_, "purchase failed - server not available");
}

};
Windows8Store.prototype.restorePurchases = function () {
};
Windows8Store.prototype.requestStoreListing = function () {
var self = this;
try {
this.currentApp["loadListingInformationAsync"]().then(
function (listing) {
console.log("[Construct 2] Listing information loaded");
self.appName = listing["name"];
self.appFormattedPrice = listing["formattedPrice"];
self.lastProductListings = listing["productListings"];
if (self.onstorelistingsuccess)
self.onstorelistingsuccess();
});
} catch (e) {
if (self.onstorelistingfail)
self.onstorelistingfail();
}

};
B
7
S
2
Posts: 22
Reputation: 529

Post » Sun Dec 18, 2016 3:05 pm

Hi all
@AaronSmithUK
@Ashley

I have same issue as @AaronSmithUK, how i can fix it?
B
12
S
3
Posts: 114
Reputation: 1,432

Post » Sun Dec 18, 2016 3:41 pm

You could apply the try catch fixes I specified in the iap file:
C:\Program Files\Construct 2\exporters\html5\plugins\iap\runtime.js
B
7
S
2
Posts: 22
Reputation: 529

Post » Sun Dec 18, 2016 5:46 pm

@AaronSmithUK

Thank you for answer, but how i can do this? You managed to do it?
B
12
S
3
Posts: 114
Reputation: 1,432

Post » Sun Dec 18, 2016 10:49 pm

Hi, yes it's easy enough. Open C:\Program Files\Construct 2\exporters\html5\plugins\iap\runtime.js - find the function - "Windows8Store.prototype.purchaseProduct" replace it with the version I specified above. Do the same for function: "Windows8Store.prototype.requestStoreListing". You might need to open the file as admin in notepad or whatever editor as it's in the program files. Restart Construct 2, export to Windows - it should export a c2runtime.js with the alterations. Basically it means that when your app runs in Windows (not in test mode) it won't crash and so can pass certification. When it's passed certification and your iap is live, it should work just fine.
B
7
S
2
Posts: 22
Reputation: 529

Next

Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, MikaelS, nahima and 24 guests