public virtual void Init(CocoRoleBody roleBody) { foreach (CocoMakeupCategoryData categoryData in MakeupData.GetCategoryList()) { // create paint executor if (!ControlExecutorDic.ContainsKey(categoryData.PaintLayer)) { CocoMakeupControlExecutorBase executor = CreateExecutor(categoryData, roleBody); if (executor != null) { ControlExecutorDic.Add(categoryData.PaintLayer, executor); } } } m_CurrControlExecutor = null; }
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); }