Sending a list of infortion/items
Options
Comments
-
would something like this work?
var response = new OperationResponse((byte)OperationCode.SendItems, New Dictionary<byte, List<armor> { // add the list to the data code here });
0 -
Why not try to do it0
-
Armor is not immediately supported as data type, so it can't be sent, unless you register de/serialization methods for this type first. I will ask a colleague to supply the method names for this.
Also, a List is not directly supported but you can simply convert the list into an array and send that.0 -
Okay, I'll look the documentation on how to send an array after converting the list.
@xzlxt720 - The reason I didn't want to try it first is because I just finally fixed all the errors on my server and did not want to create even more errors.
I've been messing around and so far came up with this before the reply.var acc = new OperationResponse((byte)OperationCode.EditorList, new Dictionary<byte, object> { {(byte)DataCode.Editor, editor}, {(byte)DataCode.EditorList, Lists.accessory} }); peer.SendOperationResponse(acc, parameters);
Only thing is I'm having trouble figuring out how to accept the list on the client side and i'm not sure if all the data is getting sent from the list.0 -
var dict_head = new Dictionary<byte, object> { {(byte)DataCode.Attack, 100}, {(byte)DataCode.Defence, 100} } var dict_hand = new Dictionary<byte, object> { {(byte)DataCode.Attack, 100}, {(byte)DataCode.Defence, 100}, {(byte)DataCode.Other, 100} } var dict_armour = new Dictionary<byte, object> { {(byte)DataCode.Armour_Head, dict_head}, {(byte)DataCode.Armour_Hand, dict_hand} } var armours.Add(dict_armour) var dict = new Dictionary<byte, object> { {(byte)DataCode.Armour, armours.ToArray()} } var acc = new OperationResponse((byte)OperationCode.EditorList, dict); peer.SendOperationResponse(acc, parameters);
maybe it looks like this ,does it right?0 -
Okay i understand to send them as an array but how would I add them to the list on via client side?0
-
Is it the same as you do on the server side?0
-
crzyone9584: "how would I add them to the list on via client side"?! I don't understand where you're stuck.0