void BuyVirtualItem(string itemId)
    {
        if (itemId != null)
        {
            switch (buyItemWith)
            {
            case BuyMethods.VirtualCurrency:
                if (StoreInventory.CanAfford(itemId))
                {
                    StoreInventory.BuyItem(itemId);
                }
                else
                {
                    Debug.Log("You Dont Have Enough Balance to Buy this Product !");
                }
                break;

            case BuyMethods.Upgrade:
                if (StoreInventory.CanAfford(itemId))
                {
                    StoreInventory.UpgradeGood(itemId);
                }
                else
                {
                    Debug.Log("You Dont Have Enough Balance to Buy this Product !");
                }
                break;

            case BuyMethods.Market:
                SoomlaStore.BuyMarketItem(itemId, "Developer Payload");
                break;
            }
        }
    }
    void Initialize()
    {
        DontDestroyOnLoad(gameObject);

        Application.targetFrameRate = targetFrameRate;

        RestartSessionMetrics();

        // soomla store stuff
        StoreEvents.OnItemPurchased += onItemPurchased;
        StoreEvents.OnRestoreTransactionsFinished += onRestoreTransactionsFinished;
        if (!SoomlaStore.Initialized)
        {
            SoomlaStore.Initialize(new SoomlaStoreAssets());
        }

        gameDataBlob = new GameDataBlob();
        gameDataBlob.Init(saveDataFormatVersion);

        // create generic game service class
#if UNITY_IOS
        gameService = new AppleGameCenterAPI();
        gameService.Initialize();
#endif
#if UNITY_ANDROID
        gameService = new GooglePlayAPI();
#endif
#if UNITY_EDITOR
        gameService = new GameServiceMock();
#endif
        gameService.Initialize();

        // callback is managed in gameService API
        pendingCloudSaveOperation = 1;
    }
    void Start()
    {
        StoreEvents.OnMarketPurchase              += onMarketPurchase;
        StoreEvents.OnMarketRefund                += onMarketRefund;
        StoreEvents.OnItemPurchased               += onItemPurchased;
        StoreEvents.OnGoodEquipped                += onGoodEquipped;
        StoreEvents.OnGoodUnEquipped              += onGoodUnequipped;
        StoreEvents.OnGoodUpgrade                 += onGoodUpgrade;
        StoreEvents.OnBillingSupported            += onBillingSupported;
        StoreEvents.OnBillingNotSupported         += onBillingNotSupported;
        StoreEvents.OnMarketPurchaseStarted       += onMarketPurchaseStarted;
        StoreEvents.OnItemPurchaseStarted         += onItemPurchaseStarted;
        StoreEvents.OnUnexpectedErrorInStore      += onUnexpectedErrorInStore;
        StoreEvents.OnCurrencyBalanceChanged      += onCurrencyBalanceChanged;
        StoreEvents.OnGoodBalanceChanged          += onGoodBalanceChanged;
        StoreEvents.OnMarketPurchaseCancelled     += onMarketPurchaseCancelled;
        StoreEvents.OnRestoreTransactionsStarted  += onRestoreTransactionsStarted;
        StoreEvents.OnRestoreTransactionsFinished += onRestoreTransactionsFinished;

                #if UNITY_ANDROID && !UNITY_EDITOR
        StoreEvents.OnIabServiceStarted += onIabServiceStarted;
        StoreEvents.OnIabServiceStopped += onIabServiceStopped;
                #endif
        SoomlaStore.Initialize(new GameAssets());
    }
    void Start()
    {
        // Register callbacks for Grow Insights before initialization
        HighwayEvents.OnInsightsRefreshFinished += OnInsightsRefreshFinished;

        // Register callbacks for SOOMLA LevelUp before initialization
        LevelUpEvents.OnLevelEnded += OnLevelEnded;

        // Register callbacks for Chartboost events
        SetChartboostEvents();
        Chartboost.cacheInterstitial(CBLocation.LevelComplete);
        Chartboost.cacheRewardedVideo(CBLocation.LevelComplete);


        // Make sure to make this call in your earliest loading scene,
        // and before initializing any other SOOMLA/GROW components
        // i.e. before SoomlaStore.Initialize(...)
        GrowHighway.Initialize();
        GrowInsights.Initialize();

        // Initialize SOOMLA Store & LevelUp
        // Assumes you've implemented your store assets
        // and an initial world with levels and missions
        SoomlaStore.Initialize(new YourStoreAssetsImplementation());
        SoomlaLevelUp.Initialize(WORLD);
    }
        /// <summary>
        /// Starts this instance.
        /// Use this for initialization.
        /// </summary>
        void Start()
        {
            handler = new ExampleEventHandler();

            SoomlaStore.Initialize(new MuffinRushAssets());

            SoomlaProfile.Initialize();

            //levelup
            World mainWorld = WorldGenerator.GenerateCustomWorld();

            SoomlaLevelUp.Initialize(mainWorld);
//			WorldGenerator.Play (mainWorld);

            tImgDirect    = (Texture2D)Resources.Load("SoomlaStore/images/img_direct");
            fgoodDog      = (Font)Resources.Load("SoomlaStore/GoodDog" + fontSuffix);
            fgoodDogSmall = (Font)Resources.Load("SoomlaStore/GoodDog_small" + fontSuffix);
            tLogoNew      = (Texture2D)Resources.Load("SoomlaStore/images/soomla_logo_new");
            tWhitePixel   = (Texture2D)Resources.Load("SoomlaStore/images/white_pixel");
            fTitle        = (Font)Resources.Load("SoomlaStore/Title" + fontSuffix);
            tMuffins      = (Texture2D)Resources.Load("SoomlaStore/images/Muffins");
            fName         = (Font)Resources.Load("SoomlaStore/Name" + fontSuffix);
            fDesc         = (Font)Resources.Load("SoomlaStore/Description" + fontSuffix);
            fBuy          = (Font)Resources.Load("SoomlaStore/Buy" + fontSuffix);
            tBack         = (Texture2D)Resources.Load("SoomlaStore/images/back");
            tGetMore      = (Texture2D)Resources.Load("SoomlaStore/images/GetMore");
            tTitle        = (Font)Resources.Load("SoomlaStore/Title" + fontSuffix);
        }
