首页布局 初版

This commit is contained in:
DESKTOP-J7I1C4E\a9350 2024-03-08 15:54:33 +08:00
parent dccc86b207
commit f8a2a40a35
12 changed files with 1457 additions and 51 deletions

View File

@ -1,37 +0,0 @@
import { _decorator, Component, Node, Animation, Sprite, resources, SpriteFrame, CCString, CCInteger, Vec2 } from 'cc';
import { MyAnimation } from './MyAnimation';
const { ccclass, property, requireComponent, executeInEditMode } = _decorator;
@ccclass('BaseSprite')
@executeInEditMode
@requireComponent(Sprite)//依赖组件 精灵
export default class BaseSprite extends MyAnimation {
AnimationFrameCount: number = 1;
@property({ type: CCString, displayName: '默认img路径', tooltip: "img路径" })
DefaultImgPath: string = "";
ImgPath: string[] = ["", ""];
@property({ type: CCInteger, displayName: 'img编号', tooltip: "img编号" })
GImgIndex = 0;
ImgIndex: number[] = [0, 1];
FrameDelay: Array<number> = [0, 9999999999];
@property({ type: [CCInteger], displayName: '是否显示', tooltip: "1为显示 0为不显示" })
PlayState = 0;
onGImgIndexChanged() {
this.ImgIndex[0] = this.GImgIndex;
}
start() {
this.onGImgIndexChanged();
super.start();
}
}

View File

@ -0,0 +1,62 @@
// import { _decorator, Button, Component, EventMouse, Node, NodeEventType } from 'cc';
// const { ccclass, property } = _decorator;
// @ccclass('BaseButton')
// export class BaseButton extends Component {
// //加载基础img
// Init(){
// }
// start() {
// this.Init();
// this.node.on(Node.EventType.MOUSE_ENTER,this.mouseEnter,this);
// this.node.on(Node.EventType.MOUSE_LEAVE,this.mouseLeave,this);
// this.node.on(Node.EventType.MOUSE_UP,this.mouseUp,this);
// }
// mouseEnter(){
// const baseSprite = this.node.getComponent(BaseSprite);
// // baseSprite.GImgIndex = 2;
// // baseSprite.onGImgIndexChanged();
// baseSprite.ImgIndex = [2,1];
// console.log('mouseEnter');
// console.log('GImgIndex =' + baseSprite.GImgIndex);
// console.log(baseSprite);
// }
// mouseLeave(){
// const baseSprite = this.node.getComponent(BaseSprite);
// // baseSprite.GImgIndex = 1;
// // baseSprite.onGImgIndexChanged();
// baseSprite.ImgIndex = [1,1];
// console.log('mouseLeave');
// console.log('GImgIndex =' + baseSprite.GImgIndex);
// console.log(baseSprite);
// }
// mouseUp(evetn: EventMouse){
// if (evetn.getButton() == EventMouse.BUTTON_LEFT){
// console.log('mouseUpLeft');
// }
// }
// update(deltaTime: number) {
// }
// }

View File

@ -0,0 +1,28 @@
import { _decorator, Component, Node, Animation, Sprite, resources, SpriteFrame, CCString, CCInteger, Vec2 } from 'cc';
const { ccclass, property, requireComponent, executeInEditMode } = _decorator;
@ccclass('BaseSpriteByNpk')
@executeInEditMode
@requireComponent(Sprite)//依赖组件 精灵
export default class BaseSpriteByNpk extends Component {
@property({ type: CCString, displayName: 'img路径', tooltip: "img路径" })
Path: string = "";
@property({ type: CCInteger, displayName: 'img编号', tooltip: "img编号" })
ImgIndex = 0;
start() {
}
update(dt: number): void {
}
}

9
assets/Prefab.meta Normal file
View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "eaa1d08a-5e6f-4341-9f6a-8e27ed47b322",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,312 @@
[
{
"__type__": "cc.Prefab",
"_name": "Present",
"_objFlags": 0,
"__editorExtras__": {},
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"persistent": false
},
{
"__type__": "cc.Node",
"_name": "Present",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": null,
"_children": [
{
"__id__": 2
}
],
"_active": true,
"_components": [
{
"__id__": 8
},
{
"__id__": 10
},
{
"__id__": 12
}
],
"_prefab": {
"__id__": 14
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "Present",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
},
{
"__id__": 5
}
],
"_prefab": {
"__id__": 7
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 4
},
"_contentSize": {
"__type__": "cc.Size",
"width": 40,
"height": 36
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "aaL9wscpRMHJWY91pMRzIH"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 6
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "57520716-48c8-4a19-8acf-41c9f8777fb0@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "a0XZDk+45J/K9kzpQ5IPPm"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "4bjGWkBElEr4BC16fDhe3Q",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 9
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "55UWXxjklAW4PediZ2wPj/"
},
{
"__type__": "cc.Mask",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 11
},
"_type": 0,
"_inverted": false,
"_segments": 64,
"_alphaThreshold": 0.1,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "be/874Wo5NBqs4VTuq2F30"
},
{
"__type__": "cc.Graphics",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 13
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_lineWidth": 1,
"_strokeColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_lineJoin": 2,
"_lineCap": 0,
"_fillColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 0
},
"_miterLimit": 10,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "fbR4Tn7D1AD5Uiybsxn/Oq"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "78Ap+aUshFV4IYTsoXI+uF",
"targetOverrides": null
}
]

View File

@ -0,0 +1,13 @@
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "aa2989f4-5378-4297-a889-49a957c3b47b",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "Present"
}
}

9
assets/Script.meta Normal file
View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "c48db437-e006-4733-98c9-041b5842c734",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,54 @@
// import { _decorator, Button, Component, EventMouse, Node, NodeEventType } from 'cc';
// const { ccclass, property } = _decorator;
// @ccclass('BaseButton')
// export class BaseButton extends Component {
// start() {
// this.node.on(Node.EventType.MOUSE_ENTER,this.mouseEnter,this);
// this.node.on(Node.EventType.MOUSE_LEAVE,this.mouseLeave,this);
// this.node.on(Node.EventType.MOUSE_UP,this.mouseUp,this);
// }
// mouseEnter(){
// const baseSprite = this.node.getComponent(BaseSprite);
// // baseSprite.GImgIndex = 2;
// // baseSprite.onGImgIndexChanged();
// baseSprite.ImgIndex = [2,1];
// console.log('mouseEnter');
// console.log('GImgIndex =' + baseSprite.GImgIndex);
// console.log(baseSprite);
// }
// mouseLeave(){
// const baseSprite = this.node.getComponent(BaseSprite);
// // baseSprite.GImgIndex = 1;
// // baseSprite.onGImgIndexChanged();
// baseSprite.ImgIndex = [1,1];
// console.log('mouseLeave');
// console.log('GImgIndex =' + baseSprite.GImgIndex);
// console.log(baseSprite);
// }
// mouseUp(evetn: EventMouse){
// if (evetn.getButton() == EventMouse.BUTTON_LEFT){
// console.log('mouseUpLeft');
// }
// }
// update(deltaTime: number) {
// }
// }

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "45dea0b1-384d-43f7-a8ac-a58814cf17a3",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,17 @@
import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('StartGameRoot')
export class StartGameRoot extends Component {
start() {
}
update(deltaTime: number) {
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "37227f6a-00a4-4840-a07e-025b6be2f27c",
"files": [],
"subMetas": {},
"userData": {}
}

File diff suppressed because it is too large Load Diff