protected override void SwitchItem(CocoMakeupItemData oldData, CocoMakeupItemData newData)
        {
            if (newData != null)
            {
                Texture2D texture;

                CocoMakeupCategoryData categoryData = CocoRoot.GetInstance <ICocoMakeupData>().GetCategoryData(newData.Category);
                if (categoryData == null)
                {
                    return;
                }
                if (oldData == null || oldData.Category != newData.Category)
                {
                    CocoMakeupCategoryPaintData_PaintTexture paintData = (CocoMakeupCategoryPaintData_PaintTexture)categoryData.PaintData;
                    // brush
                    texture = Resources.Load <Texture2D> (paintData.paintBrushPath);
                    m_PaintKit.CurrentBrush = new CocoMakeupBrush(texture);
                    //Resources.UnloadAsset (texture);
                    // mask

                    if (!string.IsNullOrEmpty(paintData.paintMaskPath))
                    {
                        texture = Resources.Load <Texture2D> (paintData.paintMaskPath);
                        m_PaintKit.CurrentPaintMask = new CocoMakeupMask(texture);
                        //Resources.UnloadAsset (texture);
                    }
                    else
                    {
                        m_PaintKit.CurrentPaintMask = new CocoMakeupMask(Texture2D.whiteTexture);
                    }

                    // layer
                    m_PaintKit.SetCurrentCanvasLayer(paintData.paintLayerId);
                    m_PaintKit.CurrentBrush.Size = paintData.BrushSize;
                }

                if (oldData == null || oldData.m_TexturePath != newData.m_TexturePath)
                {
                    // pattern
                    texture = Resources.Load <Texture2D> (newData.m_TexturePath);
                    m_PaintKit.CurrentPattern = new CocoMakeupPattern(texture, CocoMakeupPattern.FillMode.CanvasArea);
                    //Resources.UnloadAsset (texture);
                }

                Resources.UnloadUnusedAssets();
            }
        }
        public void SetCategoryData(CocoMakeupCategoryData categoryData)
        {
//			if (m_CurrCategoryData == pButton.MakeupCategoryData) return;

            m_CurrCategoryData    = categoryData;
            m_CurrItemData        = null;
            m_CurrControlExecutor = null;
            if (m_CurrCategoryData != null)
            {
                if (ControlExecutorDic.ContainsKey(m_CurrCategoryData.PaintLayer))
                {
                    m_CurrControlExecutor = ControlExecutorDic[m_CurrCategoryData.PaintLayer];
                }
            }

            if (m_CurrCategoryData.PaintData is CocoMakeupCategoryPaintData_PaintTexture)
            {
                int layerID = ((CocoMakeupCategoryPaintData_PaintTexture)m_CurrCategoryData.PaintData).paintLayerId;
                m_CurrControlExecutor.PaintKit.SetCurrentCanvasLayer(layerID);
            }
        }
        protected virtual CocoMakeupControlExecutorBase CreateExecutor(CocoMakeupCategoryData categoryData, CocoRoleBody body)
        {
            GameObject  target           = null;
            string      materialProperty = string.Empty;
            Texture2D   sampleTexture    = null;
            bool        useUV2           = false;
            bool        bakeMashEnable   = true;
            CCPaintMode paintmode        = CCPaintMode.MixOrigin;

            materialProperty = MakeupData.GetMaterialProperty(categoryData.PaintLayer);

            switch (categoryData.PaintLayer)
            {
            case CocoMakeupPaintLayer.Eye:
                target = body.GetRenderer(CocoRoleRendererID.EyeBall).gameObject;
                break;

            case CocoMakeupPaintLayer.EyeBrow:
                target = body.GetRenderer(CocoRoleRendererID.EyeBrow).gameObject;
                break;

            case CocoMakeupPaintLayer.EyeLash:
                target         = body.GetRenderer(CocoRoleRendererID.Eyelash).gameObject;
                bakeMashEnable = false;
                paintmode      = CCPaintMode.NonMixOrigin;
                break;

            case CocoMakeupPaintLayer.Head:
                target = body.GetRenderer(CocoRoleRendererID.Head).gameObject;
                break;

            case CocoMakeupPaintLayer.Head_Layer1:
                target = body.GetRenderer(CocoRoleRendererID.Head).gameObject;
                break;

            case CocoMakeupPaintLayer.Head_Layer2:
                target = body.GetRenderer(CocoRoleRendererID.Head).gameObject;
                useUV2 = true;
                break;

            default:
                target = body.GetRenderer(CocoRoleRendererID.Head).gameObject;
                break;
            }

            CocoMakeupControlExecutorBase executor = null;

            switch (categoryData.PaintData.paintType)
            {
            case CocoMakeupPaintType.PaintTexture:
                CocoMakeupCategoryPaintData_PaintTexture paintData = (CocoMakeupCategoryPaintData_PaintTexture)categoryData.PaintData;
                if (paintData.paintBlendColor)
                {
                    executor = new CocoMakeupControlPaintBlendColor(target, materialProperty, bakeMashEnable, sampleTexture, useUV2);
                }
                else
                {
                    executor = new CocoMakeupControlPaint(target, materialProperty, bakeMashEnable, sampleTexture, useUV2);
                }

                executor.PaintKit.SetMixMode(paintmode);
                break;

            default:
                executor = new CocoMakeupControlChange(target, materialProperty, bakeMashEnable);
                break;
            }

            return(executor);
        }