Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Author Topic: Opening AppStore from WME Lite (iOS feature only)  (Read 8848 times)

0 Members and 1 Guest are viewing this topic.

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Opening AppStore from WME Lite (iOS feature only)
« on: April 04, 2012, 07:32:00 PM »

Hi muties,

WME lite has a built in capability of in-app purchases. However our publisher decided that they wanted to have two separate version when the lite would open the full version in app store for purchase. For that reason I had to do some modification to sources and I hope Mnemonic will add them to the main build. :wink: :wink:

Without much ado:

changes to ios_utils.h (bold)

Code: WME Script
  1.  
  2.  
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6.        
  7.         void IOS_GetDataDir(char* buffer);
  8.         void IOS_ShowStatusLine(int show);
  9.         void IOS_GetDeviceType(char* buffer);
  10.         void IOS_OpenAppleStore(char* ID); // this has been added by me
  11.  
  12. #ifdef __cplusplus
  13. }
  14. #endif
  15.  

changes to ios_utils.m

Code: WME Script
  1. void IOS_OpenAppleStore(char* ID)
  2. {
  3.    
  4.     NSString* nsId = [[NSString alloc] initWithCString: ID];
  5.    
  6.     NSString* targetString = @"itms-apps://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=";
  7.     targetString = [[targetString stringByAppendingString: nsId] stringByAppendingString:@"&mt=8"];
  8.    
  9.     [nsId release];
  10.    
  11.     [[UIApplication sharedApplication] openURL:[NSURL URLWithString: targetString ]];
  12.  
  13.    
  14. }
  15.  
  16.  

changes to AdGame.cpp

Code: WME Script
  1. // this will need to be added to CAdGame::ScCallMethod if else blocks
  2.  
  3.     else if (strcmp(Name,"OpenAppleStore") == 0) {
  4.         Stack->CorrectParams(1);
  5.         char* AppleStoreId = Stack->Pop()->GetString();
  6.         IOS_OpenAppleStore(AppleStoreId);
  7.         Stack->PushNULL();
  8.         return S_OK;
  9.     }
  10.  
  11.  
  12.  

Also the same file needs to have:

#include "ios_utils.h"

at the top.


The usage in the actual scripts is simple:

Game.OpenAppleStore("123456789"); where the number is your application apple store id.

Hope this helps to someone. :)
« Last Edit: April 05, 2012, 12:05:06 AM by metamorphium »
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet
 

Page created in 0.04 seconds with 25 queries.