Exemple #6
0
 public void RestorePurchase()
 {
     if (!SoomlaStore.TransactionsAlreadyRestored())
     {
         SoomlaStore.RestoreTransactions();
     }
 }
Exemple #7
0
        public void Initialize()
        {
            _handler = new CharsooStoreEventHandler();
            CharsooStoreAsset storeAsset = new CharsooStoreAsset();

            SoomlaStore.Initialize(storeAsset);
        }
        /// <summary>
        /// Displays the welcome screen of the game.
        /// </summary>
        void welcomeScreen()
        {
            //drawing background, just using a white pixel here
            GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), tImgDirect);
            //changing the font and alignment the label, and making a backup so we can put it back.
            Font       backupFont      = GUI.skin.label.font;
            TextAnchor backupAlignment = GUI.skin.label.alignment;

            GUI.skin.label.font      = fgoodDog;
            GUI.skin.label.alignment = TextAnchor.MiddleCenter;
            //writing the text.
            GUI.Label(new Rect(Screen.width / 8, Screen.height / 8f, Screen.width * 6f / 8f, Screen.height * 0.3f), "Soomla Store\nExample");
            //select the small font
            GUI.skin.label.font = fgoodDogSmall;
            GUI.Label(new Rect(Screen.width / 8, Screen.height * 7f / 8f, Screen.width * 6f / 8f, Screen.height / 8f), "Press the SOOMLA-bot to open store");
            //set font back to original
            GUI.skin.label.font = backupFont;
            GUI.Label(new Rect(Screen.width * 0.25f, Screen.height / 2 - 50, Screen.width * 0.5f, 100), "[ Your game here ]");
            //drawing button and testing if it has been clicked
            if (GUI.Button(new Rect(Screen.width * 2 / 6, Screen.height * 5f / 8f, Screen.width * 2 / 6, Screen.width * 2 / 6), tLogoNew))
            {
                guiState = GUIState.GOODS;
#if UNITY_ANDROID && !UNITY_EDITOR
                SoomlaStore.StartIabServiceInBg();
#endif
            }
            //set alignment to backup
            GUI.skin.label.alignment = backupAlignment;
        }
