简单PVP

This commit is contained in:
PC-20230316NUNE\Administrator
2023-11-20 18:25:50 +08:00
parent 98b7a52b45
commit 74aabac454
36 changed files with 2972 additions and 261 deletions

View File

@@ -1,5 +1,6 @@
package cn.jisol.game;
import cn.jisol.ngame.util.spring.SpringBeanUtils;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -10,6 +11,6 @@ import org.springframework.context.ApplicationContext;
@SpringBootApplication
public class JGameApplication {
public static void main(String[] args) {
ApplicationContext applicationContext = SpringApplication.run(JGameApplication.class);
SpringBeanUtils.context = SpringApplication.run(JGameApplication.class);
}
}

View File

@@ -8,4 +8,13 @@ public interface GActionEnum {
int CHAT_MESSAGE = 2001; //发送聊天消息
int CHAT_RECEIVE_MESSAGE = 2002; //接受聊天消息
/*************** PVP *********************/
int S_MODE_PVP_JOIN = 3001; //加入PVP
int S_MODE_PVP_LEAVE = 3002; //离开PVP
int C_MODE_PVP_WAIT = 3003; //等待PVP开始
int C_MODE_PVP_START = 3004; //PVP开始
int C_MODE_PVP_END = 3005; //PVP结束
int C_MODE_PVP_START_WAIT = 3006; //开始等待PVP开始
int C_MODE_PVP_END_WAIT = 3007; //结束等待PVP开始
}

View File

@@ -0,0 +1,120 @@
package cn.jisol.game.actions.onhook;
import cn.jisol.game.actions.GActionEnum;
import cn.jisol.game.controller.game.GPlayerTacticalController;
import cn.jisol.game.entity.game.PlayerTactical;
import cn.jisol.game.network.client.GClient;
import cn.jisol.game.proto.GPVPMessage;
import cn.jisol.game.service.PlayerTacticalService;
import cn.jisol.ngame.actions.core.NAction;
import cn.jisol.ngame.actions.core.NActionMethod;
import cn.jisol.ngame.util.spring.SpringBeanUtils;
import java.util.*;
//PVP 模式
@NAction
public class GPVPAction {
//当前等待PVP的玩家
static LinkedList<GClient> pool = new LinkedList<>();
//等待通知定时器
static Timer timer;
static {
timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
GPVPAction.onWaitTimer();
}
},0,1000);
}
//加入PVP
@NActionMethod(GActionEnum.S_MODE_PVP_JOIN)
public static synchronized void onJoinPVP(GClient client){
//如果加入过 PVP 则返回
if(pool.contains(client)) return;
for (int i = 0; i < pool.size(); i++) {
GClient item = pool.get(i);
if (item.player.getPlayerId().equals(client.player.getPlayerId())){
//移除玩家
pool.remove(item);
}
}
//如果没有加入则加入
pool.add(client);
//通知开始等待
client.invoke(GActionEnum.C_MODE_PVP_START_WAIT);
GPVPAction.onUpdateMatchGame();
}
//离开PVP
@NActionMethod(GActionEnum.S_MODE_PVP_LEAVE)
public static void onJoinLeave(GClient client){
//如果加入过 则 离开
if(pool.contains(client)) {
pool.remove(client);
client.invoke(GActionEnum.C_MODE_PVP_END_WAIT);
}
}
//刷新匹配
public static void onUpdateMatchGame(){
//判断是否有两人在等待 有 则两人匹配成功
while (pool.size() >= 2){
//匹配成功
GClient client1 = pool.poll();
GClient client2 = pool.poll();
if(Objects.isNull(client1) || Objects.isNull(client2)) continue;
//确保玩家都在线
if(!(client1.isOpen() && client2.isOpen())){
if(client2.isOpen()) pool.addFirst(client2);
if(client1.isOpen()) pool.addFirst(client1);
continue;
}
//获取双方的阵型
GPlayerTacticalController tactical = SpringBeanUtils.getBean(GPlayerTacticalController.class);
//构建匹配信息
GPVPMessage.GPVPStart info = GPVPMessage.GPVPStart.newBuilder()
.setLeftTactical(tactical.getInfo(client1.player).data.getTacticalData())
.setRightTactical(tactical.getInfo(client2.player).data.getTacticalData())
.build();
//取消等待
client1.invoke(GActionEnum.C_MODE_PVP_END_WAIT);
client2.invoke(GActionEnum.C_MODE_PVP_END_WAIT);
//PVP 开始
client1.invoke(GActionEnum.C_MODE_PVP_START, info);
client2.invoke(GActionEnum.C_MODE_PVP_START, info);
}
}
//通知玩家等待定时器
public static void onWaitTimer(){
//向所有玩家发送等待
pool.forEach(client -> {
client.invoke(GActionEnum.C_MODE_PVP_WAIT);
});
}
}

