diff --git a/assets/effects/glow-inner.effect b/assets/effects/glow-inner.effect index 6a4825a..213700c 100644 --- a/assets/effects/glow-inner.effect +++ b/assets/effects/glow-inner.effect @@ -14,8 +14,31 @@ CCEffect %{ properties: texture: { value: white } alphaThreshold: { value: 0.5 } - glowColor: { value: [1.0, 1.0, 0.0, 1.0], editor: { type: color , displayName: "发光颜色" } } - glowColorSize: { value: 0.01, editor: {displayName: "发光宽度(百分比)" } } + + # 自定义参数 + # 发光颜色 + glowColor: { + value: [1.0, 1.0, 0.0, 1.0], + editor: { + type: color, + displayName: "发光颜色" + } + } + # 发光宽度 + glowColorSize: { + value: 0.01, + editor: { + displayName: "发光宽度(百分比)" + } + } + # 发光透明度阈值 + #只有超过这个透明度的点才会发光,一般用于解决图像边缘存在渐变透明的时,决定哪些透明度的边缘点发光,具体可以操作一下就知道 + glowThreshold: { + value: 0.1, + editor: { + displayName: "发光阈值(百分比)" + } + } }% @@ -73,6 +96,8 @@ CCProgram fs %{ vec4 glowColor; // 发光范围 float glowColorSize; + // 发光阈值 + float glowThreshold; // 特别地,必须是 vec4 先于 float 声明 }; @@ -113,8 +138,7 @@ CCProgram fs %{ totalAlpha += getColorAlpha(270.0, dist); totalAlpha += getColorAlpha(300.0, dist); totalAlpha += getColorAlpha(330.0, dist); - // 1 / 12 = 0.08333 - return totalAlpha * 0.0833; + return totalAlpha * 0.0833; // 1 / 12 = 0.08333 } /** @@ -171,18 +195,18 @@ CCProgram fs %{ // 目标颜色(图像) vec4 color_dest = o; - // 源颜色(内发光) float alpha = getGlowAlpha(); // 此时我们得到的是内部透明度为1,靠近边缘的为接近0的透明度 // 而内发光恰恰相反,是需要内部透明度为0,靠近边缘的接近1的透明度 // 因此我们需要翻转一下透明度 // 如果图像边缘有大量渐变,那么如果我们取 0.0 的话,那么可能边缘会出现锯齿 // 因此我们取0.1作为翻转临界值,0.1也不是绝对的,可以自行修改这里的值 - if (alpha > 0.1) { + if (alpha > glowThreshold) { alpha = 1.0 - alpha; // 给点调料,让靠近边缘的更加亮 alpha = -1.0 * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) + 1.0; } + // 源颜色(内发光) vec4 color_src = glowColor * alpha; // 按照这个顺序,源颜色就是内发光颜色,目标颜色就是图案颜色色 diff --git a/assets/effects/glow-inner.effect.meta b/assets/effects/glow-inner.effect.meta index 2e336a7..a17b740 100644 --- a/assets/effects/glow-inner.effect.meta +++ b/assets/effects/glow-inner.effect.meta @@ -5,11 +5,11 @@ { "glsl1": { "vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\n\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\n", - "frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform float alphaThreshold;\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_INNER_GLOW\n\nuniform vec4 glowColor;\nuniform float glowColorSize;\n\n/**\n * 获取指定角度方向,距离为xxx的像素的透明度\n *\n * @param angle 角度 [0.0, 360.0]\n * @param dist 距离 [0.0, 1.0]\n *\n * @return alpha [0.0, 1.0]\n */\nfloat getColorAlpha(float angle, float dist) {\n\n float radian = angle * 0.01745329252;\n\n vec4 color = texture2D(texture, v_uv0 + vec2(dist * cos(radian), dist * sin(radian))); \n return color.a;\n}\n\n/**\n * 获取指定距离的周边像素的透明度平均值\n *\n * @param dist 距离 [0.0, 1.0]\n *\n * @return average alpha [0.0, 1.0]\n */\nfloat getAverageAlpha(float dist) {\n float totalAlpha = 0.0;\n\n totalAlpha += getColorAlpha(0.0, dist);\n totalAlpha += getColorAlpha(30.0, dist);\n totalAlpha += getColorAlpha(60.0, dist);\n totalAlpha += getColorAlpha(90.0, dist);\n totalAlpha += getColorAlpha(120.0, dist);\n totalAlpha += getColorAlpha(150.0, dist);\n totalAlpha += getColorAlpha(180.0, dist);\n totalAlpha += getColorAlpha(210.0, dist);\n totalAlpha += getColorAlpha(240.0, dist);\n totalAlpha += getColorAlpha(270.0, dist);\n totalAlpha += getColorAlpha(300.0, dist);\n totalAlpha += getColorAlpha(330.0, dist);\n\n return totalAlpha * 0.0833; \n}\n\n/**\n * 获取发光的透明度\n */\nfloat getGlowAlpha() {\n\n if (glowColorSize == 0.0) {\n return 0.0;\n }\n\n vec4 srcColor = texture2D(texture, v_uv0);\n if (srcColor.a < 0.1) {\n return srcColor.a;\n }\n\n float totalAlpha = 0.0;\n totalAlpha += getAverageAlpha(glowColorSize * 0.1);\n totalAlpha += getAverageAlpha(glowColorSize * 0.2);\n totalAlpha += getAverageAlpha(glowColorSize * 0.3);\n totalAlpha += getAverageAlpha(glowColorSize * 0.4);\n totalAlpha += getAverageAlpha(glowColorSize * 0.5);\n totalAlpha += getAverageAlpha(glowColorSize * 0.6);\n totalAlpha += getAverageAlpha(glowColorSize * 0.7);\n totalAlpha += getAverageAlpha(glowColorSize * 0.8);\n totalAlpha += getAverageAlpha(glowColorSize * 0.9);\n totalAlpha += getAverageAlpha(glowColorSize * 1.0);\n return totalAlpha * 0.1;\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_INNER_GLOW\n\n vec4 color_dest = o;\n\n float alpha = getGlowAlpha();\n\n if (alpha > 0.1) {\n alpha = 1.0 - alpha;\n\n alpha = -1.0 * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) + 1.0;\n }\n vec4 color_src = glowColor * alpha;\n\n gl_FragColor = color_src * color_src.a + color_dest;\n #endif\n}\n" + "frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform float alphaThreshold;\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nvarying vec4 v_color;\n\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_INNER_GLOW\n\nuniform vec4 glowColor;\nuniform float glowColorSize;\nuniform float glowThreshold;\n\n/**\n * 获取指定角度方向,距离为xxx的像素的透明度\n *\n * @param angle 角度 [0.0, 360.0]\n * @param dist 距离 [0.0, 1.0]\n *\n * @return alpha [0.0, 1.0]\n */\nfloat getColorAlpha(float angle, float dist) {\n\n float radian = angle * 0.01745329252;\n\n vec4 color = texture2D(texture, v_uv0 + vec2(dist * cos(radian), dist * sin(radian))); \n return color.a;\n}\n\n/**\n * 获取指定距离的周边像素的透明度平均值\n *\n * @param dist 距离 [0.0, 1.0]\n *\n * @return average alpha [0.0, 1.0]\n */\nfloat getAverageAlpha(float dist) {\n float totalAlpha = 0.0;\n\n totalAlpha += getColorAlpha(0.0, dist);\n totalAlpha += getColorAlpha(30.0, dist);\n totalAlpha += getColorAlpha(60.0, dist);\n totalAlpha += getColorAlpha(90.0, dist);\n totalAlpha += getColorAlpha(120.0, dist);\n totalAlpha += getColorAlpha(150.0, dist);\n totalAlpha += getColorAlpha(180.0, dist);\n totalAlpha += getColorAlpha(210.0, dist);\n totalAlpha += getColorAlpha(240.0, dist);\n totalAlpha += getColorAlpha(270.0, dist);\n totalAlpha += getColorAlpha(300.0, dist);\n totalAlpha += getColorAlpha(330.0, dist);\n return totalAlpha * 0.0833;\n\n}\n\n/**\n * 获取发光的透明度\n */\nfloat getGlowAlpha() {\n\n if (glowColorSize == 0.0) {\n return 0.0;\n }\n\n vec4 srcColor = texture2D(texture, v_uv0);\n if (srcColor.a < 0.1) {\n return srcColor.a;\n }\n\n float totalAlpha = 0.0;\n totalAlpha += getAverageAlpha(glowColorSize * 0.1);\n totalAlpha += getAverageAlpha(glowColorSize * 0.2);\n totalAlpha += getAverageAlpha(glowColorSize * 0.3);\n totalAlpha += getAverageAlpha(glowColorSize * 0.4);\n totalAlpha += getAverageAlpha(glowColorSize * 0.5);\n totalAlpha += getAverageAlpha(glowColorSize * 0.6);\n totalAlpha += getAverageAlpha(glowColorSize * 0.7);\n totalAlpha += getAverageAlpha(glowColorSize * 0.8);\n totalAlpha += getAverageAlpha(glowColorSize * 0.9);\n totalAlpha += getAverageAlpha(glowColorSize * 1.0);\n return totalAlpha * 0.1;\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_INNER_GLOW\n\n vec4 color_dest = o;\n\n float alpha = getGlowAlpha();\n\n if (alpha > glowThreshold) {\n alpha = 1.0 - alpha;\n\n alpha = -1.0 * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) + 1.0;\n }\n\n vec4 color_src = glowColor * alpha;\n\n gl_FragColor = color_src * color_src.a + color_dest;\n #endif\n}\n" }, "glsl3": { "vert": "\nprecision highp float;\nuniform CCGlobal {\n vec4 cc_time;\n\n vec4 cc_screenSize;\n\n vec4 cc_screenScale;\n\n vec4 cc_nativeSize;\n\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n\n vec4 cc_exposure;\n\n vec4 cc_mainLitDir;\n\n vec4 cc_mainLitColor;\n\n vec4 cc_ambientSky;\n vec4 cc_ambientGround;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\n\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\n\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = pos;\n}\n", - "frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform ALPHA_TEST {\n float alphaThreshold;\n }\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nin vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_INNER_GLOW\n\nuniform glow {\n\n vec4 glowColor;\n\n float glowColorSize;\n\n};\n\n/**\n * 获取指定角度方向,距离为xxx的像素的透明度\n *\n * @param angle 角度 [0.0, 360.0]\n * @param dist 距离 [0.0, 1.0]\n *\n * @return alpha [0.0, 1.0]\n */\nfloat getColorAlpha(float angle, float dist) {\n\n float radian = angle * 0.01745329252;\n\n vec4 color = texture(texture, v_uv0 + vec2(dist * cos(radian), dist * sin(radian))); \n return color.a;\n}\n\n/**\n * 获取指定距离的周边像素的透明度平均值\n *\n * @param dist 距离 [0.0, 1.0]\n *\n * @return average alpha [0.0, 1.0]\n */\nfloat getAverageAlpha(float dist) {\n float totalAlpha = 0.0;\n\n totalAlpha += getColorAlpha(0.0, dist);\n totalAlpha += getColorAlpha(30.0, dist);\n totalAlpha += getColorAlpha(60.0, dist);\n totalAlpha += getColorAlpha(90.0, dist);\n totalAlpha += getColorAlpha(120.0, dist);\n totalAlpha += getColorAlpha(150.0, dist);\n totalAlpha += getColorAlpha(180.0, dist);\n totalAlpha += getColorAlpha(210.0, dist);\n totalAlpha += getColorAlpha(240.0, dist);\n totalAlpha += getColorAlpha(270.0, dist);\n totalAlpha += getColorAlpha(300.0, dist);\n totalAlpha += getColorAlpha(330.0, dist);\n\n return totalAlpha * 0.0833; \n}\n\n/**\n * 获取发光的透明度\n */\nfloat getGlowAlpha() {\n\n if (glowColorSize == 0.0) {\n return 0.0;\n }\n\n vec4 srcColor = texture(texture, v_uv0);\n if (srcColor.a < 0.1) {\n return srcColor.a;\n }\n\n float totalAlpha = 0.0;\n totalAlpha += getAverageAlpha(glowColorSize * 0.1);\n totalAlpha += getAverageAlpha(glowColorSize * 0.2);\n totalAlpha += getAverageAlpha(glowColorSize * 0.3);\n totalAlpha += getAverageAlpha(glowColorSize * 0.4);\n totalAlpha += getAverageAlpha(glowColorSize * 0.5);\n totalAlpha += getAverageAlpha(glowColorSize * 0.6);\n totalAlpha += getAverageAlpha(glowColorSize * 0.7);\n totalAlpha += getAverageAlpha(glowColorSize * 0.8);\n totalAlpha += getAverageAlpha(glowColorSize * 0.9);\n totalAlpha += getAverageAlpha(glowColorSize * 1.0);\n return totalAlpha * 0.1;\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_INNER_GLOW\n\n vec4 color_dest = o;\n\n float alpha = getGlowAlpha();\n\n if (alpha > 0.1) {\n alpha = 1.0 - alpha;\n\n alpha = -1.0 * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) + 1.0;\n }\n vec4 color_src = glowColor * alpha;\n\n gl_FragColor = color_src * color_src.a + color_dest;\n #endif\n}\n" + "frag": "\nprecision highp float;\n\n#if USE_ALPHA_TEST\n \n uniform ALPHA_TEST {\n float alphaThreshold;\n }\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nin vec4 v_color;\n\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\n\n#if SHOW_INNER_GLOW\n\nuniform glow {\n\n vec4 glowColor;\n\n float glowColorSize;\n\n float glowThreshold;\n\n};\n\n/**\n * 获取指定角度方向,距离为xxx的像素的透明度\n *\n * @param angle 角度 [0.0, 360.0]\n * @param dist 距离 [0.0, 1.0]\n *\n * @return alpha [0.0, 1.0]\n */\nfloat getColorAlpha(float angle, float dist) {\n\n float radian = angle * 0.01745329252;\n\n vec4 color = texture(texture, v_uv0 + vec2(dist * cos(radian), dist * sin(radian))); \n return color.a;\n}\n\n/**\n * 获取指定距离的周边像素的透明度平均值\n *\n * @param dist 距离 [0.0, 1.0]\n *\n * @return average alpha [0.0, 1.0]\n */\nfloat getAverageAlpha(float dist) {\n float totalAlpha = 0.0;\n\n totalAlpha += getColorAlpha(0.0, dist);\n totalAlpha += getColorAlpha(30.0, dist);\n totalAlpha += getColorAlpha(60.0, dist);\n totalAlpha += getColorAlpha(90.0, dist);\n totalAlpha += getColorAlpha(120.0, dist);\n totalAlpha += getColorAlpha(150.0, dist);\n totalAlpha += getColorAlpha(180.0, dist);\n totalAlpha += getColorAlpha(210.0, dist);\n totalAlpha += getColorAlpha(240.0, dist);\n totalAlpha += getColorAlpha(270.0, dist);\n totalAlpha += getColorAlpha(300.0, dist);\n totalAlpha += getColorAlpha(330.0, dist);\n return totalAlpha * 0.0833;\n\n}\n\n/**\n * 获取发光的透明度\n */\nfloat getGlowAlpha() {\n\n if (glowColorSize == 0.0) {\n return 0.0;\n }\n\n vec4 srcColor = texture(texture, v_uv0);\n if (srcColor.a < 0.1) {\n return srcColor.a;\n }\n\n float totalAlpha = 0.0;\n totalAlpha += getAverageAlpha(glowColorSize * 0.1);\n totalAlpha += getAverageAlpha(glowColorSize * 0.2);\n totalAlpha += getAverageAlpha(glowColorSize * 0.3);\n totalAlpha += getAverageAlpha(glowColorSize * 0.4);\n totalAlpha += getAverageAlpha(glowColorSize * 0.5);\n totalAlpha += getAverageAlpha(glowColorSize * 0.6);\n totalAlpha += getAverageAlpha(glowColorSize * 0.7);\n totalAlpha += getAverageAlpha(glowColorSize * 0.8);\n totalAlpha += getAverageAlpha(glowColorSize * 0.9);\n totalAlpha += getAverageAlpha(glowColorSize * 1.0);\n return totalAlpha * 0.1;\n}\n\n#endif\n\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n\n #if USE_TEXTURE\n o *= texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_TEXTURE\n o.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n o *= v_color;\n\n ALPHA_TEST(o);\n\n gl_FragColor = o;\n\n #if SHOW_INNER_GLOW\n\n vec4 color_dest = o;\n\n float alpha = getGlowAlpha();\n\n if (alpha > glowThreshold) {\n alpha = 1.0 - alpha;\n\n alpha = -1.0 * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) * (alpha - 1.0) + 1.0;\n }\n\n vec4 color_src = glowColor * alpha;\n\n gl_FragColor = color_src * color_src.a + color_dest;\n #endif\n}\n" } } ], diff --git a/assets/materials/glow-inner.mtl b/assets/materials/glow-inner.mtl index b82e982..1b5eb7a 100644 --- a/assets/materials/glow-inner.mtl +++ b/assets/materials/glow-inner.mtl @@ -20,6 +20,7 @@ "z": 0, "w": 1 }, - "glowColorSize": 0.1 + "glowColorSize": 0.2, + "glowThreshold": 0.1 } } \ No newline at end of file diff --git a/assets/prefabs/GlowThresholdSliderPrefab.prefab b/assets/prefabs/GlowThresholdSliderPrefab.prefab new file mode 100644 index 0000000..7c11efb --- /dev/null +++ b/assets/prefabs/GlowThresholdSliderPrefab.prefab @@ -0,0 +1,870 @@ +[ + { + "__type__": "cc.Prefab", + "_name": "", + "_objFlags": 0, + "_native": "", + "data": { + "__id__": 1 + }, + "optimizationPolicy": 0, + "asyncLoadAssets": false, + "readonly": false + }, + { + "__type__": "cc.Node", + "_name": "GlowThresholdSliderPrefab", + "_objFlags": 0, + "_parent": null, + "_children": [ + { + "__id__": 2 + }, + { + "__id__": 6 + }, + { + "__id__": 18 + } + ], + "_active": true, + "_components": [ + { + "__id__": 22 + }, + { + "__id__": 23 + } + ], + "_prefab": { + "__id__": 24 + }, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 960, + "height": 60 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 480, + -510, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "" + }, + { + "__type__": "cc.Node", + "_name": "SliderDescLabel", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 3 + }, + { + "__id__": 4 + } + ], + "_prefab": { + "__id__": 5 + }, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 240, + "height": 40 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 1, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -240, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_useOriginalSize": false, + "_string": "发光阈值:", + "_N$string": "发光阈值:", + "_fontSize": 40, + "_lineHeight": 40, + "_enableWrapText": true, + "_N$file": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_batchAsBitmap": false, + "_N$horizontalAlign": 2, + "_N$verticalAlign": 1, + "_N$fontFamily": "Arial", + "_N$overflow": 2, + "_N$cacheMode": 0, + "_id": "" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 45, + "_left": 0, + "_right": 0.75, + "_top": 10, + "_bottom": 10, + "_verticalCenter": 0, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": false, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 113.38, + "_originalHeight": 50.4, + "_id": "" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__uuid__": "d2290efe-f7fd-465b-87fa-41172ed5529f" + }, + "fileId": "547VVCPdxBjJnAfoBu4v/U", + "sync": false + }, + { + "__type__": "cc.Node", + "_name": "Slider", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 7 + }, + { + "__id__": 11 + } + ], + "_active": true, + "_components": [ + { + "__id__": 15 + }, + { + "__id__": 16 + } + ], + "_prefab": { + "__id__": 17 + }, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 384, + "height": 60 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -192, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "" + }, + { + "__type__": "cc.Node", + "_name": "Background", + "_objFlags": 0, + "_parent": { + "__id__": 6 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 8 + }, + { + "__id__": 9 + } + ], + "_prefab": { + "__id__": 10 + }, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 384, + "height": 20 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 7 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "31d8962d-babb-4ec7-be19-8e9f54a4ea99" + }, + "_type": 1, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 7 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 45, + "_left": 0, + "_right": 0, + "_top": 20, + "_bottom": 20, + "_verticalCenter": 0, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 300, + "_originalHeight": 20, + "_id": "" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__uuid__": "d2290efe-f7fd-465b-87fa-41172ed5529f" + }, + "fileId": "baDHqeTQhL6IOo+iat5VD2", + "sync": false + }, + { + "__type__": "cc.Node", + "_name": "Handle", + "_objFlags": 0, + "_parent": { + "__id__": 6 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 12 + }, + { + "__id__": 13 + } + ], + "_prefab": { + "__id__": 14 + }, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 32, + "height": 32 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 115.20000000000002, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 11 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_type": 1, + "_sizeMode": 2, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 11 + }, + "_enabled": true, + "_normalMaterial": null, + "_grayMaterial": null, + "duration": 0.1, + "zoomScale": 1.1, + "clickEvents": [], + "_N$interactable": true, + "_N$enableAutoGrayEffect": true, + "_N$transition": 3, + "transition": 3, + "_N$normalColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$pressedColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "pressedColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$hoverColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "hoverColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$disabledColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$normalSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_N$pressedSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "pressedSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_N$hoverSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "hoverSprite": { + "__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f" + }, + "_N$disabledSprite": { + "__uuid__": "29158224-f8dd-4661-a796-1ffab537140e" + }, + "_N$target": { + "__id__": 11 + }, + "_id": "" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__uuid__": "d2290efe-f7fd-465b-87fa-41172ed5529f" + }, + "fileId": "88hQVlfRJF+bGWN48y+iIl", + "sync": false + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 6 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 45, + "_left": 0.3, + "_right": 0.3, + "_top": 0, + "_bottom": 0, + "_verticalCenter": 0, + "_horizontalCenter": 0, + "_isAbsLeft": false, + "_isAbsRight": false, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 300, + "_originalHeight": 20, + "_id": "" + }, + { + "__type__": "cc.Slider", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 6 + }, + "_enabled": true, + "direction": 0, + "slideEvents": [], + "_N$handle": { + "__id__": 13 + }, + "_N$progress": 0.5, + "_id": "" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__uuid__": "d2290efe-f7fd-465b-87fa-41172ed5529f" + }, + "fileId": "f3RRvqgCdFJb5/HF2inlH5", + "sync": false + }, + { + "__type__": "cc.Node", + "_name": "ValueLabel", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 19 + }, + { + "__id__": 20 + } + ], + "_prefab": { + "__id__": 21 + }, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 240, + "height": 40 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 1, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 480, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, + "_id": "" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 18 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 45, + "_left": 0.75, + "_right": 0, + "_top": 10, + "_bottom": 10, + "_verticalCenter": 0, + "_horizontalCenter": 0, + "_isAbsLeft": false, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 113.38, + "_originalHeight": 50.4, + "_id": "" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 18 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_useOriginalSize": false, + "_string": "0.10 | 26", + "_N$string": "0.10 | 26", + "_fontSize": 40, + "_lineHeight": 40, + "_enableWrapText": true, + "_N$file": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_batchAsBitmap": false, + "_N$horizontalAlign": 0, + "_N$verticalAlign": 1, + "_N$fontFamily": "Arial", + "_N$overflow": 2, + "_N$cacheMode": 0, + "_id": "" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__uuid__": "d2290efe-f7fd-465b-87fa-41172ed5529f" + }, + "fileId": "008HrwD25Oi41DjiFYThyA", + "sync": false + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 1 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 40, + "_left": 0, + "_right": 0, + "_top": 0, + "_bottom": 0, + "_verticalCenter": 0, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 461.38, + "_originalHeight": 0, + "_id": "" + }, + { + "__type__": "c5a62mBIfxGbaPtC1Zyp3jP", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 1 + }, + "_enabled": true, + "slider": { + "__id__": 16 + }, + "valueLabel": { + "__id__": 20 + }, + "_id": "" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__uuid__": "d2290efe-f7fd-465b-87fa-41172ed5529f" + }, + "fileId": "917ZB8DYlJSY/O0VyEgEDe", + "sync": false + } +] \ No newline at end of file diff --git a/assets/prefabs/GlowThresholdSliderPrefab.prefab.meta b/assets/prefabs/GlowThresholdSliderPrefab.prefab.meta new file mode 100644 index 0000000..2f02028 --- /dev/null +++ b/assets/prefabs/GlowThresholdSliderPrefab.prefab.meta @@ -0,0 +1,8 @@ +{ + "ver": "1.2.5", + "uuid": "d2290efe-f7fd-465b-87fa-41172ed5529f", + "optimizationPolicy": "AUTO", + "asyncLoadAssets": false, + "readonly": false, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/prefabs/GlowWidthSliderPrefab.prefab b/assets/prefabs/GlowWidthSliderPrefab.prefab index 13ac97a..d6d98c8 100644 --- a/assets/prefabs/GlowWidthSliderPrefab.prefab +++ b/assets/prefabs/GlowWidthSliderPrefab.prefab @@ -13,7 +13,7 @@ }, { "__type__": "cc.Node", - "_name": "GlowWidthSliderPrefab", + "_name": "GlowThresholdeSliderPrefab", "_objFlags": 0, "_parent": null, "_children": [ @@ -49,7 +49,7 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 576, + "width": 960, "height": 60 }, "_anchorPoint": { @@ -61,7 +61,7 @@ "__type__": "TypedArray", "ctor": "Float64Array", "array": [ - 0, + 480, -414, 0, 0, @@ -116,7 +116,7 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 144, + "width": 240, "height": 40 }, "_anchorPoint": { @@ -128,7 +128,7 @@ "__type__": "TypedArray", "ctor": "Float64Array", "array": [ - -144, + -240, 0, 0, 0, @@ -258,7 +258,7 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 230.40000000000003, + "width": 384, "height": 60 }, "_anchorPoint": { @@ -270,7 +270,7 @@ "__type__": "TypedArray", "ctor": "Float64Array", "array": [ - -115.20000000000002, + -192, 0, 0, 0, @@ -325,7 +325,7 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 230.40000000000003, + "width": 384, "height": 20 }, "_anchorPoint": { @@ -708,7 +708,7 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 144, + "width": 240, "height": 40 }, "_anchorPoint": { @@ -720,7 +720,7 @@ "__type__": "TypedArray", "ctor": "Float64Array", "array": [ - 288, + 480, 0, 0, 0, diff --git a/assets/scenes/GlowInnerEffectScene.fire b/assets/scenes/GlowInnerEffectScene.fire index 08779ad..a4a4297 100755 --- a/assets/scenes/GlowInnerEffectScene.fire +++ b/assets/scenes/GlowInnerEffectScene.fire @@ -78,10 +78,10 @@ "_active": true, "_components": [ { - "__id__": 40 + "__id__": 42 }, { - "__id__": 41 + "__id__": 43 } ], "_prefab": null, @@ -171,7 +171,7 @@ "array": [ 0, 0, - 393.1755333181352, + 418.2902700278839, 0, 0, 0, @@ -245,13 +245,13 @@ "__id__": 9 }, { - "__id__": 22 + "__id__": 24 } ], "_active": true, "_components": [ { - "__id__": 39 + "__id__": 41 } ], "_prefab": null, @@ -448,15 +448,18 @@ }, { "__id__": 18 + }, + { + "__id__": 20 } ], "_active": true, "_components": [ { - "__id__": 20 + "__id__": 22 }, { - "__id__": 21 + "__id__": 23 } ], "_prefab": null, @@ -471,7 +474,7 @@ "_contentSize": { "__type__": "cc.Size", "width": 576, - "height": 444 + "height": 540 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -737,6 +740,52 @@ "fileId": "917ZB8DYlJSY/O0VyEgEDe", "sync": true }, + { + "__type__": "cc.Node", + "_objFlags": 0, + "_parent": { + "__id__": 9 + }, + "_id": "7dyK4rM1JIDJrcOFFaMwaC", + "_prefab": { + "__id__": 21 + }, + "_name": "GlowThresholdSliderPrefab", + "_active": true, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + -510, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + } + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 20 + }, + "asset": { + "__uuid__": "d2290efe-f7fd-465b-87fa-41172ed5529f" + }, + "fileId": "917ZB8DYlJSY/O0VyEgEDe", + "sync": true + }, { "__type__": "cc.Widget", "_name": "", @@ -775,7 +824,7 @@ "_layoutSize": { "__type__": "cc.Size", "width": 576, - "height": 444 + "height": 540 }, "_resize": 1, "_N$layoutType": 2, @@ -806,28 +855,28 @@ }, "_children": [ { - "__id__": 23 + "__id__": 25 }, { - "__id__": 26 + "__id__": 28 }, { - "__id__": 29 + "__id__": 31 }, { - "__id__": 32 + "__id__": 34 }, { - "__id__": 35 + "__id__": 37 } ], "_active": true, "_components": [ { - "__id__": 37 + "__id__": 39 }, { - "__id__": 38 + "__id__": 40 } ], "_prefab": null, @@ -883,16 +932,16 @@ "_name": "ball_0", "_objFlags": 0, "_parent": { - "__id__": 22 + "__id__": 24 }, "_children": [], "_active": true, "_components": [ { - "__id__": 24 + "__id__": 26 }, { - "__id__": 25 + "__id__": 27 } ], "_prefab": null, @@ -948,7 +997,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 23 + "__id__": 25 }, "_enabled": true, "_materials": [ @@ -980,7 +1029,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 23 + "__id__": 25 }, "_enabled": true, "alignMode": 1, @@ -1007,16 +1056,16 @@ "_name": "cocos_logo", "_objFlags": 0, "_parent": { - "__id__": 22 + "__id__": 24 }, "_children": [], "_active": true, "_components": [ { - "__id__": 27 + "__id__": 29 }, { - "__id__": 28 + "__id__": 30 } ], "_prefab": null, @@ -1072,7 +1121,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 26 + "__id__": 28 }, "_enabled": true, "_materials": [ @@ -1104,7 +1153,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 26 + "__id__": 28 }, "_enabled": true, "alignMode": 1, @@ -1131,16 +1180,16 @@ "_name": "ball_1", "_objFlags": 0, "_parent": { - "__id__": 22 + "__id__": 24 }, "_children": [], "_active": true, "_components": [ { - "__id__": 30 + "__id__": 32 }, { - "__id__": 31 + "__id__": 33 } ], "_prefab": null, @@ -1196,7 +1245,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 29 + "__id__": 31 }, "_enabled": true, "_materials": [ @@ -1228,7 +1277,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 29 + "__id__": 31 }, "_enabled": true, "alignMode": 1, @@ -1255,16 +1304,16 @@ "_name": "video_btn", "_objFlags": 0, "_parent": { - "__id__": 22 + "__id__": 24 }, "_children": [], "_active": true, "_components": [ { - "__id__": 33 + "__id__": 35 }, { - "__id__": 34 + "__id__": 36 } ], "_prefab": null, @@ -1320,7 +1369,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 32 + "__id__": 34 }, "_enabled": true, "_materials": [ @@ -1352,7 +1401,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 32 + "__id__": 34 }, "_enabled": true, "alignMode": 1, @@ -1379,13 +1428,13 @@ "_name": "New Label", "_objFlags": 0, "_parent": { - "__id__": 22 + "__id__": 24 }, "_children": [], "_active": true, "_components": [ { - "__id__": 36 + "__id__": 38 } ], "_prefab": null, @@ -1441,7 +1490,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 35 + "__id__": 37 }, "_enabled": true, "_materials": [ @@ -1471,7 +1520,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 22 + "__id__": 24 }, "_enabled": true, "alignMode": 1, @@ -1498,7 +1547,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 22 + "__id__": 24 }, "_enabled": true, "_layoutSize": { diff --git a/assets/scripts/GlowInnerEffectScene.ts b/assets/scripts/GlowInnerEffectScene.ts index 0040b8a..f90b97a 100644 --- a/assets/scripts/GlowInnerEffectScene.ts +++ b/assets/scripts/GlowInnerEffectScene.ts @@ -7,6 +7,7 @@ export default class GlowInnerEffectScene extends cc.Component { private _blueSlider: cc.Slider = null; private _alphaSlider: cc.Slider = null; private _widthSlider: cc.Slider = null; + private _glowThresholdSlider: cc.Slider = null; private _examplesParentNode: cc.Node = null; onLoad() { @@ -15,6 +16,7 @@ export default class GlowInnerEffectScene extends cc.Component { this._blueSlider = cc.find("Canvas/Content/SliderLayouts/ColorBlueSliderPrefab/Slider").getComponent(cc.Slider); this._alphaSlider = cc.find("Canvas/Content/SliderLayouts/ColorAlphaSliderPrefab/Slider").getComponent(cc.Slider); this._widthSlider = cc.find("Canvas/Content/SliderLayouts/GlowWidthSliderPrefab/Slider").getComponent(cc.Slider); + this._glowThresholdSlider = cc.find("Canvas/Content/SliderLayouts/GlowThresholdSliderPrefab/Slider").getComponent(cc.Slider); this._examplesParentNode = cc.find("Canvas/Content/Examples"); } @@ -24,6 +26,7 @@ export default class GlowInnerEffectScene extends cc.Component { this._blueSlider.node.on("slide", this._onSliderChanged, this); this._alphaSlider.node.on("slide", this._onSliderChanged, this); this._widthSlider.node.on("slide", this._onSliderChanged, this); + this._glowThresholdSlider.node.on("slide", this._onSliderChanged, this); } onDisable() { @@ -32,6 +35,7 @@ export default class GlowInnerEffectScene extends cc.Component { this._blueSlider.node.off("slide", this._onSliderChanged, this); this._alphaSlider.node.off("slide", this._onSliderChanged, this); this._widthSlider.node.off("slide", this._onSliderChanged, this); + this._glowThresholdSlider.node.off("slide", this._onSliderChanged, this); } start() { @@ -41,7 +45,8 @@ export default class GlowInnerEffectScene extends cc.Component { private _onSliderChanged() { this._updateRenderComponentOutterGlowMaterial({ glowColor: cc.v4(this._redSlider.progress, this._greenSlider.progress, this._blueSlider.progress, this._alphaSlider.progress), - glowColorSize: this._widthSlider.progress * 0.01 + glowColorSize: this._widthSlider.progress * 0.01, + glowThreshold: this._glowThresholdSlider.progress * 0.01 }); } @@ -62,12 +67,18 @@ export default class GlowInnerEffectScene extends cc.Component { * 发光颜色 [0.0, 1.0] */ glowColor: cc.Vec4; + + /** + * 发光阈值 [0.0, 1.0] + */ + glowThreshold: number; }) { this._examplesParentNode.children.forEach(childNode => { childNode.getComponents(cc.RenderComponent).forEach(renderComponent => { let material: cc.Material = renderComponent.getMaterial(0); material.setProperty("glowColorSize", param.glowColorSize); material.setProperty("glowColor", param.glowColor); + material.setProperty("glowThreshold", param.glowThreshold); renderComponent.setMaterial(0, material); }); }); diff --git a/assets/scripts/common/prefabs/GlowThresholdSliderPrefab.ts b/assets/scripts/common/prefabs/GlowThresholdSliderPrefab.ts new file mode 100644 index 0000000..834cc71 --- /dev/null +++ b/assets/scripts/common/prefabs/GlowThresholdSliderPrefab.ts @@ -0,0 +1,27 @@ +const { ccclass, property } = cc._decorator; + +@ccclass +export default class GlowThresholdSliderPrefab extends cc.Component { + @property(cc.Slider) + slider: cc.Slider = null; + + @property(cc.Label) + valueLabel: cc.Label = null; + + onEnable() { + this.slider.node.on("slide", this._onSliderChanged, this); + } + + onDisable() { + this.slider.node.off("slide", this._onSliderChanged, this); + } + + start() { + this._onSliderChanged(); + } + + private _onSliderChanged() { + let realProgress = this.slider.progress * 0.01; + this.valueLabel.string = `${(realProgress * 100).toFixed(2)}%`; + } +} diff --git a/assets/scripts/common/prefabs/GlowThresholdSliderPrefab.ts.meta b/assets/scripts/common/prefabs/GlowThresholdSliderPrefab.ts.meta new file mode 100644 index 0000000..ccf3935 --- /dev/null +++ b/assets/scripts/common/prefabs/GlowThresholdSliderPrefab.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.0.5", + "uuid": "c5a62981-21fc-466d-a3ed-0b5672a778cf", + "isPlugin": false, + "loadPluginInWeb": true, + "loadPluginInNative": true, + "loadPluginInEditor": false, + "subMetas": {} +} \ No newline at end of file