add room-panel template
This commit is contained in:
parent
25113b90da
commit
e24990865c
13
assets/core/room-panel.meta
Normal file
13
assets/core/room-panel.meta
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "47cfdc00-ea1a-43a2-b4e6-dd343e91f817",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
13
assets/core/room-panel/prefabs.meta
Normal file
13
assets/core/room-panel/prefabs.meta
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "e78efd2f-0d12-4ffd-b47e-152cc6f5f40f",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
451
assets/core/room-panel/prefabs/button-switch-room.prefab
Normal file
451
assets/core/room-panel/prefabs/button-switch-room.prefab
Normal file
@ -0,0 +1,451 @@
|
||||
[
|
||||
{
|
||||
"__type__": "cc.Prefab",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"data": {
|
||||
"__id__": 1
|
||||
},
|
||||
"optimizationPolicy": 0,
|
||||
"asyncLoadAssets": false,
|
||||
"readonly": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "button-switch-room",
|
||||
"_objFlags": 0,
|
||||
"_parent": null,
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 2
|
||||
},
|
||||
{
|
||||
"__id__": 5
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 8
|
||||
},
|
||||
{
|
||||
"__id__": 10
|
||||
},
|
||||
{
|
||||
"__id__": 11
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 12
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 238,
|
||||
"g": 120,
|
||||
"b": 248,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 122.69,
|
||||
"height": 49.71
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 1,
|
||||
"y": 0
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
342.8,
|
||||
97.8,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
0
|
||||
]
|
||||
},
|
||||
"_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": "sprite-icon",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 3
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 4
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 32,
|
||||
"height": 34
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
-97,
|
||||
25,
|
||||
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__": "8cdb44ac-a3f6-449f-b354-7cd48cf84061"
|
||||
},
|
||||
"_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": "0878Pr4t1A76Y4r1dPzNDm",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "lbl-switch-room",
|
||||
"_objFlags": 512,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 6
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 7
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 236,
|
||||
"b": 204,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 60,
|
||||
"height": 40
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
-43,
|
||||
24.855,
|
||||
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__": 5
|
||||
},
|
||||
"_enabled": true,
|
||||
"_materials": [
|
||||
{
|
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
||||
}
|
||||
],
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_string": "Switch\nTable",
|
||||
"_N$string": "Switch\nTable",
|
||||
"_fontSize": 19,
|
||||
"_lineHeight": 19,
|
||||
"_enableWrapText": false,
|
||||
"_N$file": null,
|
||||
"_isSystemFontUsed": false,
|
||||
"_spacingX": 0,
|
||||
"_batchAsBitmap": false,
|
||||
"_styleFlags": 0,
|
||||
"_underlineHeight": 0,
|
||||
"_N$horizontalAlign": 1,
|
||||
"_N$verticalAlign": 1,
|
||||
"_N$fontFamily": "Arial",
|
||||
"_N$overflow": 1,
|
||||
"_N$cacheMode": 1,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "243kWf8L5KhpBILYSuepWy",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Button",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"_normalMaterial": null,
|
||||
"_grayMaterial": null,
|
||||
"duration": 0.1,
|
||||
"zoomScale": 1.2,
|
||||
"clickEvents": [
|
||||
{
|
||||
"__id__": 9
|
||||
}
|
||||
],
|
||||
"_N$interactable": true,
|
||||
"_N$enableAutoGrayEffect": false,
|
||||
"_N$transition": 3,
|
||||
"transition": 3,
|
||||
"_N$normalColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 230,
|
||||
"g": 230,
|
||||
"b": 230,
|
||||
"a": 255
|
||||
},
|
||||
"_N$pressedColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 200,
|
||||
"g": 200,
|
||||
"b": 200,
|
||||
"a": 255
|
||||
},
|
||||
"pressedColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 200,
|
||||
"g": 200,
|
||||
"b": 200,
|
||||
"a": 255
|
||||
},
|
||||
"_N$hoverColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"hoverColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_N$disabledColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 120,
|
||||
"g": 120,
|
||||
"b": 120,
|
||||
"a": 200
|
||||
},
|
||||
"_N$normalSprite": null,
|
||||
"_N$pressedSprite": {
|
||||
"__uuid__": "e9ec654c-97a2-4787-9325-e6a10375219a"
|
||||
},
|
||||
"pressedSprite": {
|
||||
"__uuid__": "e9ec654c-97a2-4787-9325-e6a10375219a"
|
||||
},
|
||||
"_N$hoverSprite": {
|
||||
"__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
|
||||
},
|
||||
"hoverSprite": {
|
||||
"__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
|
||||
},
|
||||
"_N$disabledSprite": {
|
||||
"__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
|
||||
},
|
||||
"_N$target": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.ClickEvent",
|
||||
"target": {
|
||||
"__id__": 1
|
||||
},
|
||||
"component": "",
|
||||
"_componentId": "49fecm6vkZHypJsBx0nQN0r",
|
||||
"handler": "onClick",
|
||||
"customEventData": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"_materials": [
|
||||
{
|
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
||||
}
|
||||
],
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91"
|
||||
},
|
||||
"_type": 1,
|
||||
"_sizeMode": 0,
|
||||
"_fillType": 0,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_fillStart": 0,
|
||||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_atlas": null,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "49fecm6vkZHypJsBx0nQN0r",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "",
|
||||
"sync": false
|
||||
}
|
||||
]
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.3.2",
|
||||
"uuid": "9669786f-173a-4db2-a003-022ed86255e4",
|
||||
"importer": "prefab",
|
||||
"optimizationPolicy": "AUTO",
|
||||
"asyncLoadAssets": false,
|
||||
"readonly": false,
|
||||
"subMetas": {}
|
||||
}
|
14117
assets/core/room-panel/prefabs/room-panel.prefab
Normal file
14117
assets/core/room-panel/prefabs/room-panel.prefab
Normal file
File diff suppressed because it is too large
Load Diff
9
assets/core/room-panel/prefabs/room-panel.prefab.meta
Normal file
9
assets/core/room-panel/prefabs/room-panel.prefab.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.3.2",
|
||||
"uuid": "21ed3a6b-787a-417b-a0cd-c41f27591a8b",
|
||||
"importer": "prefab",
|
||||
"optimizationPolicy": "AUTO",
|
||||
"asyncLoadAssets": false,
|
||||
"readonly": false,
|
||||
"subMetas": {}
|
||||
}
|
13
assets/core/room-panel/scripts.meta
Normal file
13
assets/core/room-panel/scripts.meta
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "09fabf19-4513-4169-800f-23a5309fa4b0",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
13
assets/core/room-panel/scripts/component.meta
Normal file
13
assets/core/room-panel/scripts/component.meta
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "833b737d-f69b-4a48-80a1-0e74e198a2bd",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
import RequestJoinRoom from "../system/request-join-room";
|
||||
import RoomComponent from "./room-component";
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export default class RoomButtonOnClick extends cc.Component
|
||||
{
|
||||
@property(RoomComponent)
|
||||
private roomComponent: RoomComponent = null;
|
||||
@property(RequestJoinRoom)
|
||||
private requestJoinRoom: RequestJoinRoom = null;
|
||||
|
||||
public onClick(): void
|
||||
{
|
||||
this.requestJoinRoom.request(this.roomComponent.getIndex());
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "3e125644-d7c3-426f-a289-0b52fd8241ea",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
26
assets/core/room-panel/scripts/component/room-component.ts
Normal file
26
assets/core/room-panel/scripts/component/room-component.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import { Chip } from "../../../chip/scripts/chip";
|
||||
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export default class RoomComponent extends cc.Component
|
||||
{
|
||||
@property(cc.Integer)
|
||||
private index: number = 0;
|
||||
@property(Chip)
|
||||
private listChip: Chip[] = [];
|
||||
|
||||
public updateRoomChipsUI(listChipValues: number[]): void
|
||||
{
|
||||
for (let i = 0; i < listChipValues.length; i++)
|
||||
{
|
||||
this.listChip[i].setChipValue(listChipValues[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public getIndex(): number
|
||||
{
|
||||
return this.index;
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "5371a2af-78ec-415c-aa3d-a1253d8aa002",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export class RoomPanelComponent extends cc.Component
|
||||
{
|
||||
public show(): void
|
||||
{
|
||||
this.node.active = true;
|
||||
}
|
||||
|
||||
public hide(): void
|
||||
{
|
||||
this.node.active = false;
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "2b2f9eee-b47b-4271-84ff-78d51fcf5e94",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
import EventDispatcher from "../../../event-system/cocos-event-target";
|
||||
import { ROOM_PANEL_EVENT } from "../event/room-panel-event";
|
||||
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export default class SwitchRoomButtonOnClick extends cc.Component
|
||||
{
|
||||
private onClick(): void
|
||||
{
|
||||
EventDispatcher.emit(ROOM_PANEL_EVENT.Open);
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "49fec9ba-be46-47ca-926c-071d2740dd2b",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
13
assets/core/room-panel/scripts/event.meta
Normal file
13
assets/core/room-panel/scripts/event.meta
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "b14665c7-9dde-43f5-b6d5-a2507d529608",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
4
assets/core/room-panel/scripts/event/room-panel-event.ts
Normal file
4
assets/core/room-panel/scripts/event/room-panel-event.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export const ROOM_PANEL_EVENT = {
|
||||
Open: 'Open',
|
||||
Close: 'Close',
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "1ac1ae84-2237-4a67-8eb3-a69bbf0cc38e",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
13
assets/core/room-panel/scripts/system.meta
Normal file
13
assets/core/room-panel/scripts/system.meta
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "888f9538-402f-44aa-8577-c1ceb5c26ac9",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
import getDecorators from "inversify-inject-decorators";
|
||||
import EventDispatcher from "../../../event-system/cocos-event-target";
|
||||
import { container } from "../../../plugins/core";
|
||||
import { RoomPanelComponent } from "../component/room-panel-component";
|
||||
import { ROOM_PANEL_EVENT } from "../event/room-panel-event";
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
const { lazyInject } = getDecorators(container, false);
|
||||
|
||||
@ccclass
|
||||
export default class OpenRoomPanelOnRequest extends cc.Component
|
||||
{
|
||||
@property(RoomPanelComponent)
|
||||
private roomPanelComponent: RoomPanelComponent = null;
|
||||
|
||||
protected onLoad(): void
|
||||
{
|
||||
EventDispatcher.on(ROOM_PANEL_EVENT.Open, this.onSwitchRoomButtonOnClick, this);
|
||||
}
|
||||
|
||||
private onSwitchRoomButtonOnClick(): void
|
||||
{
|
||||
this.roomPanelComponent.show();
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "0ec517f2-350a-43cc-9761-5e3a7017bda3",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
27
assets/core/room-panel/scripts/system/request-join-room.ts
Normal file
27
assets/core/room-panel/scripts/system/request-join-room.ts
Normal file
@ -0,0 +1,27 @@
|
||||
import getDecorators from "inversify-inject-decorators";
|
||||
import { container, CONTROLLER, RoomController } from "../../../plugins/core";
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
const { lazyInject } = getDecorators(container, false);
|
||||
|
||||
@ccclass
|
||||
export default class RequestJoinRoom extends cc.Component
|
||||
{
|
||||
@lazyInject(CONTROLLER.Room)
|
||||
private roomController: RoomController;
|
||||
|
||||
private firstTime: boolean = true;
|
||||
|
||||
public request(roomIndex: number): void
|
||||
{
|
||||
if (this.firstTime)
|
||||
{
|
||||
this.roomController.joinRoom(roomIndex);
|
||||
this.firstTime = false;
|
||||
} else
|
||||
{
|
||||
this.roomController.leaveRoom();
|
||||
this.roomController.joinRoom(roomIndex);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "c1ed7eef-7404-4031-bafd-863414af2f08",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
import getDecorators from "inversify-inject-decorators";
|
||||
|
||||
import EventDispatcher from "../../../event-system/cocos-event-target";
|
||||
import { container } from "../../../plugins/core";
|
||||
import { ROOM_PANEL_EVENT } from "../event/room-panel-event";
|
||||
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
const { lazyInject } = getDecorators(container, false);
|
||||
|
||||
@ccclass
|
||||
export default class RoomButtonActivator extends cc.Component
|
||||
{
|
||||
@property(cc.Button)
|
||||
private listRoomButton: cc.Button[] = [];
|
||||
|
||||
|
||||
protected onLoad(): void
|
||||
{
|
||||
|
||||
EventDispatcher.on(ROOM_PANEL_EVENT.Open, this.enable, this);
|
||||
}
|
||||
|
||||
public disable(): void
|
||||
{
|
||||
this.listRoomButton.forEach(roomButton =>
|
||||
{
|
||||
roomButton.interactable = false;
|
||||
})
|
||||
}
|
||||
|
||||
public enable(): void
|
||||
{
|
||||
this.listRoomButton.forEach(roomButton =>
|
||||
{
|
||||
roomButton.interactable = true;
|
||||
})
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "4e9e9b3f-41f2-499c-9e77-35ef53d7a626",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
import getDecorators from "inversify-inject-decorators";
|
||||
import { container, GAME_VIEW, ListRoomBetOptionModel, MODEL } from "../../../plugins/core";
|
||||
import RoomComponent from "../component/room-component";
|
||||
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
const { lazyInject } = getDecorators(container, false);
|
||||
|
||||
@ccclass
|
||||
export default class UpdateRoomChipsOnDataChange extends cc.Component implements Core.View.ComponentView
|
||||
{
|
||||
@lazyInject(GAME_VIEW.BetOption)
|
||||
private gameViewBetOption: Core.View.GameView;
|
||||
@lazyInject(MODEL.ListRoomBetOption)
|
||||
private listRoomBetOptionModel: ListRoomBetOptionModel;
|
||||
|
||||
@property(RoomComponent)
|
||||
private listRoomComponent: RoomComponent[] = [];
|
||||
|
||||
protected onLoad(): void
|
||||
{
|
||||
this.gameViewBetOption.addComponent(this);
|
||||
this.render();
|
||||
}
|
||||
|
||||
public render(): void
|
||||
{
|
||||
this.updateRoomChipValues();
|
||||
}
|
||||
|
||||
private updateRoomChipValues(): void
|
||||
{
|
||||
for (let roomIndex = 0; roomIndex < this.listRoomBetOptionModel.listRoomBetOption.length; roomIndex++)
|
||||
{
|
||||
const roomBetOptions = this.listRoomBetOptionModel.listRoomBetOption[roomIndex].listBetOption;
|
||||
this.listRoomComponent[roomIndex].updateRoomChipsUI(roomBetOptions);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "91f2609e-f756-4304-bd19-ef1915747915",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user