Дядя Женя
Дядя Женя
CC#
Created by Дядя Женя on 1/12/2024 in #help
Design/Pattern/Architecture help needed
I'm developing a game. In that game every user have a lot of data stored in database on the server. Such as "Gold Currency", "Ruby Currency", "Unlocked Avatars", "Quests Progress", "Rank", "Level", "Collectable Towers Level and Amount" etc. There is ingame shop, for example. In which you can buy things like some amount of collectable towers in exchange for ingame currency. Every action (such as buying something from shop) is done via REST request to backend server. And in order to synchronize data between client and backend, we create response models for each request, that would contain every possible data that could've changed during that request and apply the deltas. Pseudocode example of button in the ingame shop:
ShopBuyResponse response = await Shop.BuyRequest(some, arguments);

Profile.UpdateCurrency(response.currencyDelta);

if (response.towerDelta != null) {
ShowCoolTowerAcquiredAnimation(response.towerDelta);
Profile.UpdateTower(response.towerDelta);
}

// Do some more stuff like add points for quest progress if needed. Quests are client-side for now, sadly
ShopBuyResponse response = await Shop.BuyRequest(some, arguments);

Profile.UpdateCurrency(response.currencyDelta);

if (response.towerDelta != null) {
ShowCoolTowerAcquiredAnimation(response.towerDelta);
Profile.UpdateTower(response.towerDelta);
}

// Do some more stuff like add points for quest progress if needed. Quests are client-side for now, sadly
As seen in the example, this code assumes, that the only thing you can buy in shop is tower and shows the tower acquired animation itself, which is not something I'm ok with. Additionally, it also assumes that we spent some currency at the process. By the way, response.currencyDelta in the example is something like
public class Currency {
public CurrencyType type;
public int amount;
}
public class Currency {
public CurrencyType type;
public int amount;
}
So the problems with this: 1. OnClick button code triggers "tower acquired animation" itself 2. We can only use Currency as price for buying in shop. What if I want to take something else from the player that is not considered Currency type or not to take anything at all 3. We can only buy tower. And I would need to add more code here and in response model to support any other type of item sold in shop
12 replies
CC#
Created by Дядя Женя on 1/1/2024 in #help
Compile .NET project with nuget packages Visual Studio
I want to create .DLL file out of dotnet project, but it uses some Nuget dependencies, which I would like to go to destination folder along with project's compiled DLL. How do I achieve that in Visual Studio?
13 replies