//Soomla ------------------------------------------------------------------------------------------------------

    /// Inicializa os Eventos do Soomla e Inicializa o SoomlaStore
    private void StartStoreEvents()
    {
        StoreEvents.OnSoomlaStoreInitialized  += OnSoomlaStoreInitialized;
        StoreEvents.OnItemPurchased           += OnItemPurchased;
        StoreEvents.OnCurrencyBalanceChanged  += onCurrencyBalanceChanged;
        StoreEvents.OnMarketPurchase          += onMarketPurchase;
        StoreEvents.OnMarketPurchaseCancelled += onMarketPurchaseCancelled;

        //Callbacks para teste
        StoreEvents.OnMarketPurchaseStarted       += onMarketPurchaseStarted;
        StoreEvents.OnGoodBalanceChanged          += onGoodBalanceChanged;
        StoreEvents.OnMarketRefund                += onMarketRefund;
        StoreEvents.OnMarketItemsRefreshStarted   += onMarketItemsRefreshStarted;
        StoreEvents.OnMarketItemsRefreshFinished  += onMarketItemsRefreshFinished;
        StoreEvents.OnRestoreTransactionsStarted  += onRestoreTransactionsStarted;
        StoreEvents.OnRestoreTransactionsFinished += onRestoreTransactionsFinished;
        StoreEvents.OnItemPurchaseStarted         += onItemPurchaseStarted;
        StoreEvents.OnGoodEquipped                += onGoodEquipped;
        StoreEvents.OnGoodUnEquipped              += onGoodUnequipped;
        StoreEvents.OnGoodUpgrade         += onGoodUpgrade;
        StoreEvents.OnBillingSupported    += onBillingSupported;
        StoreEvents.OnBillingNotSupported += onBillingNotSupported;

        if (!SoomlaStore.Initialized)
        {
            SoomlaStore.Initialize(new PowliticosStoreAssets(controller.AllVirtualGoods(), controller.powliticos.Length));
        }
        else
        {
            OnSoomlaStoreInitialized();
        }
    }
 void Start()
 {
     SoomlaStore.Initialize(new NinjevadeAssets());
     StoreEvents.OnMarketPurchaseStarted   += onMarketPurchaseStarted;
     StoreEvents.OnMarketPurchaseCancelled += onMarketPurchaseCancelled;
     StoreEvents.OnMarketPurchase          += onMarketPurchase;
 }
Exemple #11
0
 public void StartService()
 {
     if (!hasStarted)
     {
         hasStarted = true;
         SoomlaStore.StartIabServiceInBg();
     }
 }
Exemple #12
0
 public void StopService()
 {
     if (hasStarted)
     {
         SoomlaStore.StartIabServiceInBg();
         hasStarted = false;
     }
 }
Exemple #13
0
 // Use this for initialization
 void Start()
 {
     SoomlaStore.Initialize(new MashinRunAssets());
     StoreEvents.OnMarketPurchaseCancelled += Failed;
     StoreEvents.OnMarketPurchase          += OnMarketPurchase;
     StoreEvents.OnItemPurchased           += Purchased;
     StoreEvents.OnMarketPurchaseCancelled += Canceled;
 }
