mirror of
https://github.com/smallmain/cocos-enhance-kit.git
synced 2024-12-25 03:08:29 +00:00
初版引擎插件
This commit is contained in:
parent
4a15fd2b39
commit
dea7780c01
42
.gitignore
vendored
Normal file
42
.gitignore
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# npm files
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
npm-debug.log
|
||||
node_modules/
|
||||
package-lock.json
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# OS generated files
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
.DS_Store
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# WebStorm files
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
.idea/
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# VS Code files
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/**/*.code-snippets
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# Temp files
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
temp
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# 使用 Creator 调试时会为每个脚本生成 .meta 文件
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
**/*.meta
|
129
extension/service-pack-support/inspectors/comps/label.js
Normal file
129
extension/service-pack-support/inspectors/comps/label.js
Normal file
@ -0,0 +1,129 @@
|
||||
"use strict";
|
||||
Vue.component("cc-label", {
|
||||
dependencies: ["packages://inspector/share/blend.js"],
|
||||
template: `
|
||||
<ui-prop
|
||||
v-prop="target.string"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
<ui-prop
|
||||
v-prop="target.horizontalAlign"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
<ui-prop
|
||||
v-prop="target.verticalAlign"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
|
||||
<ui-prop
|
||||
v-prop="target.actualFontSize"
|
||||
v-show="!_hiddenActualFontSize()"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
<ui-prop type="number"
|
||||
v-prop="target.fontSize">
|
||||
:multi-values="multi"
|
||||
</ui-prop>
|
||||
<ui-prop
|
||||
v-prop="target._bmFontOriginalSize"
|
||||
v-show="_isBMFont()"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
|
||||
<ui-prop
|
||||
v-prop="target.lineHeight"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
<ui-prop
|
||||
v-prop="target.spacingX"
|
||||
v-show="_isBMFont()"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
<ui-prop
|
||||
v-prop="target.overflow"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
<ui-prop
|
||||
v-prop="target.enableWrapText"
|
||||
v-show="!_hiddenWrapText()"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
<ui-prop
|
||||
v-prop="target.font"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
<ui-prop
|
||||
v-prop="target.fontFamily"
|
||||
v-show="_isSystemFont()"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
<ui-prop
|
||||
v-prop="target.enableBold"
|
||||
v-show="!_isBMFont()"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
<ui-prop
|
||||
v-prop="target.enableItalic"
|
||||
v-show="!_isBMFont()"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
<ui-prop
|
||||
v-prop="target.enableUnderline"
|
||||
v-show="!_isBMFont()"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
<ui-prop
|
||||
v-prop="target.underlineHeight"
|
||||
v-show="!_isBMFont() && target.enableUnderline.value === true"
|
||||
:indent="1"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
<ui-prop
|
||||
v-prop="target.cacheMode"
|
||||
v-show="!_isBMFont()"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
<ui-prop
|
||||
v-prop="target.useSystemFont"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
|
||||
<cc-blend-section :target.sync="target"></cc-blend-section>
|
||||
<cc-array-prop
|
||||
v-show="!_isCharCacheMode()"
|
||||
:target.sync="target.materials"
|
||||
></cc-array-prop>
|
||||
|
||||
<ui-prop v-prop="target.autoSwitchMaterial"></ui-prop>
|
||||
<ui-prop v-prop="target.allowDynamicAtlas"></ui-prop>
|
||||
<ui-prop v-prop="target.enableRetina"></ui-prop>
|
||||
`,
|
||||
props: {
|
||||
target: {
|
||||
twoWay: !0,
|
||||
type: Object
|
||||
},
|
||||
multi: {
|
||||
type: Boolean
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
T: Editor.T,
|
||||
_isBMFont() {
|
||||
return this.target._bmFontOriginalSize.value > 0
|
||||
},
|
||||
_isSystemFont() {
|
||||
return this.target.useSystemFont.value
|
||||
},
|
||||
_hiddenWrapText() {
|
||||
let t = this.target.overflow.value;
|
||||
return 0 === t || 3 === t
|
||||
},
|
||||
_hiddenActualFontSize() {
|
||||
return 2 !== this.target.overflow.value
|
||||
},
|
||||
_isCharCacheMode() {
|
||||
return 2 === this.target.cacheMode.value
|
||||
},
|
||||
}
|
||||
});
|
70
extension/service-pack-support/inspectors/comps/richtext.js
Normal file
70
extension/service-pack-support/inspectors/comps/richtext.js
Normal file
@ -0,0 +1,70 @@
|
||||
"use strict";
|
||||
Vue.component("cc-richtext", {
|
||||
template: `
|
||||
<ui-prop
|
||||
v-prop="target.string"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
<ui-prop
|
||||
v-prop="target.horizontalAlign"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
<ui-prop
|
||||
v-prop="target.fontSize">
|
||||
:multi-values="multi"
|
||||
</ui-prop>
|
||||
<ui-prop
|
||||
v-prop="target.font"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
<ui-prop
|
||||
v-prop="target.fontFamily"
|
||||
v-show="_isSystemFont()"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
<ui-prop
|
||||
v-prop="target.useSystemFont"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
<ui-prop
|
||||
v-prop="target.cacheMode"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
<ui-prop
|
||||
v-prop="target.maxWidth"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
<ui-prop
|
||||
v-prop="target.lineHeight"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
<ui-prop
|
||||
v-prop="target.imageAtlas"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
<ui-prop
|
||||
v-prop="target.handleTouchEvent"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
|
||||
<ui-prop v-prop="target.customMaterial"></ui-prop>
|
||||
<ui-prop v-prop="target.autoSwitchMaterial"></ui-prop>
|
||||
<ui-prop v-prop="target.allowDynamicAtlas"></ui-prop>
|
||||
<ui-prop v-prop="target.enableRetina"></ui-prop>
|
||||
`,
|
||||
props: {
|
||||
target: {
|
||||
twoWay: !0,
|
||||
type: Object
|
||||
},
|
||||
multi: {
|
||||
type: Boolean
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
T: Editor.T,
|
||||
_isSystemFont() {
|
||||
return this.target.useSystemFont.value
|
||||
}
|
||||
}
|
||||
});
|
155
extension/service-pack-support/inspectors/comps/sprite.js
Normal file
155
extension/service-pack-support/inspectors/comps/sprite.js
Normal file
@ -0,0 +1,155 @@
|
||||
"use strict";
|
||||
Vue.component("cc-sprite", {
|
||||
dependencies: ["packages://inspector/share/blend.js"],
|
||||
template: `
|
||||
<ui-prop
|
||||
style="padding-top: 8px"
|
||||
name="Atlas"
|
||||
tooltip="{{T('COMPONENT.sprite.atlas')}}"
|
||||
>
|
||||
<ui-asset class="flex-1"
|
||||
type="sprite-atlas"
|
||||
v-value="target._atlas.value.uuid"
|
||||
v-values="atlasUuids"
|
||||
:multi-values="atlasMulti"
|
||||
></ui-asset>
|
||||
<ui-button
|
||||
class="blue tiny"
|
||||
tooltip="{{T('COMPONENT.sprite.select_tooltip')}}"
|
||||
@confirm="selectAtlas"
|
||||
>
|
||||
{{T('COMPONENT.sprite.select_button')}}
|
||||
</ui-button>
|
||||
</ui-prop>
|
||||
|
||||
<ui-prop
|
||||
style="padding-top: 8px"
|
||||
name="Sprite Frame"
|
||||
tooltip="{{T('COMPONENT.sprite.sprite_frame')}}"
|
||||
>
|
||||
<ui-asset class="flex-1"
|
||||
type="sprite-frame"
|
||||
v-value="target.spriteFrame.value.uuid"
|
||||
v-values="spriteUuids"
|
||||
:multi-values="spriteMulti"
|
||||
></ui-asset>
|
||||
<ui-button
|
||||
class="blue tiny"
|
||||
tooltip="{{T('COMPONENT.sprite.edit_tooltip')}}"
|
||||
@confirm="editSprite"
|
||||
>
|
||||
{{T('COMPONENT.sprite.edit_button')}}
|
||||
</ui-button>
|
||||
</ui-prop>
|
||||
|
||||
<ui-prop
|
||||
v-prop="target.type"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
|
||||
<div v-if="isFilledType()">
|
||||
<ui-prop indent=1
|
||||
v-prop="target.fillType"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
<ui-prop indent=1
|
||||
v-prop="target.fillCenter"
|
||||
v-disabled="!isRadialFilled()"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
<ui-prop indent=1
|
||||
v-prop="target.fillStart"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
<ui-prop indent=1
|
||||
v-prop="target.fillRange"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
</div>
|
||||
|
||||
<ui-prop
|
||||
v-prop="target.sizeMode"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
<ui-prop v-if="allowTrim()"
|
||||
v-prop="target.trim"
|
||||
:multi-values="multi"
|
||||
></ui-prop>
|
||||
|
||||
<cc-blend-section :target.sync="target"></cc-blend-section>
|
||||
<cc-array-prop :target.sync="target.materials"></cc-array-prop>
|
||||
|
||||
<ui-prop v-prop="target.autoSwitchMaterial"></ui-prop>
|
||||
<ui-prop v-prop="target.allowDynamicAtlas"></ui-prop>
|
||||
`,
|
||||
props: {
|
||||
target: {
|
||||
twoWay: !0,
|
||||
type: Object
|
||||
},
|
||||
multi: {
|
||||
twoWay: !0,
|
||||
type: Boolean
|
||||
}
|
||||
},
|
||||
data: ()=>({
|
||||
atlasUuid: "",
|
||||
atlasUuids: "",
|
||||
atlasMulti: !1,
|
||||
spriteUuid: "",
|
||||
spriteUuids: "",
|
||||
spriteMulti: !1
|
||||
}),
|
||||
created() {
|
||||
this.target && (this._updateAtlas(),
|
||||
this._updateSprite())
|
||||
},
|
||||
watch: {
|
||||
target() {
|
||||
this._updateAtlas(),
|
||||
this._updateSprite()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
T: Editor.T,
|
||||
selectAtlas() {
|
||||
Editor.Ipc.sendToPanel("assets", "change-filter", "t:sprite-atlas")
|
||||
},
|
||||
editSprite() {
|
||||
Editor.Panel.open("sprite-editor", {
|
||||
uuid: this.target.spriteFrame.value.uuid
|
||||
})
|
||||
},
|
||||
allowTrim() {
|
||||
return this.target.type.value === cc.Sprite.Type.SIMPLE
|
||||
},
|
||||
isFilledType() {
|
||||
return this.target.type.value === cc.Sprite.Type.FILLED
|
||||
},
|
||||
isRadialFilled() {
|
||||
return this.target.fillType.value === cc.Sprite.FillType.RADIAL
|
||||
},
|
||||
_updateAtlas() {
|
||||
if (!this.target)
|
||||
return this.atlasUuid = "",
|
||||
this.atlasUuids = "",
|
||||
this.atlasMulti = !1,
|
||||
void 0;
|
||||
this.atlasUuid = this.target._atlas.value.uuid,
|
||||
this.atlasUuids = this.target._atlas.values.map(t=>t.uuid);
|
||||
var t = this.atlasUuids[0];
|
||||
this.atlasMulti = !this.atlasUuids.every((i,e)=>0 === e || i === t)
|
||||
},
|
||||
_updateSprite() {
|
||||
if (!this.target)
|
||||
return this.spriteUuid = "",
|
||||
this.spriteUuids = "",
|
||||
this.spriteMulti = !1,
|
||||
void 0;
|
||||
this.spriteUuid = this.target.spriteFrame.value.uuid,
|
||||
this.spriteUuids = this.target.spriteFrame.values.map(t=>t.uuid);
|
||||
var t = this.spriteUuids[0];
|
||||
this.spriteMulti = !this.spriteUuids.every((i,e)=>0 === e || i === t)
|
||||
}
|
||||
}
|
||||
});
|
3
extension/service-pack-support/main.js
Normal file
3
extension/service-pack-support/main.js
Normal file
@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {};
|
16
extension/service-pack-support/package.json
Normal file
16
extension/service-pack-support/package.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "service-pack",
|
||||
"version": "1.0.0",
|
||||
"description": "This extension provides support for cocos service pack.",
|
||||
"author": "SmallMain",
|
||||
"main": "main.js",
|
||||
"runtime-resource": {
|
||||
"path": "resources",
|
||||
"name": "resources"
|
||||
},
|
||||
"reload": {
|
||||
"ignore": [
|
||||
"resources/**/*"
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,114 @@
|
||||
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
CCEffect %{
|
||||
techniques:
|
||||
- passes:
|
||||
- vert: vs
|
||||
frag: fs
|
||||
blendState:
|
||||
targets:
|
||||
- blend: true
|
||||
rasterizerState:
|
||||
cullMode: none
|
||||
properties:
|
||||
texture: { value: white }
|
||||
texture2: { value: white }
|
||||
texture3: { value: white }
|
||||
texture4: { value: white }
|
||||
texture5: { value: white }
|
||||
texture6: { value: white }
|
||||
texture7: { value: white }
|
||||
texture8: { value: white }
|
||||
alphaThreshold: { value: 0.5 }
|
||||
}%
|
||||
|
||||
|
||||
CCProgram vs %{
|
||||
precision highp float;
|
||||
|
||||
#include <cc-global>
|
||||
#include <cc-local>
|
||||
|
||||
in vec3 a_position;
|
||||
in vec4 a_color;
|
||||
out vec4 v_color;
|
||||
|
||||
#if USE_TEXTURE
|
||||
in vec2 a_uv0;
|
||||
out vec2 v_uv0;
|
||||
in float a_texId;
|
||||
out float v_texId;
|
||||
#endif
|
||||
|
||||
void main () {
|
||||
vec4 pos = vec4(a_position, 1);
|
||||
|
||||
#if CC_USE_MODEL
|
||||
pos = cc_matViewProj * cc_matWorld * pos;
|
||||
#else
|
||||
pos = cc_matViewProj * pos;
|
||||
#endif
|
||||
|
||||
#if USE_TEXTURE
|
||||
v_uv0 = a_uv0;
|
||||
v_texId = a_texId;
|
||||
#endif
|
||||
|
||||
v_color = a_color;
|
||||
|
||||
gl_Position = pos;
|
||||
}
|
||||
}%
|
||||
|
||||
|
||||
CCProgram fs %{
|
||||
precision highp float;
|
||||
|
||||
#include <alpha-test>
|
||||
#include <texture>
|
||||
|
||||
in vec4 v_color;
|
||||
|
||||
#if USE_TEXTURE
|
||||
in vec2 v_uv0;
|
||||
in float v_texId;
|
||||
uniform sampler2D texture;
|
||||
uniform sampler2D texture2;
|
||||
uniform sampler2D texture3;
|
||||
uniform sampler2D texture4;
|
||||
uniform sampler2D texture5;
|
||||
uniform sampler2D texture6;
|
||||
uniform sampler2D texture7;
|
||||
uniform sampler2D texture8;
|
||||
#endif
|
||||
|
||||
void main () {
|
||||
vec4 o = vec4(1, 1, 1, 1);
|
||||
|
||||
#if USE_TEXTURE
|
||||
if(v_texId < 1.0){
|
||||
CCTexture(texture, v_uv0, o);
|
||||
} else if(v_texId < 2.0){
|
||||
CCTexture(texture2, v_uv0, o);
|
||||
} else if(v_texId < 3.0){
|
||||
CCTexture(texture3, v_uv0, o);
|
||||
} else if(v_texId < 4.0){
|
||||
CCTexture(texture4, v_uv0, o);
|
||||
} else if(v_texId < 5.0){
|
||||
CCTexture(texture5, v_uv0, o);
|
||||
} else if(v_texId < 6.0){
|
||||
CCTexture(texture6, v_uv0, o);
|
||||
} else if(v_texId < 7.0){
|
||||
CCTexture(texture7, v_uv0, o);
|
||||
} else {
|
||||
CCTexture(texture8, v_uv0, o);
|
||||
}
|
||||
#endif
|
||||
|
||||
o *= v_color;
|
||||
|
||||
ALPHA_TEST(o);
|
||||
|
||||
gl_FragColor = o;
|
||||
}
|
||||
}%
|
Loading…
Reference in New Issue
Block a user