private static void ApplyMessageQuestConditionProxyData(MessageQuestCondition messageQuestCondition, string s) { if (messageQuestCondition == null || s == null) { return; } var fields = s.Split(';'); if (fields.Length < 7) { return; } messageQuestCondition.senderSpecifier = (QuestMessageParticipant)SafeConvert.ToInt(fields[0]); messageQuestCondition.senderID = new StringField(fields[1]); messageQuestCondition.targetSpecifier = (QuestMessageParticipant)SafeConvert.ToInt(fields[2]); messageQuestCondition.targetID = new StringField(fields[3]); messageQuestCondition.message = new StringField(fields[4]); messageQuestCondition.parameter = new StringField(fields[5]); var valueType = (MessageValueType)SafeConvert.ToInt(fields[6]); switch (valueType) { case MessageValueType.Int: messageQuestCondition.value = new MessageValue(SafeConvert.ToInt(fields[7])); break; case MessageValueType.String: messageQuestCondition.value = new MessageValue(fields[7]); break; default: messageQuestCondition.value = new MessageValue(); break; } }
public MessageQuestCondition AddMessageCondition(QuestNode node, QuestMessageParticipant senderSpecifier, StringField senderID, QuestMessageParticipant targetSpecifier, StringField targetID, StringField message, StringField parameter, MessageValue value = null) { var condition = MessageQuestCondition.CreateInstance <MessageQuestCondition>(); condition.name = "messageCondition"; condition.senderSpecifier = senderSpecifier; condition.senderID = senderID; condition.targetSpecifier = targetSpecifier; condition.targetID = targetID; condition.message = message; condition.parameter = parameter; condition.value = (value != null) ? value : new MessageValue(); node.conditionSet.conditionList.Add(condition); return(condition); }
private static string GetMessageQuestConditionProxyData(MessageQuestCondition messageQuestCondition) { var valueType = (messageQuestCondition.value != null) ? messageQuestCondition.value.valueType : MessageValueType.None; var s = ((int)messageQuestCondition.senderSpecifier).ToString() + ";" + messageQuestCondition.senderID + ";" + ((int)messageQuestCondition.targetSpecifier).ToString() + ";" + messageQuestCondition.targetID + ";" + messageQuestCondition.message + ";" + messageQuestCondition.parameter + ";" + (int)valueType; switch (valueType) { case MessageValueType.Int: s += ";" + messageQuestCondition.value.intValue; break; case MessageValueType.String: s += ";" + messageQuestCondition.value.stringValue; break; } return(s); }