suriyun-production / turnbase-rpg-docs

This is document for Turnbase RPG project (https://www.assetstore.unity3d.com/#!/content/107578?aid=1100lGeN)
https://suriyun-production.github.io/turnbase-rpg-docs
12 stars 3 forks source link

I need to output an int variable in soft and hard coin. #199

Closed RostislavStoliarchuk closed 1 year ago

RostislavStoliarchuk commented 3 years ago

Which variable in the code is responsible for the number of soft and hard coins? I found this public int rewardSoftCurrency; public int rewardHardCurrency;

and applied this

PlayerPrefs.SetInt ("rewardSoftCurrency", PlayerPrefs.GetInt ("rewardSoftCurrency") + 50);

I want to make a purchase of coins using the blockchain, I have already connected it mainly with the game, I need to make purchases and withdrawals. To do this, I need to either use new coins or find the variables of existing ones in order to be able to make adjustments or + or -

insthync commented 3 years ago

It will be stored as PlayerCurrency into database table, for example, if your game has 2 currencies, soft and hard: it will store similarly to this: [ {"playerId": "A", "dataId":"SOFT", "amount":100}, {"playerId": "A", "dataId":"HARD", "amount":50}, {"playerId": "B", "dataId":"SOFT", "amount":10}, {"playerId": "B", "dataId":"HARD", "amount":150}, ] to database table.

RostislavStoliarchuk commented 3 years ago

Thanks. But I did not understand how to make a request correctly and what is the best method, please tell me. thanks

RostislavStoliarchuk commented 3 years ago

I need to register the function of adding or subtracting coins during the purchase in unity (in my version, cryptocurrency). Which method can I use in my case? Can I use a method like this string SOFT = PlayerPrefs.SetInt ("SOFT", PlayerPrefs.GetInt ("SOFT") + 1);

insthync commented 2 years ago

I don't use player prefs to store save data, I try to explains about how it store save which is actually just uses embedded database (SQLite) for offline games. For online games, it will connect to web service, which has one made by PHP, you know about database?