private void LoadConfig()
    {
        _configurationFile = Path.Combine(Paths.SturfeeResourcesAbsolute, Paths.ConfigFile);

        // create the directory, if needed
        if (!Directory.Exists(Paths.SturfeeResourcesAbsolute))
        {
            Directory.CreateDirectory(Paths.SturfeeResourcesAbsolute);
        }

        // create a new config file
        if (!File.Exists(_configurationFile))
        {
            var json = JsonUtility.ToJson(new SturfeeConfiguration
            {
                AccessToken = "N/A"
            });
            File.WriteAllText(_configurationFile, json);
        }

        TextAsset configurationTextAsset = Resources.Load <TextAsset>(Paths.SturfeeResourcesRelative);// _configurationFile);// Paths.SturfeeResourcesAbsolute);

        _config = configurationTextAsset == null ? null : JsonUtility.FromJson <SturfeeConfiguration>(configurationTextAsset.text);

        if (_config != null)
        {
            _apiKey = _config.AccessToken;
            _loadingSubscription = true;
            //CheckSubscription(_apiKey, HandleSubscriptionResult); // validates against the server
            var subscriptionInfo = SturfeeSubscriptionManager.GetSubscriptionInfo(_apiKey); // local
            HandleSubscriptionResult(subscriptionInfo);
        }
    }
Esempio n. 2
0
    private void GetAvailableFeatures(string token)
    {
        var tokenInfo = SturfeeSubscriptionManager.GetSubscriptionInfo(token);

        _currentTier = (Tierlevel)tokenInfo.Tier;
    }