コード例 #1
0
 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;
     }
 }
コード例 #2
0
    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);
            }
        }
    }
コード例 #3
0
ファイル: MadLevelProperty.cs プロジェクト: MatSe91/Lightbeam
    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();
//        }
    }
コード例 #4
0
    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;
    }
コード例 #5
0
    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);
        }
    }
コード例 #6
0
    void Start()
    {
        var text = GetComponent <MadText>();

        text.text = MadLevelProfile.GetLevelAny(icon.level.name, name, text.text);
    }