Exemplo n.º 1
0
 public static ExternalResources getInstance()
 {
     if (_instance == null)
     {
         _instance = new ExternalResources();
     }
     return(_instance);
 }
Exemplo n.º 2
0
        //----------------------------------------------------------
        // UTILS // UTILS // UTILS // UTILS // UTILS // UTILS //
        //----------------------------------------------------------
        private IEnumerator startRequest(BaseRequestModel requestModel)
        {
            _currentRequestModel = requestModel;
            requestModel.OnRequestStart();

            //torna a chamada assincrona
            yield return(new WaitForSeconds(0.2f));

            if (RequestHelper.platformModeOn)
            {
                Application.ExternalCall("sendToFlash", requestModel.functionName, requestModel.cvo.getJsonData());
            }
            else
            {
                //verifico se a request foi cadastrada
                if (_currentRequestModel is GetMinigameRankingRM == false && _currentRequestModel is GetPlatformDataRM == false &&
                    _currentRequestModel is GetPlayerHistoryRM == false && _currentRequestModel is SavePlayerScoreRM == false)
                {
                    string error = "Request not registered";
                    Debug.LogError(this.GetType() + error);
                    OnRequestError(error);
                }
                else
                {
                    if (_currentRequestModel is GetMinigameRankingRM)
                    {
                        OnRequestError("Request available only for minigames integrated with the platform");
                    }
                    else if (_currentRequestModel is GetPlatformDataRM)
                    {
                        OnRequestSuccess("{" +
                                         createField("idUser", "-1", true) +
                                         createField("idMinigame", "-1", true) +
                                         createField("nickName", "null", true) +
                                         createField("firstName", "null", true) +
                                         createField("lastName", "null", true) +
                                         createField("grade", "-1", true) +
                                         createField("backendUrl", "null", true) +
                                         createField("minigameFolder", ExternalResources.getInstance().getResourcesPath() + "../", false) +
                                         "}");
                    }
                    else if (_currentRequestModel is GetPlayerHistoryRM)
                    {
                        OnRequestSuccess(LocalDataManager.getPlayerHistoryJson());
                    }
                    else if (_currentRequestModel is SavePlayerScoreRM)
                    {
                        LocalDataManager.savePlayerScore((_currentRequestModel as SavePlayerScoreRM).cvo);
                        OnRequestSuccess("{}");
                    }
                }
            }
        }
Exemplo n.º 3
0
		public static ExternalResources getInstance()
		{
			if(_instance == null) _instance = new ExternalResources();
			return _instance;
		}