mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-12 20:55:08 +00:00
allow access to other data of entity
This commit is contained in:
parent
dde481c8d8
commit
4b83724079
1 changed files with 44 additions and 29 deletions
|
@ -13,6 +13,7 @@ namespace HeavenStudio
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class DynamicBeatmap
|
public class DynamicBeatmap
|
||||||
{
|
{
|
||||||
|
public static int CurrentRiqVersion = 0;
|
||||||
public float bpm;
|
public float bpm;
|
||||||
|
|
||||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||||
|
@ -24,7 +25,7 @@ namespace HeavenStudio
|
||||||
{"productversion", 000},
|
{"productversion", 000},
|
||||||
{"productsubversion", 0},
|
{"productsubversion", 0},
|
||||||
//file format version
|
//file format version
|
||||||
{"riqversion", 0},
|
{"riqversion", CurrentRiqVersion},
|
||||||
|
|
||||||
// general chart info
|
// general chart info
|
||||||
{"remixtitle", "New Remix"}, // chart name
|
{"remixtitle", "New Remix"}, // chart name
|
||||||
|
@ -96,38 +97,52 @@ namespace HeavenStudio
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
//TODO: do this checking and conversion on load instead of at runtime
|
switch (propertyName)
|
||||||
Minigames.Minigame game = EventCaller.instance.GetMinigame(datamodel.Split(0));
|
|
||||||
Minigames.GameAction action = EventCaller.instance.GetGameAction(game, datamodel.Split(1));
|
|
||||||
Minigames.Param param = EventCaller.instance.GetGameParam(game, datamodel.Split(1), propertyName);
|
|
||||||
var type = param.parameter.GetType();
|
|
||||||
if (DynamicData.ContainsKey(propertyName))
|
|
||||||
{
|
{
|
||||||
var pType = DynamicData[propertyName].GetType();
|
case "beat":
|
||||||
if (pType == type)
|
return beat;
|
||||||
{
|
case "track":
|
||||||
return DynamicData[propertyName];
|
return track;
|
||||||
}
|
case "length":
|
||||||
else
|
return length;
|
||||||
{
|
case "swing":
|
||||||
if (type == typeof(EntityTypes.Integer))
|
return swing;
|
||||||
return (int) DynamicData[propertyName];
|
case "datamodel":
|
||||||
else if (type == typeof(EntityTypes.Float))
|
return datamodel;
|
||||||
return (float) DynamicData[propertyName];
|
default:
|
||||||
else if (type.IsEnum)
|
//TODO: do this checking and conversion on load instead of at runtime
|
||||||
return (int) DynamicData[propertyName];
|
Minigames.Minigame game = EventCaller.instance.GetMinigame(datamodel.Split(0));
|
||||||
else if (pType == typeof(Newtonsoft.Json.Linq.JObject))
|
Minigames.GameAction action = EventCaller.instance.GetGameAction(game, datamodel.Split(1));
|
||||||
|
Minigames.Param param = EventCaller.instance.GetGameParam(game, datamodel.Split(1), propertyName);
|
||||||
|
var type = param.parameter.GetType();
|
||||||
|
if (DynamicData.ContainsKey(propertyName))
|
||||||
{
|
{
|
||||||
DynamicData[propertyName] = DynamicData[propertyName].ToObject(type);
|
var pType = DynamicData[propertyName].GetType();
|
||||||
return DynamicData[propertyName];
|
if (pType == type)
|
||||||
|
{
|
||||||
|
return DynamicData[propertyName];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (type == typeof(EntityTypes.Integer))
|
||||||
|
return (int) DynamicData[propertyName];
|
||||||
|
else if (type == typeof(EntityTypes.Float))
|
||||||
|
return (float) DynamicData[propertyName];
|
||||||
|
else if (type.IsEnum)
|
||||||
|
return (int) DynamicData[propertyName];
|
||||||
|
else if (pType == typeof(Newtonsoft.Json.Linq.JObject))
|
||||||
|
{
|
||||||
|
DynamicData[propertyName] = DynamicData[propertyName].ToObject(type);
|
||||||
|
return DynamicData[propertyName];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return Convert.ChangeType(DynamicData[propertyName], type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return Convert.ChangeType(DynamicData[propertyName], type);
|
{
|
||||||
}
|
return param.parameter;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return param.parameter;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
|
|
Loading…
Reference in a new issue