Exemple #14
0
        public void Awake()
        {
            Instance = this;
            if (Application.loadedLevelName == "map")
            {
                if (GameObject.Find("Canvas").transform.Find("MenuPlay").gameObject.activeSelf)
                {
                    GameObject.Find("Canvas").transform.Find("MenuPlay").gameObject.SetActive(false);
                }
            }
            RestLifeTimer = PlayerPrefs.GetFloat("RestLifeTimer");

//			if(InitScript.DateOfExit == "")
//			print(InitScript.DateOfExit );
            DateOfExit = PlayerPrefs.GetString("DateOfExit", "");

            Gems  = PlayerPrefs.GetInt("Gems");
            Lifes = PlayerPrefs.GetInt("Lifes");

            if (PlayerPrefs.GetInt("Lauched") == 0)
            {    //First lauching
                FirstTime = true;
                Lifes     = CapOfLife;
                Gems      = 5;
                PlayerPrefs.SetInt("Gems", Gems);
                PlayerPrefs.SetInt("Lifes", Lifes);
                PlayerPrefs.SetInt("Lauched", 1);
                PlayerPrefs.SetInt("Music", 1);
                PlayerPrefs.SetInt("Sound", 1);
                PlayerPrefs.Save();
            }

            GameObject.Find("Music").GetComponent <AudioSource>().volume = PlayerPrefs.GetInt("Music");
            SoundBase.Instance.GetComponent <AudioSource>().volume       = PlayerPrefs.GetInt("Sound");

            ReloadBoosts();

            boostPurchased = false;

            if (GameObject.Find("CoreEvents") == null)
            {
                GameObject core = Instantiate(Resources.Load("Soomla/CoreEvents")) as GameObject;
                core.name = "CoreEvents";
                Instantiate(Resources.Load("Soomla/StoreEvents"));
            }
            //StoreEvents.OnSoomlaStoreInitialized += onSoomlaStoreInitialized;
            //StoreEvents.OnCurrencyBalanceChanged += onCurrencyBalanceChanged;
            StoreEvents.OnSoomlaStoreInitialized += onSoomlaStoreInitialized;
            StoreEvents.OnMarketPurchase         += onMarketPurchase;
            try
            {
                SoomlaStore.Initialize(new SoomlaIntegration());
            }
            catch (Exception)
            {
                // throw;
            }
        }
Exemple #15
0
 private void OnEnable()
 {
     // Start Iab Service
     if (this.started)
     {
         SoomlaStore.StopIabServiceInBg();
         this.enabledIab = true;
     }
 }
Exemple #16
0
 private void OnDisable()
 {
     // Stop Iab Service
     if (this.started && this.enabledIab)
     {
         SoomlaStore.StartIabServiceInBg();
         this.enabledIab = false;
     }
 }
Exemple #17
0
    private void Start()
    {
        // Register SOOMLA Store event handlers
        StoreEvents.OnMarketPurchase += MyBehaviour.OnMarketPurchase;

        // Initialize SOOMLA Store
        // Assumes you've implemented your store assets
        SoomlaStore.Initialize(new YourStoreAssetsImplementation());
    }
Exemple #18
0
 void Start()
 {
     SoomlaStore.Initialize(this);
     StoreEvents.OnCurrencyBalanceChanged += onCurrencyBalanceChanged;
     StoreEvents.OnItemPurchased          += onItemPurchased;
     StoreEvents.OnGoodBalanceChanged     += onGoodBalanceChanged;
     StoreEvents.OnMarketPurchase         += onMarketPurchase;
     StoreEvents.OnNotEnoughTargetItem    += onNotEnoughTargetItem;
 }
    // Use this for initialization
    void Start()
    {
        btn = GetComponent <Button>();

        // Initialize AdColony & SOOMLA Store
        InitializeAdColony();
        StoreEvents.OnCurrencyBalanceChanged += onCurrencyBalanceChanged;
        SoomlaStore.Initialize(new YourStoreAssetsImplementation());
    }
    // Use this for initialization
    void Start()
    {
        // Initialize SOOMLA Store
        SoomlaStore.Initialize(new SoomlaAssets());

        // Request banner and interstitial form Admob
        requestNewBanner();
        requestNewInterstitial();
    }
Exemple #21
0
 void Start()
 {
     SoomlaStore.Initialize(new BerryStoreAssets());
     StoreEvents.OnCurrencyBalanceChanged     += onCurrencyBalanceChanged;
     StoreEvents.OnItemPurchased              += onItemPurchased;
     StoreEvents.OnGoodBalanceChanged         += onGoodBalanceChanged;
     StoreEvents.OnMarketPurchase             += onMarketPurchase;
     StoreEvents.OnNotEnoughTargetItem        += onNotEnoughTargetItem;
     StoreEvents.OnMarketItemsRefreshFinished += onMarketItemsRefreshFinished;
 }
