首页 开始游戏 和 游戏介绍 界面初版

This commit is contained in:
DESKTOP-J7I1C4E\a9350 2024-03-08 18:29:39 +08:00
parent 6223bb18f0
commit d6d05bfccb
11 changed files with 408 additions and 219 deletions

View File

@ -1,62 +0,0 @@
// 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

@ -1,28 +0,0 @@
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 {
}
}

View File

@ -0,0 +1,36 @@
import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;
/// 按钮按下效果 在按下时 向下移动一个坐标
@ccclass('ButtonDown')
export class ButtonDown extends Component {
start() {
this.node.on(Node.EventType.TOUCH_START,this.onTouchStart,this);
this.node.on(Node.EventType.TOUCH_END,this.onTouchEnd,this);
this.node.on(Node.EventType.TOUCH_CANCEL,this.onTouchCancel,this);
}
onTouchStart(event:Event){
const pos = this.node.getPosition();
pos.y -= 1;
this.node.setPosition(pos);
}
onTouchEnd(event:Event){
const pos = this.node.getPosition();
pos.y += 1;
this.node.setPosition(pos);
}
onTouchCancel(event:Event){
const pos = this.node.getPosition();
pos.y += 1;
this.node.setPosition(pos);
}
update(deltaTime: number) {
}
}

View File

@ -2,7 +2,7 @@
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "45dea0b1-384d-43f7-a8ac-a58814cf17a3",
"uuid": "22f739e6-e4fa-4527-8015-095c71c24f3a",
"files": [],
"subMetas": {},
"userData": {}

View File

@ -20,22 +20,31 @@
"_children": [
{
"__id__": 2
},
{
"__id__": 10
}
],
"_active": true,
"_components": [
{
"__id__": 8
"__id__": 20
},
{
"__id__": 10
"__id__": 22
},
{
"__id__": 12
"__id__": 24
},
{
"__id__": 26
},
{
"__id__": 28
}
],
"_prefab": {
"__id__": 14
"__id__": 30
},
"_lpos": {
"__type__": "cc.Vec3",
@ -68,7 +77,7 @@
},
{
"__type__": "cc.Node",
"_name": "Present",
"_name": "Sprite",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
@ -82,10 +91,13 @@
},
{
"__id__": 5
},
{
"__id__": 7
}
],
"_prefab": {
"__id__": 7
"__id__": 9
},
"_lpos": {
"__type__": "cc.Vec3",
@ -142,7 +154,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "aaL9wscpRMHJWY91pMRzIH"
"fileId": "5eWu0X+FVNgI5z0WVe7YQ6"
},
{
"__type__": "cc.Sprite",
@ -166,10 +178,7 @@
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "57520716-48c8-4a19-8acf-41c9f8777fb0@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_spriteFrame": null,
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
@ -187,7 +196,27 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "a0XZDk+45J/K9kzpQ5IPPm"
"fileId": "fc0twlF1lOR4HK7BeyC25p"
},
{
"__type__": "a80463xbJJM5qU8FUhHK84e",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 8
},
"ImgPath": "interface2/event/chn_event_2020/200922_dnf_marble/00_main.img",
"ImgIndex": 25,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "e8MHts9wpBCLjui8vsEugz"
},
{
"__type__": "cc.PrefabInfo",
@ -197,7 +226,187 @@
"asset": {
"__id__": 0
},
"fileId": "4bjGWkBElEr4BC16fDhe3Q",
"fileId": "6f3bSlwHhGTrCoRP/4nXYb",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "CancelButton",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 11
},
{
"__id__": 13
},
{
"__id__": 15
},
{
"__id__": 17
}
],
"_prefab": {
"__id__": 19
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 380,
"y": 258,
"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__": 10
},
"_enabled": true,
"__prefab": {
"__id__": 12
},
"_contentSize": {
"__type__": "cc.Size",
"width": 40,
"height": 36
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "9ct7fqJXZPW72loHtkPyZI"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 10
},
"_enabled": true,
"__prefab": {
"__id__": 14
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": null,
"_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": "50krRdvUxGV5JwIT29GeY2"
},
{
"__type__": "227e93p2mxEV5zjvG1ofJkL",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 10
},
"_enabled": true,
"__prefab": {
"__id__": 16
},
"ImgPath": "interface2/event/chn_event_2020/200922_dnf_marble/01_ingame.img",
"NormalImgIndex": 39,
"HoverImgIndex": 40,
"PressImgIndex": 41,
"DisableImgIndex": 42,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "616ESzd7tK6azbhkiSn+wZ"
},
{
"__type__": "22f73nm5PpFJ4AVCVxxwk86",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 10
},
"_enabled": true,
"__prefab": {
"__id__": 18
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "68tS2o/ulDzLCwmZLhFu2o"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "19a5NWpspNOq0ziWf+VKn3",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
@ -212,12 +421,12 @@
},
"_enabled": true,
"__prefab": {
"__id__": 9
"__id__": 21
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
"width": 1067,
"height": 600
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@ -228,7 +437,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "55UWXxjklAW4PediZ2wPj/"
"fileId": "84kljvQdpCXpvHHsZcsIfi"
},
{
"__type__": "cc.Mask",
@ -240,7 +449,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 11
"__id__": 23
},
"_type": 0,
"_inverted": false,
@ -250,7 +459,7 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "be/874Wo5NBqs4VTuq2F30"
"fileId": "d18TIUsPZJNor4depBAoLj"
},
{
"__type__": "cc.Graphics",
@ -262,7 +471,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 13
"__id__": 25
},
"_customMaterial": null,
"_srcBlendFactor": 2,
@ -296,7 +505,46 @@
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "fbR4Tn7D1AD5Uiybsxn/Oq"
"fileId": "abKlZKzBBOOIS0f81wPKoZ"
},
{
"__type__": "cc.BlockInputEvents",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 27
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "8eYsyz39JAFoU0NowSG2Us"
},
{
"__type__": "fa300wCdRFJV5rVpFd/PxUk",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 29
},
"cancel": {
"__id__": 10
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "cf7mnl4l9L/7pkHBxOV4kG"
},
{
"__type__": "cc.PrefabInfo",
@ -306,7 +554,8 @@
"asset": {
"__id__": 0
},
"fileId": "78Ap+aUshFV4IYTsoXI+uF",
"fileId": "45U0bsLzxF75ClciJzcbfs",
"instance": null,
"targetOverrides": null
}
]

