public override void OnInspectorGUI() { EditorGUIUtility.LookLikeControls(); Mode oldMode = mode; mode = (Mode)BlockEditorUtils.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.Data; } xmlScrollPosition = GUILayout.BeginScrollView(xmlScrollPosition); GUIStyle style = new GUIStyle(GUI.skin.box); style.alignment = TextAnchor.UpperLeft; xml = EditorGUILayout.TextArea(xml, GUILayout.ExpandWidth(true)); blockSet.Data = xml; GUILayout.EndScrollView(); if (GUILayout.Button("Import")) { OCBlockSetImport.Import(blockSet, blockSet.Data); GUI.changed = true; } } if (GUI.changed) { string data = BlockSetExport.Export(blockSet); blockSet.Data = data; EditorUtility.SetDirty(blockSet); } }
//--------------------------------------------------------------------------- #endregion //--------------------------------------------------------------------------- #region Accessors and Mutators //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #endregion //--------------------------------------------------------------------------- #region Public Member Functions //--------------------------------------------------------------------------- public virtual void Init(OCBlockSet blockSet) { _atlas = blockSet.GetAtlas(_atlasID); if (_atlas != null) { _alpha = _atlas.IsAlpha; } }
//--------------------------------------------------------------------------- #endregion //--------------------------------------------------------------------------- #region Accessors and Mutators //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #endregion //--------------------------------------------------------------------------- #region Public Member Functions //--------------------------------------------------------------------------- public virtual void Init(OCBlockSet blockSet) { _atlas = blockSet.GetAtlas(_atlasID); if(_atlas != null) _alpha = _atlas.IsAlpha; }