Skip to content

Commit

Permalink
Stub location names internal string table
Browse files Browse the repository at this point in the history
  • Loading branch information
Interkarma committed Nov 25, 2022
1 parent 56bf64c commit 934062e
Show file tree
Hide file tree
Showing 11 changed files with 129 additions and 0 deletions.
Expand Up @@ -42,6 +42,11 @@ MonoBehaviour:
m_ReadOnly: 1
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 5e11afb33a5de7543b2b1594675da1aa
m_Address: Assets/Localization/StringTables/Internal_Locations Shared Data.asset
m_ReadOnly: 1
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
m_ReadOnly: 1
m_Settings: {fileID: 11400000, guid: d18e8e9fddb22f341a7e4df0a26a67e2, type: 2}
m_SchemaSet:
Expand Down
Expand Up @@ -30,6 +30,12 @@ MonoBehaviour:
m_SerializedLabels:
- Locale-en
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 78311872af2509a4fbe824adf6323f64
m_Address: Internal_Locations_en
m_ReadOnly: 1
m_SerializedLabels:
- Locale-en
FlaggedDuringContentUpdateRestriction: 0
m_ReadOnly: 1
m_Settings: {fileID: 11400000, guid: d18e8e9fddb22f341a7e4df0a26a67e2, type: 2}
m_SchemaSet:
Expand Down
@@ -0,0 +1,32 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5b11a58205ec3474ca216360e9fa74a8, type: 3}
m_Name: Internal_Locations Shared Data
m_EditorClassIdentifier:
m_TableCollectionName: Internal_Locations
m_TableCollectionNameGuidString: 5e11afb33a5de7543b2b1594675da1aa
m_Entries:
- m_Id: 114539380736
m_Key: exampleOnly
m_Metadata:
m_Items: []
m_Metadata:
m_Items: []
m_KeyGenerator:
id: 0
references:
version: 1
00000000:
type: {class: DistributedUIDGenerator, ns: UnityEngine.Localization.Tables,
asm: Unity.Localization}
data:
m_CustomEpoch: 1669341787994

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions Assets/Localization/StringTables/Internal_Locations.asset
@@ -0,0 +1,21 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5be51871efa6c3e4eae1703925c8f5ac, type: 3}
m_Name: Internal_Locations
m_EditorClassIdentifier:
m_SharedTableData: {fileID: 11400000, guid: 5e11afb33a5de7543b2b1594675da1aa, type: 2}
m_Tables:
- {fileID: 11400000, guid: 78311872af2509a4fbe824adf6323f64, type: 2}
m_Extensions: []
m_Group: String Table
references:
version: 1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions Assets/Localization/StringTables/Internal_Locations_en.asset
@@ -0,0 +1,26 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e9620f8c34305754d8cc9a7e49e852d9, type: 3}
m_Name: Internal_Locations_en
m_EditorClassIdentifier:
m_LocaleId:
m_Code: en
m_SharedData: {fileID: 11400000, guid: 5e11afb33a5de7543b2b1594675da1aa, type: 2}
m_Metadata:
m_Items: []
m_TableData:
- m_Id: 114539380736
m_Localized: EXAMPLE ONLY
m_Metadata:
m_Items: []
references:
version: 1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Assets/Scripts/DaggerfallUnityEnums.cs
Expand Up @@ -773,6 +773,7 @@ public enum TextCollections
TextBOK,
TextFlats,
TextQuests,
TextLocations,
}

/// <summary>
Expand Down
4 changes: 4 additions & 0 deletions Assets/Scripts/Editor/TextManagerEditor.cs
Expand Up @@ -48,12 +48,14 @@ void DisplayGUI()
var runtimeRSCStrings = Prop("runtimeRSCStrings");
var runtimeBOKStrings = Prop("runtimeBOKStrings");
var runtimeFlatStrings = Prop("runtimeFlatStrings");
var runtimeLocationsStrings = Prop("runtimeLocationsStrings");

var tableCopyOverwriteTargetStringTables = Prop("tableCopyOverwriteTargetStringTables");
var tableCopyTargetInternalStrings = Prop("tableCopyTargetInternalStrings");
var tableCopyTargetRSCStrings = Prop("tableCopyTargetRSCStrings");
var tableCopyTargetBOKStrings = Prop("tableCopyTargetBOKStrings");
var tableCopyTargetFlatStrings = Prop("tableCopyTargetFlatStrings");
var tableCopyTargetLocationStrings = Prop("tableCopyTargetLocationStrings");

