Commit 9d1fbece authored by Friends233's avatar Friends233

暂存

parent a9b742fc
This diff is collapsed.
...@@ -18,7 +18,6 @@ export default class NewClass extends cc.Component { ...@@ -18,7 +18,6 @@ export default class NewClass extends cc.Component {
state state
} }
cc.find('Canvas').dispatchEvent(this.event) cc.find('Canvas').dispatchEvent(this.event)
console.log(cc.find('Canvas'))
} }
start() { start() {
this.event = new cc.Event.EventCustom("test", true) this.event = new cc.Event.EventCustom("test", true)
......
...@@ -12,7 +12,7 @@ const { ccclass, property } = cc._decorator; ...@@ -12,7 +12,7 @@ const { ccclass, property } = cc._decorator;
// 爪子状态 // 爪子状态
const CLIP_STATE = { const CLIP_STATE = {
/** 默认 */ /** 默认 */
DEFAULT: 'default', DEFAULT: 'clipAni',
/** 出钩 */ /** 出钩 */
PLAY: 'clipPlay', PLAY: 'clipPlay',
/** 收回 */ /** 收回 */
...@@ -50,9 +50,9 @@ export default class NewClass extends cc.Component { ...@@ -50,9 +50,9 @@ export default class NewClass extends cc.Component {
start() { start() {
this.refreshLevelInfo() this.refreshLevelInfo()
this.clipAni = cc.find('clip/clipWrp/defa', this.node).getComponent(cc.Animation) this.clipAni = cc.find('clipWrp/clip', this.node).getComponent(cc.Animation)
this.addNodeEvent() this.addNodeEvent()
this.node.on("test", this.onAnimCompleted,this) this.node.on("test", this.onAnimCompleted, this)
} }
/** 爪子事件 */ /** 爪子事件 */
...@@ -72,19 +72,12 @@ export default class NewClass extends cc.Component { ...@@ -72,19 +72,12 @@ export default class NewClass extends cc.Component {
addNodeEvent() { addNodeEvent() {
const gameBtn = cc.find('gameBtn', this.node) const gameBtn = cc.find('gameBtn', this.node)
gameBtn.on(cc.Node.EventType.TOUCH_END, this.playGame, this) gameBtn.on(cc.Node.EventType.TOUCH_END, this.playGame, this)
const clip = this.clipAni
clip.on('palyEnd', () => {
console.log('end')
}, this)
clip.on('stop', () => {
}, this)
} }
/** 设置爪子状态 */ /** 设置爪子状态 */
setClipState(state) { setClipState(state) {
const ani = cc.find('clip/clipWrp', this.node).getComponent(cc.Animation) const ani = cc.find('clipWrp', this.node).getComponent(cc.Animation)
const node = cc.find('clip/clipWrp/defa', this.node) const node = cc.find('clipWrp/clip', this.node)
const clip = node.getComponent(cc.Animation), spf = node.getComponent(cc.Sprite).spriteFrame const clip = node.getComponent(cc.Animation), spf = node.getComponent(cc.Sprite).spriteFrame
spf.insetBottom = 125 spf.insetBottom = 125
spf.insetTop = 10 spf.insetTop = 10
...@@ -92,12 +85,16 @@ export default class NewClass extends cc.Component { ...@@ -92,12 +85,16 @@ export default class NewClass extends cc.Component {
switch (state) { switch (state) {
case CLIP_STATE.DEFAULT: case CLIP_STATE.DEFAULT:
ani.resume() ani.resume()
clip.play(state)
break; break;
case CLIP_STATE.PLAY: case CLIP_STATE.PLAY:
clip.pause(CLIP_STATE.DEFAULT)
ani.pause() ani.pause()
clip.play(state) clip.play(state)
break; break;
case CLIP_STATE.STOP: case CLIP_STATE.STOP:
clip.pause(CLIP_STATE.DEFAULT)
ani.pause() ani.pause()
clip.play(state) clip.play(state)
break; break;
......
const { ccclass, property, menu } = cc._decorator;
/**
* 图片适配大小
*/
@ccclass
@menu("framework/ImgFixedSize")
export default class ImgFixedSize extends cc.Component {
@property({ type: cc.Integer, tooltip: "固定尺寸" })
public set fixedSize(value) {
this._fixedSize = value;
this.onSizeChanged();
}
public get fixedSize() {
return this._fixedSize;
}
@property({ type: cc.Integer, tooltip: "固定尺寸" })
private _fixedSize: number = 1;
onLoad() {
this._fixedSize = this.fixedSize;
this.node.on(cc.Node.EventType.SIZE_CHANGED, this.onSizeChanged, this);
this.onSizeChanged();
}
/**当尺寸变化时,重置node节点大小 */
onSizeChanged() {
var width = this.node.width;
var height = this.node.height;
var max = Math.max(width, height);
this.node.scale = this.fixedSize / max;
}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "3ea06ec2-26e8-46c4-9994-b2e659d578de",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
/**
* 十六进制颜色转rgb
* @param str
* @returns
*/
export const set16ToRgb = (str) => { export const set16ToRgb = (str) => {
if(!str) return if(!str) return
var reg = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/ var reg = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/
......
This diff is collapsed.
...@@ -19,7 +19,8 @@ ...@@ -19,7 +19,8 @@
"value": 648 "value": 648
} }
] ]
} },
"paths": {}
}, },
"events": [ "events": [
{ {
......
...@@ -19,7 +19,8 @@ ...@@ -19,7 +19,8 @@
"value": 648 "value": 648
} }
] ]
} },
"paths": {}
}, },
"events": [ "events": [
{ {
......
...@@ -28,9 +28,9 @@ ...@@ -28,9 +28,9 @@
"height": 138, "height": 138,
"rawWidth": 120, "rawWidth": 120,
"rawHeight": 154, "rawHeight": 154,
"borderTop": 0, "borderTop": 4,
"borderBottom": 0, "borderBottom": 119,
"borderLeft": 0, "borderLeft": 85,
"borderRight": 0, "borderRight": 0,
"subMetas": {} "subMetas": {}
} }
......
{
"ver": "2.3.7",
"uuid": "33aac5d8-2d22-4838-9632-057853ac75ad",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 11,
"height": 44,
"platformSettings": {},
"subMetas": {
"line": {
"ver": "1.0.6",
"uuid": "f0d6e4a1-32f5-4e09-b07d-6f92c846a696",
"importer": "sprite-frame",
"rawTextureUuid": "33aac5d8-2d22-4838-9632-057853ac75ad",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 11,
"height": 44,
"rawWidth": 11,
"rawHeight": 44,
"borderTop": 20,
"borderBottom": 7,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.1.3",
"uuid": "85fe8788-0729-4434-a620-501ed6157527",
"importer": "folder",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.7",
"uuid": "51faa006-8beb-4f2b-b4b5-0b655f1da2cf",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 133,
"height": 145,
"platformSettings": {},
"subMetas": {
"夹子夹_00000": {
"ver": "1.0.6",
"uuid": "9f9b15ed-14ef-441f-a30c-09ef39aa5da4",
"importer": "sprite-frame",
"rawTextureUuid": "51faa006-8beb-4f2b-b4b5-0b655f1da2cf",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0.5,
"offsetY": 2,
"trimX": 7,
"trimY": 1,
"width": 120,
"height": 139,
"rawWidth": 133,
"rawHeight": 145,
"borderTop": 5,
"borderBottom": 120,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.7",
"uuid": "021bf573-d016-49e7-8602-f0225a9c6e46",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 133,
"height": 145,
"platformSettings": {},
"subMetas": {
"夹子夹_00001": {
"ver": "1.0.6",
"uuid": "2476d47e-cf46-4888-b9a0-7cc039485dd2",
"importer": "sprite-frame",
"rawTextureUuid": "021bf573-d016-49e7-8602-f0225a9c6e46",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 1,
"offsetY": 1,
"trimX": 11,
"trimY": 1,
"width": 113,
"height": 141,
"rawWidth": 133,
"rawHeight": 145,
"borderTop": 7,
"borderBottom": 122,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.7",
"uuid": "d9f8161a-adac-4f05-90ce-db88e3e78168",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 133,
"height": 145,
"platformSettings": {},
"subMetas": {
"夹子夹_00002": {
"ver": "1.0.6",
"uuid": "d75a7db3-1b4a-450f-b766-745a8172efa8",
"importer": "sprite-frame",
"rawTextureUuid": "d9f8161a-adac-4f05-90ce-db88e3e78168",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0.5,
"offsetY": 0.5,
"trimX": 15,
"trimY": 1,
"width": 104,
"height": 142,
"rawWidth": 133,
"rawHeight": 145,
"borderTop": 7.5,
"borderBottom": 122.5,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.7",
"uuid": "6e2ca9c0-e5cc-4280-aed8-bb8d6da56ee6",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 133,
"height": 145,
"platformSettings": {},
"subMetas": {
"夹子夹_00003": {
"ver": "1.0.6",
"uuid": "57f3929b-38bc-4532-a855-a125d00755cc",
"importer": "sprite-frame",
"rawTextureUuid": "6e2ca9c0-e5cc-4280-aed8-bb8d6da56ee6",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 1,
"offsetY": 1,
"trimX": 18,
"trimY": 1,
"width": 99,
"height": 141,
"rawWidth": 133,
"rawHeight": 145,
"borderTop": 7,
"borderBottom": 122,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.7",
"uuid": "70486fc8-019b-4f85-8f2f-6423f4721ccb",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 96,
"height": 138,
"platformSettings": {},
"subMetas": {
"夹子夹_00004": {
"ver": "1.0.6",
"uuid": "b08167e4-2bc5-464c-b4b1-b8646889045f",
"importer": "sprite-frame",
"rawTextureUuid": "70486fc8-019b-4f85-8f2f-6423f4721ccb",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 96,
"height": 138,
"rawWidth": 96,
"rawHeight": 138,
"borderTop": 15,
"borderBottom": 116,
"borderLeft": 85,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment