diff --git a/assets/core/chip.meta b/assets/core/chip.meta new file mode 100644 index 0000000..ef7d8ea --- /dev/null +++ b/assets/core/chip.meta @@ -0,0 +1,13 @@ +{ + "ver": "1.1.3", + "uuid": "c3c21a4a-e1a3-407d-a865-de0a631f9c0f", + "importer": "folder", + "isBundle": false, + "bundleName": "", + "priority": 1, + "compressionType": {}, + "optimizeHotUpdate": {}, + "inlineSpriteFrames": {}, + "isRemoteBundle": {}, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/core/chip/config.meta b/assets/core/chip/config.meta new file mode 100644 index 0000000..3b0bd82 --- /dev/null +++ b/assets/core/chip/config.meta @@ -0,0 +1,13 @@ +{ + "ver": "1.1.3", + "uuid": "dc4c782c-195a-420e-99f4-fb7552dbb61d", + "importer": "folder", + "isBundle": false, + "bundleName": "", + "priority": 1, + "compressionType": {}, + "optimizeHotUpdate": {}, + "inlineSpriteFrames": {}, + "isRemoteBundle": {}, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/core/chip/config/chip-color-config.ts b/assets/core/chip/config/chip-color-config.ts new file mode 100644 index 0000000..18697e6 --- /dev/null +++ b/assets/core/chip/config/chip-color-config.ts @@ -0,0 +1,35 @@ + +export class ChipColorConfig +{ + private static mapHexColorByValue: Map = new Map([ + [1, "#741F20"], + [2, "#742356"], + [3, "#1B5B15"], + [4, "#1B5B15"], + [5, "#9D4065"], + [6, "#9D4065"], + [7, "#9D4065"], + [8, "#9D4065"], + [9, "#9D4065"], + [10, "#201F5E"], + [11, "#201F5E"], + [12, "#201F5E"], + [13, "#201F5E"], + [14, "#201F5E"], + [15, "#201F5E"], + [16, "#201F5E"], + ]); + + public static GetColor(chipValue: Number): cc.Color + { + var colorHex = this.mapHexColorByValue.get(chipValue); + if (colorHex == null) + { + return cc.Color.WHITE; + } else + { + var color = new cc.Color().fromHEX(colorHex);; + return color; + } + } +} \ No newline at end of file diff --git a/assets/core/chip/config/chip-color-config.ts.meta b/assets/core/chip/config/chip-color-config.ts.meta new file mode 100644 index 0000000..6be8590 --- /dev/null +++ b/assets/core/chip/config/chip-color-config.ts.meta @@ -0,0 +1,10 @@ +{ + "ver": "1.1.0", + "uuid": "f3e6582e-d503-481d-bbbd-b4be508e6dc6", + "importer": "typescript", + "isPlugin": false, + "loadPluginInWeb": true, + "loadPluginInNative": true, + "loadPluginInEditor": false, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/core/chip/prefabs.meta b/assets/core/chip/prefabs.meta new file mode 100644 index 0000000..e182a70 --- /dev/null +++ b/assets/core/chip/prefabs.meta @@ -0,0 +1,13 @@ +{ + "ver": "1.1.3", + "uuid": "c22fe85b-e5b1-4a52-919f-0e777095af56", + "importer": "folder", + "isBundle": false, + "bundleName": "", + "priority": 1, + "compressionType": {}, + "optimizeHotUpdate": {}, + "inlineSpriteFrames": {}, + "isRemoteBundle": {}, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/core/chip/prefabs/chip.prefab b/assets/core/chip/prefabs/chip.prefab new file mode 100644 index 0000000..f96958a --- /dev/null +++ b/assets/core/chip/prefabs/chip.prefab @@ -0,0 +1,436 @@ +[ + { + "__type__": "cc.Prefab", + "_name": "", + "_objFlags": 0, + "_native": "", + "data": { + "__id__": 1 + }, + "optimizationPolicy": 0, + "asyncLoadAssets": false, + "readonly": false + }, + { + "__type__": "cc.Node", + "_name": "chip", + "_objFlags": 0, + "_parent": null, + "_children": [ + { + "__id__": 2 + }, + { + "__id__": 5 + }, + { + "__id__": 8 + } + ], + "_active": true, + "_components": [ + { + "__id__": 11 + } + ], + "_prefab": { + "__id__": 12 + }, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 138, + "height": 138 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + -60.678, + 0, + 0, + 0, + 0, + 0, + 1, + 0.65, + 0.65, + 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": "below-layer", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 3 + } + ], + "_prefab": { + "__id__": 4 + }, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 116, + "g": 31, + "b": 32, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 140, + "height": 140 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0.636, + 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__": 2 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "bff54f22-0f2d-4eb3-a256-0a5ca31f36f5" + }, + "_type": 0, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "43ANAqfhhCD4xTCOMvW5nT", + "sync": false + }, + { + "__type__": "cc.Node", + "_name": "above-layer", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 6 + } + ], + "_prefab": { + "__id__": 7 + }, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 140, + "height": 140 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0.636, + 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__": 5 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "03a08d17-a871-4148-88c4-49181c0f25e2" + }, + "_type": 0, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "2dmBPBa/ZJPakJqfb7CrHt", + "sync": false + }, + { + "__type__": "cc.Node", + "_name": "label-value", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 9 + } + ], + "_prefab": { + "__id__": 10 + }, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 80, + "height": 78.12 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 1, + 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__": 8 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_string": "1", + "_N$string": "1", + "_fontSize": 62, + "_lineHeight": 62, + "_enableWrapText": true, + "_N$file": null, + "_isSystemFontUsed": false, + "_spacingX": 0, + "_batchAsBitmap": false, + "_styleFlags": 0, + "_underlineHeight": 0, + "_N$horizontalAlign": 1, + "_N$verticalAlign": 1, + "_N$fontFamily": "Arial", + "_N$overflow": 2, + "_N$cacheMode": 0, + "_id": "" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "06lDa363xGZKXU/10WRDWE", + "sync": false + }, + { + "__type__": "2b048YbtMZEWrnIdtkXQ/EK", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 1 + }, + "_enabled": true, + "labelChipValue": { + "__id__": 9 + }, + "nodeChipColor": { + "__id__": 2 + }, + "value": 1, + "_id": "" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "", + "sync": false + } +] \ No newline at end of file diff --git a/assets/core/chip/prefabs/chip.prefab.meta b/assets/core/chip/prefabs/chip.prefab.meta new file mode 100644 index 0000000..f314275 --- /dev/null +++ b/assets/core/chip/prefabs/chip.prefab.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.3.2", + "uuid": "ad6757ac-55f7-43b6-99bf-09806442345d", + "importer": "prefab", + "optimizationPolicy": "AUTO", + "asyncLoadAssets": false, + "readonly": false, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/core/chip/scripts.meta b/assets/core/chip/scripts.meta new file mode 100644 index 0000000..1d5cf9e --- /dev/null +++ b/assets/core/chip/scripts.meta @@ -0,0 +1,13 @@ +{ + "ver": "1.1.3", + "uuid": "e4f1840d-5a30-41d5-8789-694bf3dd26d7", + "importer": "folder", + "isBundle": false, + "bundleName": "", + "priority": 1, + "compressionType": {}, + "optimizeHotUpdate": {}, + "inlineSpriteFrames": {}, + "isRemoteBundle": {}, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/core/chip/scripts/chip.ts b/assets/core/chip/scripts/chip.ts new file mode 100644 index 0000000..e31bcc4 --- /dev/null +++ b/assets/core/chip/scripts/chip.ts @@ -0,0 +1,27 @@ +import { ChipColorConfig } from "../config/chip-color-config"; + +const { ccclass, property } = cc._decorator; + +@ccclass +export class Chip extends cc.Component +{ + + @property(cc.Label) + private labelChipValue: cc.Label = null; + @property(cc.Node) + private nodeChipColor: cc.Node = null; + @property(cc.Integer) + private value: number = 1; + + public setChipValue(value: number): void + { + this.value = value; + this.labelChipValue.string = value.toString(); + this.nodeChipColor.color = ChipColorConfig.GetColor(value); + } + + public getChipValue(): number + { + return this.value; + } +} diff --git a/assets/core/chip/scripts/chip.ts.meta b/assets/core/chip/scripts/chip.ts.meta new file mode 100644 index 0000000..f1bcc3a --- /dev/null +++ b/assets/core/chip/scripts/chip.ts.meta @@ -0,0 +1,10 @@ +{ + "ver": "1.1.0", + "uuid": "2b04861b-b4c6-445a-b9c8-76d91743f10a", + "importer": "typescript", + "isPlugin": false, + "loadPluginInWeb": true, + "loadPluginInNative": true, + "loadPluginInEditor": false, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/core/chip/textures.meta b/assets/core/chip/textures.meta new file mode 100644 index 0000000..68be520 --- /dev/null +++ b/assets/core/chip/textures.meta @@ -0,0 +1,13 @@ +{ + "ver": "1.1.3", + "uuid": "525d3784-086b-4a1b-bf8d-ca4eb414a231", + "importer": "folder", + "isBundle": false, + "bundleName": "", + "priority": 1, + "compressionType": {}, + "optimizeHotUpdate": {}, + "inlineSpriteFrames": {}, + "isRemoteBundle": {}, + "subMetas": {} +} \ No newline at end of file diff --git a/assets/core/chip/textures/below-chip.png b/assets/core/chip/textures/below-chip.png new file mode 100644 index 0000000..85d5ad3 Binary files /dev/null and b/assets/core/chip/textures/below-chip.png differ diff --git a/assets/core/chip/textures/below-chip.png.meta b/assets/core/chip/textures/below-chip.png.meta new file mode 100644 index 0000000..eaaeb42 --- /dev/null +++ b/assets/core/chip/textures/below-chip.png.meta @@ -0,0 +1,38 @@ +{ + "ver": "2.3.7", + "uuid": "e47954fd-d224-4959-98be-76c5d94d6ca7", + "importer": "texture", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 148, + "height": 148, + "platformSettings": {}, + "subMetas": { + "below-chip": { + "ver": "1.0.6", + "uuid": "bff54f22-0f2d-4eb3-a256-0a5ca31f36f5", + "importer": "sprite-frame", + "rawTextureUuid": "e47954fd-d224-4959-98be-76c5d94d6ca7", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 148, + "height": 148, + "rawWidth": 148, + "rawHeight": 148, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/assets/core/chip/textures/top-chip.png b/assets/core/chip/textures/top-chip.png new file mode 100644 index 0000000..36856fb Binary files /dev/null and b/assets/core/chip/textures/top-chip.png differ diff --git a/assets/core/chip/textures/top-chip.png.meta b/assets/core/chip/textures/top-chip.png.meta new file mode 100644 index 0000000..9a4e6d2 --- /dev/null +++ b/assets/core/chip/textures/top-chip.png.meta @@ -0,0 +1,38 @@ +{ + "ver": "2.3.7", + "uuid": "c0c639cd-5cca-4994-a585-9b2895aefed0", + "importer": "texture", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 148, + "height": 148, + "platformSettings": {}, + "subMetas": { + "top-chip": { + "ver": "1.0.6", + "uuid": "03a08d17-a871-4148-88c4-49181c0f25e2", + "importer": "sprite-frame", + "rawTextureUuid": "c0c639cd-5cca-4994-a585-9b2895aefed0", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 148, + "height": 148, + "rawWidth": 148, + "rawHeight": 148, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file