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]);
|
||||
}
|
||||
}
|
||||
}
|
3
Assets/Scripts/Messaging/MessageData/MessageData.cs.meta
Normal file
3
Assets/Scripts/Messaging/MessageData/MessageData.cs.meta
Normal file
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a53c45e3eeca441d81be59b5e03893bc
|
||||
timeCreated: 1706365538
|
Loading…
Add table
Add a link
Reference in a new issue