View File

@@ -47,6 +47,11 @@ public class GPlayerTacticalController {
info = playerTacticalService.getById(player.getPlayerId());
}
//如果没有阵法则默认一个阵法
if(Objects.isNull(info.getTacticalData())){
info.setTacticalData("[0,0,0,0,0,0,0,0,0]");
}
return NewsContext.onSuccess("获取成功",info);
}

View File

@@ -43,4 +43,8 @@ public class GClient extends QueueNClient {
}
}
@Override
public boolean isOpen() {
return session.isOpen();
}
}

View File

@@ -0,0 +1,848 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: GPVPMessage.proto
package cn.jisol.game.proto;
public final class GPVPMessage {
private GPVPMessage() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistryLite registry) {
}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
registerAllExtensions(
(com.google.protobuf.ExtensionRegistryLite) registry);
}
public interface GPVPStartOrBuilder extends
// @@protoc_insertion_point(interface_extends:GPVPStart)
com.google.protobuf.MessageOrBuilder {
/**
* <pre>
*左边的布阵
* </pre>
*
* <code>string leftTactical = 1;</code>
* @return The leftTactical.
*/
java.lang.String getLeftTactical();
/**
* <pre>
*左边的布阵
* </pre>
*
* <code>string leftTactical = 1;</code>
* @return The bytes for leftTactical.
*/
com.google.protobuf.ByteString
getLeftTacticalBytes();
/**
* <pre>
*右边的布阵
* </pre>
*
* <code>string rightTactical = 2;</code>
* @return The rightTactical.
*/
java.lang.String getRightTactical();
/**
* <pre>
*右边的布阵
* </pre>
*
* <code>string rightTactical = 2;</code>
* @return The bytes for rightTactical.
*/
com.google.protobuf.ByteString
getRightTacticalBytes();
}
/**
* <pre>
*PVP 开始
* </pre>
*
* Protobuf type {@code GPVPStart}
*/
public static final class GPVPStart extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:GPVPStart)
GPVPStartOrBuilder {
private static final long serialVersionUID = 0L;
// Use GPVPStart.newBuilder() to construct.
private GPVPStart(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private GPVPStart() {
leftTactical_ = "";
rightTactical_ = "";
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new GPVPStart();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private GPVPStart(
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: {
java.lang.String s = input.readStringRequireUtf8();
leftTactical_ = s;
break;
}
case 18: {
java.lang.String s = input.readStringRequireUtf8();
rightTactical_ = s;
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 GPVPMessage.internal_static_GPVPStart_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return GPVPMessage.internal_static_GPVPStart_fieldAccessorTable
.ensureFieldAccessorsInitialized(
GPVPMessage.GPVPStart.class, GPVPMessage.GPVPStart.Builder.class);
}
public static final int LEFTTACTICAL_FIELD_NUMBER = 1;
private volatile java.lang.Object leftTactical_;
/**
* <pre>
*左边的布阵
* </pre>
*
* <code>string leftTactical = 1;</code>
* @return The leftTactical.
*/
@java.lang.Override
public java.lang.String getLeftTactical() {
java.lang.Object ref = leftTactical_;
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();
leftTactical_ = s;
return s;
}
}
/**
* <pre>
*左边的布阵
* </pre>
*
* <code>string leftTactical = 1;</code>
* @return The bytes for leftTactical.
*/
@java.lang.Override
public com.google.protobuf.ByteString
getLeftTacticalBytes() {
java.lang.Object ref = leftTactical_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
leftTactical_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int RIGHTTACTICAL_FIELD_NUMBER = 2;
private volatile java.lang.Object rightTactical_;
/**
* <pre>
*右边的布阵
* </pre>
*
* <code>string rightTactical = 2;</code>
* @return The rightTactical.
*/
@java.lang.Override
public java.lang.String getRightTactical() {
java.lang.Object ref = rightTactical_;
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();
rightTactical_ = s;
return s;
}
}
/**
* <pre>
*右边的布阵
* </pre>
*
* <code>string rightTactical = 2;</code>
* @return The bytes for rightTactical.
*/
@java.lang.Override
public com.google.protobuf.ByteString
getRightTacticalBytes() {
java.lang.Object ref = rightTactical_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
rightTactical_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
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 (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(leftTactical_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, leftTactical_);
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(rightTactical_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 2, rightTactical_);
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(leftTactical_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, leftTactical_);
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(rightTactical_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, rightTactical_);
}
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 GPVPMessage.GPVPStart)) {
return super.equals(obj);
}
GPVPMessage.GPVPStart other = (GPVPMessage.GPVPStart) obj;
if (!getLeftTactical()
.equals(other.getLeftTactical())) return false;
if (!getRightTactical()
.equals(other.getRightTactical())) 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();
hash = (37 * hash) + LEFTTACTICAL_FIELD_NUMBER;
hash = (53 * hash) + getLeftTactical().hashCode();
hash = (37 * hash) + RIGHTTACTICAL_FIELD_NUMBER;
hash = (53 * hash) + getRightTactical().hashCode();
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static GPVPMessage.GPVPStart parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static GPVPMessage.GPVPStart parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static GPVPMessage.GPVPStart parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static GPVPMessage.GPVPStart parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static GPVPMessage.GPVPStart parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static GPVPMessage.GPVPStart parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static GPVPMessage.GPVPStart parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static GPVPMessage.GPVPStart 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 GPVPMessage.GPVPStart parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static GPVPMessage.GPVPStart 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 GPVPMessage.GPVPStart parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static GPVPMessage.GPVPStart 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(GPVPMessage.GPVPStart 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;
}
/**
* <pre>
*PVP 开始
* </pre>
*
* Protobuf type {@code GPVPStart}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:GPVPStart)
GPVPMessage.GPVPStartOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return GPVPMessage.internal_static_GPVPStart_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return GPVPMessage.internal_static_GPVPStart_fieldAccessorTable
.ensureFieldAccessorsInitialized(
GPVPMessage.GPVPStart.class, GPVPMessage.GPVPStart.Builder.class);
}
// Construct using cn.jisol.game.proto.GPVPMessage.GPVPStart.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();
leftTactical_ = "";
rightTactical_ = "";
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return GPVPMessage.internal_static_GPVPStart_descriptor;
}
@java.lang.Override
public GPVPMessage.GPVPStart getDefaultInstanceForType() {
return GPVPMessage.GPVPStart.getDefaultInstance();
}
@java.lang.Override
public GPVPMessage.GPVPStart build() {
GPVPMessage.GPVPStart result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public GPVPMessage.GPVPStart buildPartial() {
GPVPMessage.GPVPStart result = new GPVPMessage.GPVPStart(this);
result.leftTactical_ = leftTactical_;
result.rightTactical_ = rightTactical_;
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 GPVPMessage.GPVPStart) {
return mergeFrom((GPVPMessage.GPVPStart)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(GPVPMessage.GPVPStart other) {
if (other == GPVPMessage.GPVPStart.getDefaultInstance()) return this;
if (!other.getLeftTactical().isEmpty()) {
leftTactical_ = other.leftTactical_;
onChanged();
}
if (!other.getRightTactical().isEmpty()) {
rightTactical_ = other.rightTactical_;
onChanged();
}
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 {
GPVPMessage.GPVPStart parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (GPVPMessage.GPVPStart) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private java.lang.Object leftTactical_ = "";
/**
* <pre>
*左边的布阵
* </pre>
*
* <code>string leftTactical = 1;</code>
* @return The leftTactical.
*/
public java.lang.String getLeftTactical() {
java.lang.Object ref = leftTactical_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
leftTactical_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <pre>
*左边的布阵
* </pre>
*
* <code>string leftTactical = 1;</code>
* @return The bytes for leftTactical.
*/
public com.google.protobuf.ByteString
getLeftTacticalBytes() {
java.lang.Object ref = leftTactical_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
leftTactical_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <pre>
*左边的布阵
* </pre>
*
* <code>string leftTactical = 1;</code>
* @param value The leftTactical to set.
* @return This builder for chaining.
*/
public Builder setLeftTactical(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
leftTactical_ = value;
onChanged();
return this;
}
/**
* <pre>
*左边的布阵
* </pre>
*
* <code>string leftTactical = 1;</code>
* @return This builder for chaining.
*/
public Builder clearLeftTactical() {
leftTactical_ = getDefaultInstance().getLeftTactical();
onChanged();
return this;
}
/**
* <pre>
*左边的布阵
* </pre>
*
* <code>string leftTactical = 1;</code>
* @param value The bytes for leftTactical to set.
* @return This builder for chaining.
*/
public Builder setLeftTacticalBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
leftTactical_ = value;
onChanged();
return this;
}
private java.lang.Object rightTactical_ = "";
/**
* <pre>
*右边的布阵
* </pre>
*
* <code>string rightTactical = 2;</code>
* @return The rightTactical.
*/
public java.lang.String getRightTactical() {
java.lang.Object ref = rightTactical_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
rightTactical_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <pre>
*右边的布阵
* </pre>
*
* <code>string rightTactical = 2;</code>
* @return The bytes for rightTactical.
*/
public com.google.protobuf.ByteString
getRightTacticalBytes() {
java.lang.Object ref = rightTactical_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
rightTactical_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <pre>
*右边的布阵
* </pre>
*
* <code>string rightTactical = 2;</code>
* @param value The rightTactical to set.
* @return This builder for chaining.
*/
public Builder setRightTactical(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
rightTactical_ = value;
onChanged();
return this;
}
/**
* <pre>
*右边的布阵
* </pre>
*
* <code>string rightTactical = 2;</code>
* @return This builder for chaining.
*/
public Builder clearRightTactical() {
rightTactical_ = getDefaultInstance().getRightTactical();
onChanged();
return this;
}
/**
* <pre>
*右边的布阵
* </pre>
*
* <code>string rightTactical = 2;</code>
* @param value The bytes for rightTactical to set.
* @return This builder for chaining.
*/
public Builder setRightTacticalBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
rightTactical_ = value;
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:GPVPStart)
}
// @@protoc_insertion_point(class_scope:GPVPStart)
private static final GPVPMessage.GPVPStart DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new GPVPMessage.GPVPStart();
}
public static GPVPMessage.GPVPStart getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<GPVPStart>
PARSER = new com.google.protobuf.AbstractParser<GPVPStart>() {
@java.lang.Override
public GPVPStart parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new GPVPStart(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<GPVPStart> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<GPVPStart> getParserForType() {
return PARSER;
}
@java.lang.Override
public GPVPMessage.GPVPStart getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_GPVPStart_descriptor;
private static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_GPVPStart_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\021GPVPMessage.proto\"8\n\tGPVPStart\022\024\n\014left" +
"Tactical\030\001 \001(\t\022\025\n\rrightTactical\030\002 \001(\tB\026\n" +
"\024cn.jisol.ngame.protob\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
});
internal_static_GPVPStart_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_GPVPStart_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_GPVPStart_descriptor,
new java.lang.String[] { "LeftTactical", "RightTactical", });
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@@ -0,0 +1,12 @@
syntax = "proto3";
option java_package = "cn.jisol.ngame.proto";
//PVP 开始
message GPVPStart {
string leftTactical = 1; //左边的布阵
string rightTactical = 2; //右边的布阵
}