Exemple #22
0
    public cIAP(string xml_filename)
    {
        ourIAPAssets = new IAP_Assets();

        parser = new cIAP_Parser();
        StoreEvents.OnSoomlaStoreInitialized += onSoomlaStoreInitialized;
        loadIAPData(xml_filename);
        //inicializar soomla
        SoomlaStore.Initialize(ourIAPAssets);
    }
Exemple #23
0
        void Start()
        {
            PlayerPrefs.GetInt("HasNoAdsBeenBought", 0);
            PlayerPrefs.Save();


            DontDestroyOnLoad(transform.gameObject);                                                                                            //Allows this gameObject to remain during level loads, solving restart crashes
            StoreEvents.OnSoomlaStoreInitialized += onSoomlaStoreIntitialized;                                                                  //Handle the initialization of store events (calls function below - unneeded in this case)
            SoomlaStore.Initialize(new PurchaseCharacters());                                                                                   //Intialize the store
        }
	// Use this for initialization
	void Start () {
        StoreEvents.OnUnexpectedErrorInStore += onUnexpectedErrorInStore;


        SoomlaStore.Initialize(new IABItems());

        if (GameDataManager.ManangerInstance.IsFirstPlay)
            GiveItem();

    }
Exemple #25
0
        void Start()
        {
//				Application.LoadLevel ("test");                                                                                                                         //Load actual scene/
//				DontDestroyOnLoad(transform.gameObject);                                                                                                        //Allows this gameObject to remain during level loads, solving restart crashes
            StoreEvents.OnSoomlaStoreInitialized += onSoomlaStoreIntitialized;

            SoomlaStore.Initialize(new StoreAssets());
            //StoreEvents.OnItemPurchased += onItemPurchased;
            StoreEvents.OnMarketPurchase += onMarketPurchase;
        }
Exemple #26
0
        public override void Load()
        {
            if (Assets == null)
            {
                Logs.Instance.ProcessError("Trying to initialize store without store assets");
                return;
            }

            SoomlaStore.Initialize(Assets);
        }
    // 씬 전환시에 IAB 서비스를 종료하고 이벤트를 해제한다.
    void OnDestroy()
    {
                #if UNITY_ANDROID && !UNITY_EDITOR
        SoomlaStore.StopIabServiceInBg();
                #endif

        StoreEvents.OnSoomlaStoreInitialized  -= OnSoomlaStoreInitialized;
        StoreEvents.OnMarketPurchase          -= OnMarketPurchase;
        StoreEvents.OnMarketPurchaseCancelled -= OnMarketPurchaseCancelled;
    }
Exemple #28
0
    private void ChargeFiveDollars()
    {
        SoomlaStore.BuyMarketItem(NinjevadeAssets.NINJEVADE_499_UNLOCK_ID, "Full Unlock 5");

//		PlayerPrefs.SetInt("hasMadePurchase",1);
//		PlayerPrefs.SetInt("displayThankYou",1);
//		//Google/Apple Payment for $5.00
//		LowerGrass.GetComponent<SpriteRenderer>().sprite = (Sprite)Resources.Load ("LowerGrassThankYou", typeof(Sprite)) as Sprite;
//		DollarAmount.GetComponent<SpriteRenderer>().sprite = (Sprite)Resources.Load ("BLANKButton", typeof(Sprite)) as Sprite;
    }
Exemple #29
0
    // Use this for initialization
    void Start()
    {
        fetchConfig();
        GameData.Instance.versionCode         = int.Parse(versionCode.text.Trim());
        GameData.Instance.playerId            = 1;
        StoreEvents.OnSoomlaStoreInitialized += onSoomlaStoreInitialized;
        SoomlaStore.Initialize(new NumberGameAssets());

        Thread.Sleep(500);
        Application.LoadLevel("MainMenu");
    }
Exemple #30
0
 void Start()
 {
     if (this.gameObject.name == "Initializer")
     {
         SoomlaStore.Initialize(new AppAssets());
         StoreEvents.OnItemPurchased += ShopScript.onItemPurchased;
     }
     else if (this.gameObject.name != "Initializer")
     {
         DontDestroyOnLoad(this.gameObject);
     }
 }