refactor: Converted message data to its own struct
This commit is contained in:
parent
1fc809141c
commit
9dd340eeb7
10 changed files with 339 additions and 18 deletions
18
Assets/Scripts/Messaging/MessageData/MessageData.cs
Normal file
18
Assets/Scripts/Messaging/MessageData/MessageData.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Messaging.MessageData {
|
||||
public struct MessageData {
|
||||
public KeyValuePair<string, string> QuestionMessage;
|
||||
public KeyValuePair<string, string> AnswerMessage;
|
||||
|
||||
public MessageData(string text) {
|
||||
string[] jokeParts = text.Split(':');
|
||||
|
||||
string[] question = jokeParts[0].Split('|');
|
||||
string[] answer = jokeParts[1].Split('|');
|
||||
|
||||
QuestionMessage = new KeyValuePair<string, string>(question[0], question[1]);
|
||||
AnswerMessage = new KeyValuePair<string, string>(answer[0], answer[1]);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue