void Start() { if (textFromProperty && sprite is MadText) { var text = sprite as MadText; var level = icon.level; var str = MadLevelProfile.GetLevelAny(level.name, textPropertyName); text.text = str; } }
private static void GUILevel(string levelName) { using (MadGUI.Indent(2)) { var propertyNames = MadLevelProfile.GetLevelPropertyNames(levelName); propertyNames.Sort(new MadNaturalSortComparer()); foreach (var propertyName in propertyNames) { var propertyValue = MadLevelProfile.GetLevelAny(levelName, propertyName); GUIProperty(propertyName, propertyValue); } } }
void Update() { if (onFirstUpdate) { // looking at the property state at first update makes it usable during runtime if (Application.isPlaying && icon.level != null && persistent) { if (propertySet) { propertyEnabled = GetLevelBoolean(); } else { // save the property if unset if (justAwaken) { SetLevelBoolean(propertyEnabled); } else { // layout rebuilded on runtime propertyEnabled = false; } } } if (textFromProperty && sprite is MadText) { var text = sprite as MadText; var level = icon.level; var str = MadLevelProfile.GetLevelAny(level.name, textPropertyName); text.text = str; } onFirstUpdate = false; justAwaken = false; } // cannot do the update every frame because of huge performance loss // if (propertySet) { // propertyEnabled = GetLevelBoolean(); // } }
private bool ProcessProperties(PropertyProcessor processor) { var levelNames = GetLevelNames(); if (propertyName == null || propertyName.Length == 0) { Debug.LogError("Missing SelectProperty() directive"); return false; } for (int i = 0; i < levelNames.Count; ++i) { var ln = levelNames[i]; for (int j = 0; j < propertyName.Length; ++j) { var pn = propertyName[j]; if (!MadLevelProfile.IsLevelPropertySet(ln, pn)) { processor(ln, pn, null); } else { processor(ln, pn, MadLevelProfile.GetLevelAny(ln, pn)); } } } return true; }
private string GetPropertyValue() { string levelName = icon.level.name; switch (propertyType) { case PropertyType.Completed: return(MadLevelProfile.IsCompleted(levelName).ToString()); case PropertyType.Locked: return(MadLevelProfile.IsLocked(levelName).ToString()); case PropertyType.LevelNumber: return(icon.levelNumber.text); case PropertyType.Custom: return(MadLevelProfile.GetLevelAny(levelName, customPropertyName, null)); default: Debug.LogError("Unknown property type: " + propertyType); return(null); } }
void Start() { var text = GetComponent <MadText>(); text.text = MadLevelProfile.GetLevelAny(icon.level.name, name, text.text); }