View File

@ -2,7 +2,7 @@
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "aa2989f4-5378-4297-a889-49a957c3b47b",
"uuid": "345ab5d0-8a20-42ec-a630-62a235d82b34",
"files": [
".json"
],

23
assets/Script/Pressent.ts Normal file
View File

@ -0,0 +1,23 @@
import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('Pressent')
export class Pressent extends Component {
@property(Node) cancel: Node;
start() {
this.cancel.on(Node.EventType.TOUCH_END,this.touchEnd,this);
}
touchEnd(event:Event){
/// 销毁节点
this.node.destroy();
}
update(deltaTime: number) {
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "fa300c02-7511-4957-9ad5-a4577f3f1524",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -1,54 +0,0 @@
// 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

@ -1,12 +1,21 @@
import { _decorator, Component, Node } from 'cc';
import { _decorator, Button, Component, EventTouch, instantiate, Node, Prefab } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('StartGameRoot')
export class StartGameRoot extends Component {
@property(Node) PressenButton: Node;
@property(Prefab) pressenPrefab: Prefab;
start() {
this.PressenButton.on(Node.EventType.TOUCH_END,this.onTouchEnd,this);
}
onTouchEnd(event:Event){
const pressent = instantiate(this.pressenPrefab);
this.node.addChild(pressent);
pressent.setPosition(0,0);
}
update(deltaTime: number) {

View File

@ -494,7 +494,7 @@
"_id": "0apjnJJkpLlKFaw0omFEuX"
},
{
"__type__": "9258d3QVRBC/L8BCziIBXzT",
"__type__": "a80463xbJJM5qU8FUhHK84e",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
@ -503,10 +503,9 @@
},
"_enabled": true,
"__prefab": null,
"DefaultImgPath": "sprite/interface2/event/chn_event_2020/200922_dnf_marble/00_main.img",
"GImgIndex": 0,
"PlayState": 1,
"_id": "a27U1G+TROF7ArDt28B3wZ"
"ImgPath": "interface2/event/chn_event_2020/200922_dnf_marble/00_main.img",
"ImgIndex": 0,
"_id": "fc2gTwXM1Lq68bZxSz8rQ1"
},
{
"__type__": "cc.Node",
@ -875,7 +874,7 @@
"_id": "e0/ZwnGkVL7bbmU6H8jnIX"
},
{
"__type__": "9258d3QVRBC/L8BCziIBXzT",
"__type__": "a80463xbJJM5qU8FUhHK84e",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
@ -884,10 +883,9 @@
},
"_enabled": true,
"__prefab": null,
"DefaultImgPath": "sprite/interface2/event/chn_event_2020/200922_dnf_marble/00_main.img",
"GImgIndex": 24,
"PlayState": 1,
"_id": "b5PH4Yj91JwaoGNitfqvGl"
"ImgPath": "interface2/event/chn_event_2020/200922_dnf_marble/00_main.img",
"ImgIndex": 24,
"_id": "ebKIgu9tNPe72cFsv4G2ss"
},
{
"__type__": "cc.Node",
@ -1004,6 +1002,23 @@
"_atlas": null,
"_id": "c2pCm9pjRJJ7j/VPe74xxb"
},
{
"__type__": "227e93p2mxEV5zjvG1ofJkL",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 25
},
"_enabled": true,
"__prefab": null,
"ImgPath": "interface2/event/chn_event_2020/200922_dnf_marble/00_main.img",
"NormalImgIndex": 1,
"HoverImgIndex": 2,
"PressImgIndex": 3,
"DisableImgIndex": 4,
"_id": "5fU90+EeRH7b08boyAjpt6"
},
{
"__type__": "cc.Button",
"_name": "",
@ -1016,12 +1031,12 @@
"__prefab": null,
"clickEvents": [],
"_interactable": true,
"_transition": 2,
"_transition": 0,
"_normalColor": {
"__type__": "cc.Color",
"r": 214,
"g": 214,
"b": 214,
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_hoverColor": {
@ -1051,13 +1066,11 @@
"_disabledSprite": null,
"_duration": 0.1,
"_zoomScale": 1.2,
"_target": {
"__id__": 25
},
"_id": "82Ln0THAtKkY7+6CUtpLEd"
"_target": null,
"_id": "a5tzyh02NEYJ1QdJN7y0gl"
},
{
"__type__": "9258d3QVRBC/L8BCziIBXzT",
"__type__": "22f73nm5PpFJ4AVCVxxwk86",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
@ -1066,22 +1079,7 @@
},
"_enabled": true,
"__prefab": null,
"DefaultImgPath": "sprite/interface2/event/chn_event_2020/200922_dnf_marble/00_main.img",
"GImgIndex": 1,
"PlayState": 1,
"_id": "00SU+NlYFFmYyaZ+L3YaAE"
},
{
"__type__": "45deaCxOE1D96ispYgUzxej",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 25
},
"_enabled": true,
"__prefab": null,
"_id": "843jjChttPUY5MJ5eIrMuv"
"_id": "d7zWDrkEJBW4iaN5aFUryg"
},
{
"__type__": "cc.Node",
@ -1327,21 +1325,6 @@
"_atlas": null,
"_id": "04PBUHNcJMwr+FmGsd0fhr"
},
{
"__type__": "9258d3QVRBC/L8BCziIBXzT",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 34
},
"_enabled": true,
"__prefab": null,
"DefaultImgPath": "sprite/interface2/event/chn_event_2020/200922_dnf_marble/00_main.img",
"GImgIndex": 9,
"PlayState": 1,
"_id": "20sg3uXg1KhoLjZboOhqxz"
},
{
"__type__": "cc.Button",
"_name": "",
@ -1392,6 +1375,23 @@
"_target": null,
"_id": "cce2csLLhBI7Vy15ey0Flw"
},
{
"__type__": "227e93p2mxEV5zjvG1ofJkL",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 34
},
"_enabled": true,
"__prefab": null,
"ImgPath": "interface2/event/chn_event_2020/200922_dnf_marble/00_main.img",
"NormalImgIndex": 9,
"HoverImgIndex": 10,
"PressImgIndex": 11,
"DisableImgIndex": 12,
"_id": "d7tUYiuShOA4bxi1CaYfUR"
},
{
"__type__": "cc.UITransform",
"_name": "",
@ -1424,6 +1424,13 @@
},
"_enabled": true,
"__prefab": null,
"PressenButton": {
"__id__": 34
},
"pressenPrefab": {
"__uuid__": "345ab5d0-8a20-42ec-a630-62a235d82b34",
"__expectedType__": "cc.Prefab"
},
"_id": "1f5g72f3ZHyooqaoqTrMZZ"
},
{