EditorGUILayout.Space();
EditorGUILayout.LabelField("Live String Tables", EditorStyles.boldLabel);
Expand All @@ -63,6 +65,7 @@ void DisplayGUI()
runtimeRSCStrings.stringValue = EditorGUILayout.TextField("RSC Strings", runtimeRSCStrings.stringValue);
runtimeBOKStrings.stringValue = EditorGUILayout.TextField("BOK Strings", runtimeBOKStrings.stringValue);
runtimeFlatStrings.stringValue = EditorGUILayout.TextField("FLATS.CFG Strings", runtimeFlatStrings.stringValue);
runtimeLocationsStrings.stringValue = EditorGUILayout.TextField("Location Strings", runtimeLocationsStrings.stringValue);
});

EditorGUILayout.Space();
Expand All @@ -73,6 +76,7 @@ void DisplayGUI()
tableCopyTargetRSCStrings.stringValue = EditorGUILayout.TextField("RSC Strings > ", tableCopyTargetRSCStrings.stringValue);
tableCopyTargetBOKStrings.stringValue = EditorGUILayout.TextField("BOK Strings > ", tableCopyTargetBOKStrings.stringValue);
tableCopyTargetFlatStrings.stringValue = EditorGUILayout.TextField("FLATS.CFG Strings > ", tableCopyTargetFlatStrings.stringValue);
tableCopyTargetLocationStrings.stringValue = EditorGUILayout.TextField("Location Strings > ", tableCopyTargetLocationStrings.stringValue);
tableCopyOverwriteTargetStringTables.boolValue = EditorGUILayout.Toggle(new GUIContent("Overwrite String Tables?", "When enabled will copy over existing strings in target string tables."), tableCopyOverwriteTargetStringTables.boolValue);
});

Expand Down
10 changes: 10 additions & 0 deletions Assets/Scripts/Game/TextManager.cs
Expand Up @@ -35,6 +35,7 @@ public class TextManager : MonoBehaviour
public static string defaultInternalBOKCollectionName = "Internal_BOK";
public static string defaultInternalFlatsCollectionName = "Internal_Flats";
public static string defaultInternalQuestsCollectionName = "Internal_Quests";
public static string defaultInternalLocationsCollectionName = "Internal_Locations";

const string localizedTextLookupError = "<LocaleText-NotFound>";
const string textFolderName = "Text";
Expand All @@ -45,13 +46,15 @@ public class TextManager : MonoBehaviour
public string runtimeBOKStrings = defaultInternalBOKCollectionName;
public string runtimeFlatStrings = defaultInternalFlatsCollectionName;
public string runtimeQuestsStrings = defaultInternalQuestsCollectionName;
public string runtimeLocationsStrings = defaultInternalLocationsCollectionName;

// String table copy editor properties
public bool tableCopyOverwriteTargetStringTables = false;
public string tableCopyTargetInternalStrings = null;
public string tableCopyTargetRSCStrings = null;
public string tableCopyTargetBOKStrings = null;
public string tableCopyTargetFlatStrings = null;
public string tableCopyTargetLocationStrings = null;

Dictionary<string, Table> textDatabases = new Dictionary<string, Table>();
Dictionary<string, string[]> cachedLocalizedTextLists = new Dictionary<string, string[]>();
Expand Down Expand Up @@ -265,6 +268,9 @@ private string GetRuntimeCollectionName(TextCollections collection)
case TextCollections.TextQuests:
collectionName = runtimeQuestsStrings;
break;
case TextCollections.TextLocations:
collectionName = runtimeLocationsStrings;
break;
}

return collectionName;
Expand Down Expand Up @@ -292,6 +298,10 @@ private string GetDefaultCollectionName(TextCollections collection)
case TextCollections.TextQuests:
collectionName = defaultInternalQuestsCollectionName;
break;

case TextCollections.TextLocations:
collectionName = defaultInternalLocationsCollectionName;
break;
}

return collectionName;
Expand Down

0 comments on commit 934062e

Please sign in to comment.