Skip to content

Commit

Permalink
fixed monster activation data
Browse files Browse the repository at this point in the history
estarriol authored and mayjak committed Nov 16, 2020
1 parent bfdf3c0 commit 9eeb24b
Showing 2 changed files with 17 additions and 7 deletions.
9 changes: 8 additions & 1 deletion build.bat
Original file line number Diff line number Diff line change
@@ -31,8 +31,15 @@ echo --- ERROR --- ANDROID_BUILD_TOOLS path not set : please set android bu
exit /B
)

rem set unity editor location
IF "%UNITY_EDITOR_HOME%"=="" SET UNITY_EDITOR_HOME=%ProgramFiles%\Unity\Editor
IF NOT EXIST "%UNITY_EDITOR_HOME%" (
echo --- ERROR --- UNITY_EDITOR_HOME path not set : please set unity editor path in build.bat or create a similar environment variable
exit /B
)

rem you can get NSIS from https://nsis.sourceforge.io/Main_Page
SET PATH=%PATH%;%JDK_HOME%\bin;%ProgramFiles%\Unity\Editor;%ProgramFiles%\7-Zip;%WinDir%/Microsoft.NET/Framework/v4.0.30319;%ProgramFiles(x86)%\NSIS;%~dp0libraries\SetVersion\bin\Release;%ANDROID_BUILD_TOOLS%
SET PATH=%PATH%;%JDK_HOME%\bin;%UNITY_EDITOR_HOME%;%ProgramFiles%\7-Zip;%WinDir%/Microsoft.NET/Framework/v4.0.30319;%ProgramFiles(x86)%\NSIS;%~dp0libraries\SetVersion\bin\Release;%ANDROID_BUILD_TOOLS%
@echo on

rem cleanup
15 changes: 9 additions & 6 deletions unity/Assets/Scripts/Content/ContentLoader.cs
Original file line number Diff line number Diff line change
@@ -14,8 +14,8 @@ public class ContentLoader
new ClassDataLoader(),
new SkillDataLoader(),
new ItemDataLoader(),
new MonsterDataLoader(),
new ActivationDataLoader(),
new MonsterDataLoader(),
new AttackDataLoader(),
new EvadeDataLoader(),
new HorrorDataLoader(),
@@ -108,7 +108,8 @@ void LoadContent(string name, Dictionary<string, string> content, string path, s
{
foreach (var loader in CONTENT_TYPE_LOADERS.Where(l => l.Supports(name)))
{
loader.LoadContent(cd, name, content, path, new List<string> { packID });
var handled = loader.LoadContent(cd, name, content, path, new List<string> { packID });
if (handled) break;
}
}
}
@@ -118,32 +119,34 @@ public interface IContentLoader
{
bool Supports(string name);

void LoadContent(ContentData cd, string name, Dictionary<string, string> content, string path, List<string> sets);
bool LoadContent(ContentData cd, string name, Dictionary<string, string> content, string path, List<string> sets);
}

public abstract class ContentLoader<T> : IContentLoader where T : IContent
{
public bool Supports(string name)
public virtual bool Supports(string name)
{
return name.StartsWith(TypePrefix);
}

public void LoadContent(ContentData cd, string name, Dictionary<string, string> content, string path,
public bool LoadContent(ContentData cd, string name, Dictionary<string, string> content, string path,
List<string> sets)
{
T t = Create(name, content, path, sets);

if (string.IsNullOrWhiteSpace(t?.SectionName))
{
ValkyrieDebug.Log($"Ignored invalid entry {name}");
return;
return false;
}

var isNew = cd.AddContent(name, t);
if (isNew && AdditionalTranslation)
{
t.Sets.ForEach(id => LocalizationRead.RegisterKeyInGroup(t.TranslationKey, id));
}

return true;
}

protected virtual bool AdditionalTranslation { get; } = false;

0 comments on commit 9eeb24b

Please sign in to comment.