Ejemplo n.º 1
0
    public override void OnInspectorGUI()
    {
        LevelButtonBehavior targetMenuButton = (LevelButtonBehavior)target;

        targetMenuButton.levelName = EditorGUILayout.TextField("Level Name", targetMenuButton.levelName);

        // Show default inspector property editor
        DrawDefaultInspector();
    }
Ejemplo n.º 2
0
    void SetupLevelButton(LevelReferenceObject lr, Transform container)
    {
        char[] trimArray = new char[5] {
            'L', 'l', 'e', 'v', ' '
        };
        string              levelName      = lr.file;
        GameObject          g              = Instantiate(loadUI.levelButtonPrefab) as GameObject;
        LevelButtonBehavior buttonInstance = g.GetComponent <LevelButtonBehavior>();

        if (buttonInstance != null)
        {
            buttonInstance.SetLevelSprite(false, lr.completionRank > 0);
            buttonInstance.SetLevelRank(lr.GetLevelCompletionRank());
        }

        Button gButton = g.GetComponent <Button>();

        g.transform.SetParent(container);
        g.transform.localScale = Vector3.one;
        Text gText = g.GetComponentInChildren <Text>();

        gText.text = levelName.TrimStart(trimArray);
        gButton.onClick.AddListener(() => LoadButtonBehavior(levelName));
    }