mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-26 10:16:14 +00:00
提交
This commit is contained in:
@@ -76,13 +76,13 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 720,
|
||||
"height": 50.4
|
||||
"width": 650,
|
||||
"height": 58.4
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
@@ -107,16 +107,16 @@
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 0,
|
||||
"g": 0,
|
||||
"b": 0,
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_string": "ScrollView content01",
|
||||
"_horizontalAlign": 1,
|
||||
"_horizontalAlign": 0,
|
||||
"_verticalAlign": 1,
|
||||
"_actualFontSize": 36,
|
||||
"_fontSize": 36,
|
||||
"_actualFontSize": 32,
|
||||
"_fontSize": 32,
|
||||
"_fontFamily": "Arial",
|
||||
"_lineHeight": 40,
|
||||
"_overflow": 3,
|
||||
@@ -125,7 +125,7 @@
|
||||
"_isSystemFontUsed": true,
|
||||
"_spacingX": 0,
|
||||
"_isItalic": false,
|
||||
"_isBold": false,
|
||||
"_isBold": true,
|
||||
"_isUnderline": false,
|
||||
"_underlineHeight": 2,
|
||||
"_cacheMode": 0,
|
||||
@@ -136,7 +136,7 @@
|
||||
"fileId": "7ahEvd3z5N4ruHsPPLIdmV"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Widget",
|
||||
"__type__": "cc.LabelOutline",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
@@ -147,29 +147,19 @@
|
||||
"__prefab": {
|
||||
"__id__": 7
|
||||
},
|
||||
"_alignFlags": 40,
|
||||
"_target": null,
|
||||
"_left": 0,
|
||||
"_right": 0,
|
||||
"_top": 0,
|
||||
"_bottom": 0,
|
||||
"_horizontalCenter": 0,
|
||||
"_verticalCenter": 0,
|
||||
"_isAbsLeft": true,
|
||||
"_isAbsRight": true,
|
||||
"_isAbsTop": true,
|
||||
"_isAbsBottom": true,
|
||||
"_isAbsHorizontalCenter": true,
|
||||
"_isAbsVerticalCenter": true,
|
||||
"_originalWidth": 335.53125,
|
||||
"_originalHeight": 0,
|
||||
"_alignMode": 2,
|
||||
"_lockFlags": 0,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 0,
|
||||
"g": 0,
|
||||
"b": 0,
|
||||
"a": 255
|
||||
},
|
||||
"_width": 4,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "61ikNaw6BJr7IaFbNvdfj8"
|
||||
"fileId": "6cvihYfrtARaa4Y/2l5fPU"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
|
@@ -956,7 +956,7 @@
|
||||
"value": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 151.2,
|
||||
"y": 204.4,
|
||||
"z": 0
|
||||
}
|
||||
},
|
||||
@@ -1071,7 +1071,7 @@
|
||||
"value": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 100.79999999999998,
|
||||
"y": 146.00000000000003,
|
||||
"z": 0
|
||||
}
|
||||
},
|
||||
@@ -1202,7 +1202,7 @@
|
||||
"value": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 50.399999999999984,
|
||||
"y": 87.60000000000002,
|
||||
"z": 0
|
||||
}
|
||||
},
|
||||
@@ -1333,7 +1333,7 @@
|
||||
"value": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": -1.4210854715202004e-14,
|
||||
"y": 29.20000000000002,
|
||||
"z": 0
|
||||
}
|
||||
},
|
||||
@@ -1398,8 +1398,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 720,
|
||||
"height": 201.6
|
||||
"width": 650,
|
||||
"height": 233.6
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
|
@@ -28,14 +28,14 @@ import AppAction from "./AppAction";
|
||||
import { Asset } from "cc";
|
||||
import { Component } from "cc";
|
||||
|
||||
// let APIPath = `http://localhost:8080`
|
||||
// let WsPath = `ws://localhost:8080/websocket`
|
||||
let APIPath = `http://localhost:8080`
|
||||
let WsPath = `ws://localhost:8080/websocket`
|
||||
// let APIPath = `http://192.168.1.23:8080`
|
||||
// let WsPath = `ws://192.168.1.23:8080/websocket`
|
||||
// let APIPath = `http://192.168.0.115:8080`
|
||||
// let WsPath = `ws://192.168.0.115:8080/websocket`
|
||||
let APIPath = `https://api.pet.jisol.cn`
|
||||
let WsPath = `wss://api.pet.jisol.cn/websocket`
|
||||
// let APIPath = `https://api.pet.jisol.cn`
|
||||
// let WsPath = `wss://api.pet.jisol.cn/websocket`
|
||||
|
||||
//重写UI
|
||||
class JNGLayer extends JNLayer{
|
||||
|
@@ -1,11 +1,16 @@
|
||||
export interface GUIChatMessage{
|
||||
message:string;
|
||||
}
|
||||
export interface GUIChatMessageDTO{
|
||||
message:GUIChatMessage;
|
||||
playerName:string;
|
||||
playerId:number;
|
||||
}
|
||||
|
||||
export enum GActionType {
|
||||
|
||||
GUIChatMessage = "GUIChatMessage",//聊天信息
|
||||
|
||||
GUIChatMessage = "GUIChatMessage",//聊天信息发送
|
||||
GUIChatMessageDTO = "GUIChatMessageDTO",//聊天信息接受
|
||||
|
||||
/*************** 游戏模式 : 无尽模式(OnHook) **************/
|
||||
GOnHookPet = "GOnHookPet", //野怪
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import Singleton from "../../../extensions/ngame/assets/ngame/util/Singleton";
|
||||
import { app } from "../App";
|
||||
import { GAction } from "../consts/GAction";
|
||||
import { GActionType, GUIChatMessage } from "../consts/GActionType";
|
||||
import { GActionType, GUIChatMessage, GUIChatMessageDTO } from "../consts/GActionType";
|
||||
import BaseData from "./BaseData";
|
||||
|
||||
//聊天数据
|
||||
@@ -10,18 +10,18 @@ export default class ChatData extends BaseData{
|
||||
static Event = "ChatData_Event_Message";
|
||||
|
||||
//世界消息列表
|
||||
datas:string[] = [];
|
||||
datas:GUIChatMessageDTO[] = [];
|
||||
|
||||
onInit() {
|
||||
//监听聊天消息
|
||||
app.socket.on(GAction.CHAT_RECEIVE_MESSAGE,this.onChatReceiveMessage,this,GActionType.GUIChatMessage);
|
||||
app.socket.on(GAction.CHAT_RECEIVE_MESSAGE,this.onChatReceiveMessage,this,GActionType.GUIChatMessageDTO);
|
||||
}
|
||||
|
||||
|
||||
//接受聊天消息
|
||||
onChatReceiveMessage(info:GUIChatMessage){
|
||||
onChatReceiveMessage(info:GUIChatMessageDTO){
|
||||
console.log(`ChatData - onChatReceiveMessage`,info.message);
|
||||
this.datas.push(info.message);
|
||||
this.datas.push(info);
|
||||
app.event.emit(ChatData.Event,info);
|
||||
}
|
||||
|
||||
|
@@ -5,7 +5,7 @@ import { instantiate } from 'cc';
|
||||
import { Label } from 'cc';
|
||||
import { EditBox } from 'cc';
|
||||
import { GUI } from '../../UIConfig';
|
||||
import { GUIChatMessage } from '../../../consts/GActionType';
|
||||
import { GUIChatMessage, GUIChatMessageDTO } from '../../../consts/GActionType';
|
||||
import { Widget } from 'cc';
|
||||
import JScrollExceedHide from '../../../../../extensions/ngame/assets/ngame/util/components/JScrollExceedHide';
|
||||
import { JNGLayerBase } from '../../../components/JNComponent';
|
||||
@@ -46,9 +46,7 @@ export class MainChatView extends JNGLayerBase {
|
||||
let messages = ChatData.getIns().datas;
|
||||
|
||||
messages.forEach(message => {
|
||||
let node = instantiate(this.chatPrefab);
|
||||
node.getComponent(Label).string = message;
|
||||
this.content.addChild(node);
|
||||
this.onMessage(message);
|
||||
})
|
||||
|
||||
}
|
||||
@@ -68,11 +66,12 @@ export class MainChatView extends JNGLayerBase {
|
||||
}
|
||||
|
||||
//接受到消息
|
||||
onMessage(info:GUIChatMessage){
|
||||
onMessage(info:GUIChatMessageDTO){
|
||||
|
||||
//插入数据
|
||||
let node = instantiate(this.chatPrefab);
|
||||
node.getComponent(Label).string = info.message;
|
||||
|
||||
node.getComponent(Label).string = `${info.playerName} : ${info.message.message}`;
|
||||
this.content.addChild(node);
|
||||
this.scheduleOnce(() => {
|
||||
this.getComponentInChildren(JScrollExceedHide).onUpdate();
|
||||
|
@@ -31,7 +31,7 @@ export class MainView extends JNGLayerBase {
|
||||
|
||||
//发送消息
|
||||
ChatData.getIns().onSend({
|
||||
message:`${PlayerData.getIns().data.playerId} 加入游戏`
|
||||
message:`加入游戏`
|
||||
});
|
||||
|
||||
this.onUpdateView();
|
||||
|
Submodule JisolGameCocos/extensions/ngame updated: f147b04ddd...762bea687b
@@ -2,7 +2,13 @@ syntax = "proto3";
|
||||
|
||||
option java_package = "cn.jisol.ngame.proto";
|
||||
|
||||
//聊天信息
|
||||
//发送聊天信息
|
||||
message GUIChatMessage {
|
||||
string message = 1; //聊天内容
|
||||
}
|
||||
|
||||
message GUIChatMessageDTO {
|
||||
GUIChatMessage message = 1; //聊天内容
|
||||
string playerName = 2;
|
||||
int64 playerId = 3;
|
||||
}
|
||||
|
Reference in New Issue
Block a user