I was looking the client logic and i have a few questions about how the flow of the logic go from client to server, i hope i can explain myself.
Â
For example: I am on CharacterWindow.cs, having code like this :
Â
//Init
public CharacterWindow(Canvas gameCanvas)
{
...
//( A )
mCharacterWindow = new WindowControl(gameCanvas, Strings.Character.title, false, "CharacterWindow");
...
//(B)
mAttackLabel = new Label(mCharacterWindow, "AttackLabel");
mAddAttackBtn = new Button(mCharacterWindow, "IncreaseAttackButton");
mAddAttackBtn.Clicked += _addAttackBtn_Clicked;
...
//Methods
public void Update()
{
...
//(C)
mAttackLabel.SetText(
Strings.Character.stat0.ToString(Strings.Combat.stat0, Globals.Me.Stat[(int) Stats.Attack])
);
Â
In that code, i understand that in (A) it's created a WindowControl from the JSONs of the gui config files we already had on closed source, in (B) is created the label that will render on the screen and in (C) we set the text of the label to a explicit format ( Strings.Combat.stat0) passing the value of the stat of the player( having Globals.Me as a variable from the entity "Player".
Â
There, if i go to Globals.Me.Stat, i find that the class "Player" inherits from the class "Entity" , so Globals.Me.Stat[ (int) stats.attack ] comes from that class.
Â
Now, my questions are:Â
Â
1.- Entity has all the info from the player from the moment it logs in? so i can use the values on that class without having to request every time to the server if the info that i need didn't change?Â
Â
2.-If i want to add a property to the "player" or "entity" classes, i will have to change classes on the server side too?Â
Â
3.- if want that information to save on the database, changing the entities is enough? the code will change the structure of the database or i will have to modify the structure myself on the database?Â
Â
Â
Sorry for asking, i'm debugging and looking at the code, but i'm not very good at socket connection, so it's better to ask too.
Question
davidsaid06
I was looking the client logic and i have a few questions about how the flow of the logic go from client to server, i hope i can explain myself.
Â
For example: I am on CharacterWindow.cs, having code like this :
Â
Â
In that code, i understand that in (A) it's created a WindowControl from the JSONs of the gui config files we already had on closed source, in (B) is created the label that will render on the screen and in (C) we set the text of the label to a explicit format ( Strings.Combat.stat0) passing the value of the stat of the player( having Globals.Me as a variable from the entity "Player".
Â
There, if i go to Globals.Me.Stat, i find that the class "Player" inherits from the class "Entity" , so Globals.Me.Stat[ (int) stats.attack ] comes from that class.
Â
Now, my questions are:Â
Â
1.- Entity has all the info from the player from the moment it logs in? so i can use the values on that class without having to request every time to the server if the info that i need didn't change?Â
Â
2.-If i want to add a property to the "player" or "entity" classes, i will have to change classes on the server side too?Â
Â
3.- if want that information to save on the database, changing the entities is enough? the code will change the structure of the database or i will have to modify the structure myself on the database?Â
Â
Â
Sorry for asking, i'm debugging and looking at the code, but i'm not very good at socket connection, so it's better to ask too.
Â
Â
Â
Â
Â
Â
Â
Â
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now