Пример #1
0
    //Path filePath = Application.persistentDataPath;



    void Awake()
    {
        if (_This == null)
        {
            _This = this;
        }
        InitializeGame();
    }
Пример #2
0
    //SerializedProperty fileNameProperty;
    //SerializedProperty playerDataProperty;

    private void OnEnable()
    {
        filePath = Application.dataPath + gameDataProjectFilePath;
        //fileNameProperty = serializedObject.FindProperty("dataFileName");
        //playerDataProperty = serializedObject.FindProperty("playerData");

        PlayerDataHandler dataHandler = (PlayerDataHandler)target;

        playerData = dataHandler.playerData;
    }
Пример #3
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Пример #4
0
	protected IEnumerator ChangePlayerData(Player.CharacterClass role, int amount, PlayerDataHandler DataHandler, AWebCoroutine handler)
	{
		while(GameManager.worldData == null){
			WWW www2 = WWWX.Get(WebRequests.urlGetWorld, WebRequests.authenticatedParameters);
			while(!www2.isDone){www2 = WWWX.Get(WebRequests.urlGetWorld, WebRequests.authenticatedParameters);}
			GameManager.worldData = JSONDecoder.Decode<WorldData>(www2.text);
		}
		
		//string url = WebRequests.urlGetUserPlayerId(GameManager.worldData.GetUserIdFromRole(role),GameManager.worldData.GetPlayerIdFromRole(role));
		string url = WebRequests.urlGetUserPlayers(GameManager.worldData.GetUserIdFromRole(role));
		
		WWW www = WWWX.Get(url,WebRequests.authenticatedGodModeParameters);
		while(!www.isDone) {
			yield return www;
		}
		Debug.Log(www.text);
		//Does not contains balance and pending balance.....check wat server returns
		
		//Get the specific role we want
		PlayersData playersData = JSONDecoder.Decode<PlayersData>(www.text);
		PlayerData data = playersData.GetPlayerWithWorldId(GameManager.worldData.id);
		
		//Adjust the balance
		DataHandler(ref data,amount);
	
		string json = "{\"player\":{\"balance\":" + data.balance +",\"pending_balance\":" + data.pending_balance +"}}";
		
		Debug.Log(json);
		Debug.Log(WebRequests.urlGetUserPlayerId(data.user_id,data.id));
		
		www = WWWX.Put(WebRequests.urlGetUserPlayerId(data.user_id,data.id),json,WebRequests.authenticatedGodModeParameters);
		while(!www.isDone) {
			yield return 0;
		}
		
		//Conclude the Put
		IEnumerator e = ConcludePut(handler); 
		yield return e.Current;
		while(e.MoveNext()) yield return e.Current;
		
		
	}
Пример #5
0
 public void Init()
 {
     m_PlayerDataHandler = new PlayerDataHandler();
     m_PlayerDataHandler.Init();
 }