Skip to content

Instantly share code, notes, and snippets.

@Zerophase
Created December 23, 2016 03:07
Show Gist options
  • Save Zerophase/5c5ff70bf7b02e1a34b6ab264bf8a6b3 to your computer and use it in GitHub Desktop.
Save Zerophase/5c5ff70bf7b02e1a34b6ab264bf8a6b3 to your computer and use it in GitHub Desktop.
DialogueClass::DialogueClass()
{
id = TEXT("0x01000001000000DC");
dialogues.Emplace(TEXT("0x01000001000000D4"), FDialogueNode(
LOCTEXT("Dialogue0","Text goes here"), MakeTArray<FName>(TEXT("0x01000001000000EB"))));
gameTime = new GameTime(); // fake implementation till observer implemented
Lambda c_0 = [this](void)->FName{ return (gameTime->Hour() < 19) ? TEXT("0x01000001000000D4") : TEXT("0x01000001000000E2"); };
dialogues.Emplace(TEXT("0x01000001000000DC"), FDialogueNode(c_0));
dialogues.Emplace(TEXT("0x01000001000000E2"), FDialogueNode(
LOCTEXT("Dialogue1","Text goes here"), MakeTArray<FName>(TEXT("0x01000001000000EB"))));
dialogues.Emplace(TEXT("0x01000001000000EB"), FDialogueNode(
LOCTEXT("Dialogue2","Text goes here"), MakeTArray<FName>(TEXT("0x01000001000000F3"))));
dialogues.Emplace(TEXT("0x01000001000000F3"), FDialogueNode(
LOCTEXT("Dialogue3","Text goes here"), MakeTArray<FName>(TEXT("0x0100000100000100"),TEXT("0x0100000100000106"),TEXT("0x010000010000011F"))));
dialogues.Emplace(TEXT("0x0100000100000100"), FDialogueNode(
LOCTEXT("Dialogue4","Text goes here"), MakeTArray<FName>(TEXT("0x0100000100000111"))));
dialogues.Emplace(TEXT("0x0100000100000106"), FDialogueNode(
LOCTEXT("Dialogue5","Text goes here"), MakeTArray<FName>(TEXT("0x0100000100000118"))));
dialogues.Emplace(TEXT("0x0100000100000111"), FDialogueNode(
LOCTEXT("Dialogue6","Text goes here"), MakeTArray<FName>(TEXT("0x010000010000011F"),TEXT("0x0100000100000106"),TEXT("0x0100000100000158"))));
dialogues.Emplace(TEXT("0x0100000100000118"), FDialogueNode(
LOCTEXT("Dialogue7","Text goes here"), MakeTArray<FName>(TEXT("0x010000010000019D"))));
dialogues.Emplace(TEXT("0x010000010000011F"), FDialogueNode(
LOCTEXT("Dialogue8","Text goes here"), MakeTArray<FName>(TEXT("0x0100000100000127"))));
dialogues.Emplace(TEXT("0x0100000100000127"), FDialogueNode(
LOCTEXT("Dialogue9","Text goes here"), MakeTArray<FName>(TEXT("0x010000010000012E"))));
dialogues.Emplace(TEXT("0x010000010000012E"), FDialogueNode(
LOCTEXT("Dialogue10","Text goes here"), MakeTArray<FName>(TEXT("0x0100000100000136"))));
dialogues.Emplace(TEXT("0x0100000100000136"), FDialogueNode(
LOCTEXT("Dialogue11","Text goes here"), MakeTArray<FName>(TEXT("0x01000001000001AF"))));
dialogues.Emplace(TEXT("0x0100000100000158"), FDialogueNode(
LOCTEXT("Dialogue12","Text goes here"), MakeTArray<FName>(TEXT("0x0100000100000160"))));
dialogues.Emplace(TEXT("0x0100000100000160"), FDialogueNode(
LOCTEXT("Dialogue13","Text goes here"), MakeTArray<FName>(TEXT("0x0100000100000167"))));
dialogues.Emplace(TEXT("0x0100000100000167"), FDialogueNode(
LOCTEXT("Dialogue14","Text goes here"), MakeTArray<FName>(TEXT("0x010000010000016E"))));
dialogues.Emplace(TEXT("0x010000010000016E"), FDialogueNode(
LOCTEXT("Dialogue15","Text goes here"), MakeTArray<FName>(TEXT("0x0100000100000175"))));
dialogues.Emplace(TEXT("0x0100000100000175"), FDialogueNode(
LOCTEXT("Dialogue16","Text goes here"), MakeTArray<FName>(TEXT("0x0100000100000180"))));
dialogues.Emplace(TEXT("0x0100000100000180"), FDialogueNode(
LOCTEXT("Dialogue17","Text goes here"), MakeTArray<FName>(TEXT("0x0100000100000187"))));
dialogues.Emplace(TEXT("0x0100000100000187"), FDialogueNode(
LOCTEXT("Dialogue18","Text goes here"), MakeTArray<FName>(TEXT("0x010000010000018F"))));
dialogues.Emplace(TEXT("0x010000010000018F"), FDialogueNode(
LOCTEXT("Dialogue19","Text goes here")));
dialogues.Emplace(TEXT("0x010000010000019D"), FDialogueNode(
LOCTEXT("Dialogue20","Text goes here"), MakeTArray<FName>(TEXT("0x01000001000001A4"))));
dialogues.Emplace(TEXT("0x01000001000001A4"), FDialogueNode(
LOCTEXT("Dialogue21","Text goes here")));
dialogues.Emplace(TEXT("0x01000001000001AF"), FDialogueNode(
LOCTEXT("Dialogue22","Text goes here"), MakeTArray<FName>(TEXT("0x01000001000001B7"))));
dialogues.Emplace(TEXT("0x01000001000001B7"), FDialogueNode(
LOCTEXT("Dialogue23","Text goes here"), MakeTArray<FName>(TEXT("0x01000001000001BF"))));
dialogues.Emplace(TEXT("0x01000001000001BF"), FDialogueNode(
LOCTEXT("Dialogue24","Text goes here")));
}
DialogueClass::DialogueClass()
{
var db = new SomeDb(); // The actual code would look way different, but essentially be doing this
// before this get relevant table for dialogue this dialogue
// and only loop through table ids referencing this dialogue
for(int i = 0; i != db.TextTable.count; ++i) // iterate through rows
{
string nodeId = db.table[i].nodeId;
string textId = db.table[i].textId;
string text = db.table[i].text;
string nextNodeIds = db.table[i].nextNodeIds; // might have separate table for these
dialogues.Emplate(TEXT(nodeId), FDialogueNode(
LOCTEXT(textId, text), ConvertToArray(nextNodeIds))); // This could be massaged to handle everything except for lambdas.
}
// For lambda table / table holding binary data
for(int i = 0; i != db.LambdaTable.count; ++i)
{
string nodeId = db.LambdaTable[i].nodeId;
Lambda c = UnMarshal(db.LambdaTable[i].lambda);
dialogues.Emplace(nodeId, FDialogueNode(c));
}
}
TArray<FName> DialogueClass::ConvertToArray(string nextNodeIds)
{
// convert "," separated list to array
// ...
return nextNodeIdArray;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment