コード例 #1
0
    public override void OnInspectorGUI()
    {
        EditorGUIUtility.LookLikeControls();

        Mode oldMode = mode;

        mode = (Mode)EditorGUIUtils.Toolbar(mode);
        EditorGUILayout.Separator();
        if (mode != oldMode)
        {
            EditorGUIUtility.keyboardControl = 0;
        }

        if (mode == Mode.AtlasSet)
        {
            DrawAtlasesList(blockSet);
            if (blockSet.GetAtlas(selectedAtlas) != null)
            {
                DrawAtlasEditor(blockSet.GetAtlas(selectedAtlas));
            }
        }
        if (mode == Mode.BlockSet)
        {
            DrawBlockSet(blockSet);
            EditorGUILayout.Separator();

            if (blockSet.GetBlock(selectedBlock) != null)
            {
                BlockEditor.DrawBlockEditor(blockSet.GetBlock(selectedBlock), blockSet);
            }
        }
        if (mode == Mode.XML)
        {
            if (oldMode != mode)
            {
                xml = blockSet.GetData();
            }

            xmlScrollPosition = GUILayout.BeginScrollView(xmlScrollPosition);
            GUIStyle style = new GUIStyle(GUI.skin.box);
            style.alignment = TextAnchor.UpperLeft;
            xml             = EditorGUILayout.TextArea(xml, GUILayout.ExpandWidth(true));
            blockSet.SetData(xml);
            GUILayout.EndScrollView();

            if (GUILayout.Button("Import"))
            {
                BlockSetImport.Import(blockSet, blockSet.GetData());
                GUI.changed = true;
            }
        }

        if (GUI.changed)
        {
            string data = BlockSetExport.Export(blockSet);
            blockSet.SetData(data);
            EditorUtility.SetDirty(blockSet);
        }
    }
コード例 #2
0
 public virtual void Init(BlockSet blockSet)
 {
     _atlas = blockSet.GetAtlas(atlas);
     if (_atlas != null)
     {
         alpha = _atlas.IsAlpha();
     }
 }