This commit is contained in:
DESKTOP-5RP3AKU\Jisol 2024-01-05 02:15:38 +08:00
parent 0556449f0a
commit c0cfcf98fc
14 changed files with 1004 additions and 67 deletions

View File

@ -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",

View File

@ -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",

View File

@ -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{

View File

@ -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", //野怪

View File

@ -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);
}

View File

@ -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();

View File

@ -31,7 +31,7 @@ export class MainView extends JNGLayerBase {
//发送消息
ChatData.getIns().onSend({
message:`${PlayerData.getIns().data.playerId} 加入游戏`
message:`加入游戏`
});
this.onUpdateView();

@ -1 +1 @@
Subproject commit f147b04ddd86f482f842c803027a963a6bcc59de
Subproject commit 762bea687b290ae38580323bdfaec39d537a2668

View File

@ -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;
}

View File

@ -1,5 +1,6 @@
package cn.jisol.game.actions;
import cn.hutool.json.JSONUtil;
import cn.jisol.game.network.client.GClient;
import cn.jisol.game.proto.GUIMessage;
import cn.jisol.ngame.actions.core.NAction;
@ -12,9 +13,17 @@ public class GChatAction {
//发送消息
@NActionMethod(GActionEnum.CHAT_MESSAGE)
public static void onChatMessage(GUIMessage.GUIChatMessage message, Map<String, GClient> clients){
clients.values().forEach(client -> {
client.invoke(GActionEnum.CHAT_RECEIVE_MESSAGE,message);
public static void onChatMessage(GUIMessage.GUIChatMessage message, Map<String, GClient> clients,GClient client){
GUIMessage.GUIChatMessageDTO dto =
GUIMessage.GUIChatMessageDTO.newBuilder()
.setMessage(message)
.setPlayerName(client.player.getPlayerName())
.setPlayerId(client.player.getPlayerId())
.build();
clients.values().forEach(client1 -> {
client1.invoke(GActionEnum.CHAT_RECEIVE_MESSAGE,dto);
});
}

View File

@ -183,10 +183,15 @@ public class GPVPAction {
//裁决结束 等待下次裁决
GRefereeAction.addFreeReferee(referee);
GUIMessage.GUIChatMessageDTO message = GUIMessage.GUIChatMessageDTO.newBuilder()
.setMessage(GUIMessage.GUIChatMessage.newBuilder().setMessage("获胜的玩家是:"+info.getWinnerId()).build())
.setPlayerId(0)
.setPlayerName("系统")
.build();
clients.values().forEach(client -> {
client.invoke(GActionEnum.C_MODE_PVP_MESSAGE, GPVPMessage.GPVPText.newBuilder().setText("服务器裁决胜利者"+info.getWinnerId()).build());
client.invoke(GActionEnum.CHAT_RECEIVE_MESSAGE, GUIMessage.GUIChatMessage.newBuilder().setMessage("获胜的玩家是:"+info.getWinnerId()).build());
client.invoke(GActionEnum.CHAT_RECEIVE_MESSAGE,message);
});
}

View File

@ -40,7 +40,7 @@ public final class GUIMessage {
}
/**
* <pre>
*聊天信息
*发送聊天信息
* </pre>
*
* Protobuf type {@code GUIChatMessage}
@ -330,7 +330,7 @@ public final class GUIMessage {
}
/**
* <pre>
*聊天信息
*发送聊天信息
* </pre>
*
* Protobuf type {@code GUIChatMessage}
@ -628,11 +628,920 @@ public final class GUIMessage {
}
public interface GUIChatMessageDTOOrBuilder extends
// @@protoc_insertion_point(interface_extends:GUIChatMessageDTO)
com.google.protobuf.MessageOrBuilder {
/**
* <pre>
*聊天内容
* </pre>
*
* <code>.GUIChatMessage message = 1;</code>
* @return Whether the message field is set.
*/
boolean hasMessage();
/**
* <pre>
*聊天内容
* </pre>
*
* <code>.GUIChatMessage message = 1;</code>
* @return The message.
*/
GUIMessage.GUIChatMessage getMessage();
/**
* <pre>
*聊天内容
* </pre>
*
* <code>.GUIChatMessage message = 1;</code>
*/
GUIMessage.GUIChatMessageOrBuilder getMessageOrBuilder();
/**
* <code>string playerName = 2;</code>
* @return The playerName.
*/
java.lang.String getPlayerName();
/**
* <code>string playerName = 2;</code>
* @return The bytes for playerName.
*/
com.google.protobuf.ByteString
getPlayerNameBytes();
/**
* <code>int64 playerId = 3;</code>
* @return The playerId.
*/
long getPlayerId();
}
/**
* Protobuf type {@code GUIChatMessageDTO}
*/
public static final class GUIChatMessageDTO extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:GUIChatMessageDTO)
GUIChatMessageDTOOrBuilder {
private static final long serialVersionUID = 0L;
// Use GUIChatMessageDTO.newBuilder() to construct.
private GUIChatMessageDTO(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private GUIChatMessageDTO() {
playerName_ = "";
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new GUIChatMessageDTO();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private GUIChatMessageDTO(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10: {
GUIMessage.GUIChatMessage.Builder subBuilder = null;
if (message_ != null) {
subBuilder = message_.toBuilder();
}
message_ = input.readMessage(GUIMessage.GUIChatMessage.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(message_);
message_ = subBuilder.buildPartial();
}
break;
}
case 18: {
java.lang.String s = input.readStringRequireUtf8();
playerName_ = s;
break;
}
case 24: {
playerId_ = input.readInt64();
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (com.google.protobuf.UninitializedMessageException e) {
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return GUIMessage.internal_static_GUIChatMessageDTO_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return GUIMessage.internal_static_GUIChatMessageDTO_fieldAccessorTable
.ensureFieldAccessorsInitialized(
GUIMessage.GUIChatMessageDTO.class, GUIMessage.GUIChatMessageDTO.Builder.class);
}
public static final int MESSAGE_FIELD_NUMBER = 1;
private GUIMessage.GUIChatMessage message_;
/**
* <pre>
*聊天内容
* </pre>
*
* <code>.GUIChatMessage message = 1;</code>
* @return Whether the message field is set.
*/
@java.lang.Override
public boolean hasMessage() {
return message_ != null;
}
/**
* <pre>
*聊天内容
* </pre>
*
* <code>.GUIChatMessage message = 1;</code>
* @return The message.
*/
@java.lang.Override
public GUIMessage.GUIChatMessage getMessage() {
return message_ == null ? GUIMessage.GUIChatMessage.getDefaultInstance() : message_;
}
/**
* <pre>
*聊天内容
* </pre>
*
* <code>.GUIChatMessage message = 1;</code>
*/
@java.lang.Override
public GUIMessage.GUIChatMessageOrBuilder getMessageOrBuilder() {
return getMessage();
}
public static final int PLAYERNAME_FIELD_NUMBER = 2;
private volatile java.lang.Object playerName_;
/**
* <code>string playerName = 2;</code>
* @return The playerName.
*/
@java.lang.Override
public java.lang.String getPlayerName() {
java.lang.Object ref = playerName_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
playerName_ = s;
return s;
}
}
/**
* <code>string playerName = 2;</code>
* @return The bytes for playerName.
*/
@java.lang.Override
public com.google.protobuf.ByteString
getPlayerNameBytes() {
java.lang.Object ref = playerName_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
playerName_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int PLAYERID_FIELD_NUMBER = 3;
private long playerId_;
/**
* <code>int64 playerId = 3;</code>
* @return The playerId.
*/
@java.lang.Override
public long getPlayerId() {
return playerId_;
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (message_ != null) {
output.writeMessage(1, getMessage());
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(playerName_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 2, playerName_);
}
if (playerId_ != 0L) {
output.writeInt64(3, playerId_);
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (message_ != null) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(1, getMessage());
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(playerName_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, playerName_);
}
if (playerId_ != 0L) {
size += com.google.protobuf.CodedOutputStream
.computeInt64Size(3, playerId_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof GUIMessage.GUIChatMessageDTO)) {
return super.equals(obj);
}
GUIMessage.GUIChatMessageDTO other = (GUIMessage.GUIChatMessageDTO) obj;
if (hasMessage() != other.hasMessage()) return false;
if (hasMessage()) {
if (!getMessage()
.equals(other.getMessage())) return false;
}
if (!getPlayerName()
.equals(other.getPlayerName())) return false;
if (getPlayerId()
!= other.getPlayerId()) return false;
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
if (hasMessage()) {
hash = (37 * hash) + MESSAGE_FIELD_NUMBER;
hash = (53 * hash) + getMessage().hashCode();
}
hash = (37 * hash) + PLAYERNAME_FIELD_NUMBER;
hash = (53 * hash) + getPlayerName().hashCode();
hash = (37 * hash) + PLAYERID_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
getPlayerId());
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static GUIMessage.GUIChatMessageDTO parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static GUIMessage.GUIChatMessageDTO parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static GUIMessage.GUIChatMessageDTO parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static GUIMessage.GUIChatMessageDTO parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static GUIMessage.GUIChatMessageDTO parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static GUIMessage.GUIChatMessageDTO parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static GUIMessage.GUIChatMessageDTO parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static GUIMessage.GUIChatMessageDTO parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static GUIMessage.GUIChatMessageDTO parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static GUIMessage.GUIChatMessageDTO parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static GUIMessage.GUIChatMessageDTO parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static GUIMessage.GUIChatMessageDTO parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(GUIMessage.GUIChatMessageDTO prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code GUIChatMessageDTO}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:GUIChatMessageDTO)
GUIMessage.GUIChatMessageDTOOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return GUIMessage.internal_static_GUIChatMessageDTO_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return GUIMessage.internal_static_GUIChatMessageDTO_fieldAccessorTable
.ensureFieldAccessorsInitialized(
GUIMessage.GUIChatMessageDTO.class, GUIMessage.GUIChatMessageDTO.Builder.class);
}
// Construct using cn.jisol.game.proto.GUIMessage.GUIChatMessageDTO.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@java.lang.Override
public Builder clear() {
super.clear();
if (messageBuilder_ == null) {
message_ = null;
} else {
message_ = null;
messageBuilder_ = null;
}
playerName_ = "";
playerId_ = 0L;
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return GUIMessage.internal_static_GUIChatMessageDTO_descriptor;
}
@java.lang.Override
public GUIMessage.GUIChatMessageDTO getDefaultInstanceForType() {
return GUIMessage.GUIChatMessageDTO.getDefaultInstance();
}
@java.lang.Override
public GUIMessage.GUIChatMessageDTO build() {
GUIMessage.GUIChatMessageDTO result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public GUIMessage.GUIChatMessageDTO buildPartial() {
GUIMessage.GUIChatMessageDTO result = new GUIMessage.GUIChatMessageDTO(this);
if (messageBuilder_ == null) {
result.message_ = message_;
} else {
result.message_ = messageBuilder_.build();
}
result.playerName_ = playerName_;
result.playerId_ = playerId_;
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof GUIMessage.GUIChatMessageDTO) {
return mergeFrom((GUIMessage.GUIChatMessageDTO)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(GUIMessage.GUIChatMessageDTO other) {
if (other == GUIMessage.GUIChatMessageDTO.getDefaultInstance()) return this;
if (other.hasMessage()) {
mergeMessage(other.getMessage());
}
if (!other.getPlayerName().isEmpty()) {
playerName_ = other.playerName_;
onChanged();
}
if (other.getPlayerId() != 0L) {
setPlayerId(other.getPlayerId());
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
GUIMessage.GUIChatMessageDTO parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (GUIMessage.GUIChatMessageDTO) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private GUIMessage.GUIChatMessage message_;
private com.google.protobuf.SingleFieldBuilderV3<
GUIMessage.GUIChatMessage, GUIMessage.GUIChatMessage.Builder, GUIMessage.GUIChatMessageOrBuilder> messageBuilder_;
/**
* <pre>
*聊天内容
* </pre>
*
* <code>.GUIChatMessage message = 1;</code>
* @return Whether the message field is set.
*/
public boolean hasMessage() {
return messageBuilder_ != null || message_ != null;
}
/**
* <pre>
*聊天内容
* </pre>
*
* <code>.GUIChatMessage message = 1;</code>
* @return The message.
*/
public GUIMessage.GUIChatMessage getMessage() {
if (messageBuilder_ == null) {
return message_ == null ? GUIMessage.GUIChatMessage.getDefaultInstance() : message_;
} else {
return messageBuilder_.getMessage();
}
}
/**
* <pre>
*聊天内容
* </pre>
*
* <code>.GUIChatMessage message = 1;</code>
*/
public Builder setMessage(GUIMessage.GUIChatMessage value) {
if (messageBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
message_ = value;
onChanged();
} else {
messageBuilder_.setMessage(value);
}
return this;
}
/**
* <pre>
*聊天内容
* </pre>
*
* <code>.GUIChatMessage message = 1;</code>
*/
public Builder setMessage(
GUIMessage.GUIChatMessage.Builder builderForValue) {
if (messageBuilder_ == null) {
message_ = builderForValue.build();
onChanged();
} else {
messageBuilder_.setMessage(builderForValue.build());
}
return this;
}
/**
* <pre>
*聊天内容
* </pre>
*
* <code>.GUIChatMessage message = 1;</code>
*/
public Builder mergeMessage(GUIMessage.GUIChatMessage value) {
if (messageBuilder_ == null) {
if (message_ != null) {
message_ =
GUIMessage.GUIChatMessage.newBuilder(message_).mergeFrom(value).buildPartial();
} else {
message_ = value;
}
onChanged();
} else {
messageBuilder_.mergeFrom(value);
}
return this;
}
/**
* <pre>
*聊天内容
* </pre>
*
* <code>.GUIChatMessage message = 1;</code>
*/
public Builder clearMessage() {
if (messageBuilder_ == null) {
message_ = null;
onChanged();
} else {
message_ = null;
messageBuilder_ = null;
}
return this;
}
/**
* <pre>
*聊天内容
* </pre>
*
* <code>.GUIChatMessage message = 1;</code>
*/
public GUIMessage.GUIChatMessage.Builder getMessageBuilder() {
onChanged();
return getMessageFieldBuilder().getBuilder();
}
/**
* <pre>
*聊天内容
* </pre>
*
* <code>.GUIChatMessage message = 1;</code>
*/
public GUIMessage.GUIChatMessageOrBuilder getMessageOrBuilder() {
if (messageBuilder_ != null) {
return messageBuilder_.getMessageOrBuilder();
} else {
return message_ == null ?
GUIMessage.GUIChatMessage.getDefaultInstance() : message_;
}
}
/**
* <pre>
*聊天内容
* </pre>
*
* <code>.GUIChatMessage message = 1;</code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
GUIMessage.GUIChatMessage, GUIMessage.GUIChatMessage.Builder, GUIMessage.GUIChatMessageOrBuilder>
getMessageFieldBuilder() {
if (messageBuilder_ == null) {
messageBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
GUIMessage.GUIChatMessage, GUIMessage.GUIChatMessage.Builder, GUIMessage.GUIChatMessageOrBuilder>(
getMessage(),
getParentForChildren(),
isClean());
message_ = null;
}
return messageBuilder_;
}
private java.lang.Object playerName_ = "";
/**
* <code>string playerName = 2;</code>
* @return The playerName.
*/
public java.lang.String getPlayerName() {
java.lang.Object ref = playerName_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
playerName_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <code>string playerName = 2;</code>
* @return The bytes for playerName.
*/
public com.google.protobuf.ByteString
getPlayerNameBytes() {
java.lang.Object ref = playerName_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
playerName_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <code>string playerName = 2;</code>
* @param value The playerName to set.
* @return This builder for chaining.
*/
public Builder setPlayerName(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
playerName_ = value;
onChanged();
return this;
}
/**
* <code>string playerName = 2;</code>
* @return This builder for chaining.
*/
public Builder clearPlayerName() {
playerName_ = getDefaultInstance().getPlayerName();
onChanged();
return this;
}
/**
* <code>string playerName = 2;</code>
* @param value The bytes for playerName to set.
* @return This builder for chaining.
*/
public Builder setPlayerNameBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
playerName_ = value;
onChanged();
return this;
}
private long playerId_ ;
/**
* <code>int64 playerId = 3;</code>
* @return The playerId.
*/
@java.lang.Override
public long getPlayerId() {
return playerId_;
}
/**
* <code>int64 playerId = 3;</code>
* @param value The playerId to set.
* @return This builder for chaining.
*/
public Builder setPlayerId(long value) {
playerId_ = value;
onChanged();
return this;
}
/**
* <code>int64 playerId = 3;</code>
* @return This builder for chaining.
*/
public Builder clearPlayerId() {
playerId_ = 0L;
onChanged();
return this;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:GUIChatMessageDTO)
}
// @@protoc_insertion_point(class_scope:GUIChatMessageDTO)
private static final GUIMessage.GUIChatMessageDTO DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new GUIMessage.GUIChatMessageDTO();
}
public static GUIMessage.GUIChatMessageDTO getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<GUIChatMessageDTO>
PARSER = new com.google.protobuf.AbstractParser<GUIChatMessageDTO>() {
@java.lang.Override
public GUIChatMessageDTO parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new GUIChatMessageDTO(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<GUIChatMessageDTO> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<GUIChatMessageDTO> getParserForType() {
return PARSER;
}
@java.lang.Override
public GUIMessage.GUIChatMessageDTO getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_GUIChatMessage_descriptor;
private static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_GUIChatMessage_fieldAccessorTable;
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_GUIChatMessageDTO_descriptor;
private static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_GUIChatMessageDTO_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
@ -643,8 +1552,10 @@ public final class GUIMessage {
static {
java.lang.String[] descriptorData = {
"\n\020GUIMessage.proto\"!\n\016GUIChatMessage\022\017\n\007" +
"message\030\001 \001(\tB\026\n\024cn.jisol.ngame.protob\006p" +
"roto3"
"message\030\001 \001(\t\"[\n\021GUIChatMessageDTO\022 \n\007me" +
"ssage\030\001 \001(\0132\017.GUIChatMessage\022\022\n\nplayerNa" +
"me\030\002 \001(\t\022\020\n\010playerId\030\003 \001(\003B\026\n\024cn.jisol.n" +
"game.protob\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
@ -656,6 +1567,12 @@ public final class GUIMessage {
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_GUIChatMessage_descriptor,
new java.lang.String[] { "Message", });
internal_static_GUIChatMessageDTO_descriptor =
getDescriptor().getMessageTypes().get(1);
internal_static_GUIChatMessageDTO_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_GUIChatMessageDTO_descriptor,
new java.lang.String[] { "Message", "PlayerName", "PlayerId", });
}
// @@protoc_insertion_point(outer_class_scope)

View File

@ -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;
}

View File

@ -4,8 +4,8 @@ spring:
datasource:
username: pet_jisol_cn
password: sThsBwjfDcaw2wJR
# url: jdbc:mysql://kyu.jisol.cn:3306/pet_jisol_cn?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&allowMultiQueries=true
url: jdbc:mysql://localhost:3306/pet_jisol_cn?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&allowMultiQueries=true
url: jdbc:mysql://kyu.jisol.cn:3306/pet_jisol_cn?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&allowMultiQueries=true
# url: jdbc:mysql://localhost:3306/pet_jisol_cn?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&allowMultiQueries=true
driver-class-name: com.mysql.cj.jdbc.Driver
jackson:
serialization: