Exemplo n.º 1
0
        void InitModules()
        {
            m_AllRegisteredModules = new List <SpriteEditorModuleBase>();
            m_ModuleRequireSpriteDataProvider.Clear();

            if (m_OutlineTexture == null)
            {
                m_OutlineTexture = new UnityTexture2D(1, 16, TextureFormat.RGBA32, false);
                m_OutlineTexture.SetPixels(new Color[]
                {
                    new Color(0.5f, 0.5f, 0.5f, 0.5f), new Color(0.5f, 0.5f, 0.5f, 0.5f), new Color(0.8f, 0.8f, 0.8f, 0.8f), new Color(0.8f, 0.8f, 0.8f, 0.8f),
                    Color.white, Color.white, Color.white, Color.white,
                    new Color(.8f, .8f, .8f, 1f), new Color(.5f, .5f, .5f, .8f), new Color(0.3f, 0.3f, 0.3f, 0.5f), new Color(0.3f, .3f, 0.3f, 0.5f),
                    new Color(0.3f, .3f, 0.3f, 0.3f), new Color(0.3f, .3f, 0.3f, 0.3f), new Color(0.1f, 0.1f, 0.1f, 0.1f), new Color(0.1f, .1f, 0.1f, 0.1f)
                });
                m_OutlineTexture.Apply();
                m_OutlineTexture.hideFlags = HideFlags.HideAndDontSave;
            }
            var outlineTexture = new UnityEngine.U2D.Interface.Texture2D(m_OutlineTexture);

            // Add your modules here
            RegisterModule(new SpriteFrameModule(this, m_EventSystem, m_UndoSystem, m_AssetDatabase));
            RegisterModule(new SpritePolygonModeModule(this, m_EventSystem, m_UndoSystem, m_AssetDatabase));
            RegisterModule(new SpriteOutlineModule(this, m_EventSystem, m_UndoSystem, m_AssetDatabase, m_GUIUtility, new ShapeEditorFactory(), outlineTexture));
            RegisterModule(new SpritePhysicsShapeModule(this, m_EventSystem, m_UndoSystem, m_AssetDatabase, m_GUIUtility, new ShapeEditorFactory(), outlineTexture));
            RegisterCustomModules();
            UpdateAvailableModules();
        }
Exemplo n.º 2
0
 private void InitModules()
 {
     this.m_AllRegisteredModules = new List <ISpriteEditorModule>();
     if (this.m_OutlineTexture == null)
     {
         this.m_OutlineTexture = new UnityEngine.Texture2D(1, 16, TextureFormat.RGBA32, false);
         this.m_OutlineTexture.SetPixels(new Color[]
         {
             new Color(0.5f, 0.5f, 0.5f, 0.5f),
             new Color(0.5f, 0.5f, 0.5f, 0.5f),
             new Color(0.8f, 0.8f, 0.8f, 0.8f),
             new Color(0.8f, 0.8f, 0.8f, 0.8f),
             Color.white,
             Color.white,
             Color.white,
             Color.white,
             new Color(0.8f, 0.8f, 0.8f, 1f),
             new Color(0.5f, 0.5f, 0.5f, 0.8f),
             new Color(0.3f, 0.3f, 0.3f, 0.5f),
             new Color(0.3f, 0.3f, 0.3f, 0.5f),
             new Color(0.3f, 0.3f, 0.3f, 0.3f),
             new Color(0.3f, 0.3f, 0.3f, 0.3f),
             new Color(0.1f, 0.1f, 0.1f, 0.1f),
             new Color(0.1f, 0.1f, 0.1f, 0.1f)
         });
         this.m_OutlineTexture.Apply();
         this.m_OutlineTexture.hideFlags = HideFlags.HideAndDontSave;
     }
     UnityEngine.U2D.Interface.Texture2D outlineTexture = new UnityEngine.U2D.Interface.Texture2D(this.m_OutlineTexture);
     this.m_AllRegisteredModules.Add(new SpriteFrameModule(this, this.m_EventSystem, this.m_UndoSystem, this.m_AssetDatabase));
     this.m_AllRegisteredModules.Add(new SpritePolygonModeModule(this, this.m_EventSystem, this.m_UndoSystem, this.m_AssetDatabase));
     this.m_AllRegisteredModules.Add(new SpriteOutlineModule(this, this.m_EventSystem, this.m_UndoSystem, this.m_AssetDatabase, this.m_GUIUtility, new ShapeEditorFactory(), outlineTexture));
     this.UpdateAvailableModules();
 }