zansimple 9 сар өмнө
parent
commit
8762cb34c8

+ 48 - 0
KYNetwork/Message/OuterMessage.cs

@@ -2709,6 +2709,54 @@ namespace KYFramework.Network {
 
   }
 
+  /// <summary>
+  /// 仿真倍速调整 
+  /// </summary>
+  public partial class C2S_StmulationTimeScale : pb::IMessage {
+    private static readonly pb::MessageParser<C2S_StmulationTimeScale> _parser = new pb::MessageParser<C2S_StmulationTimeScale>(() => (C2S_StmulationTimeScale)MessagePool.Instance.Fetch(typeof(C2S_StmulationTimeScale)));
+    public static pb::MessageParser<C2S_StmulationTimeScale> Parser { get { return _parser; } }
+
+    private int timeScale_;
+    public int TimeScale {
+      get { return timeScale_; }
+      set {
+        timeScale_ = value;
+      }
+    }
+
+    public void WriteTo(pb::CodedOutputStream output) {
+      if (TimeScale != 0) {
+        output.WriteRawTag(8);
+        output.WriteInt32(TimeScale);
+      }
+    }
+
+    public int CalculateSize() {
+      int size = 0;
+      if (TimeScale != 0) {
+        size += 1 + pb::CodedOutputStream.ComputeInt32Size(TimeScale);
+      }
+      return size;
+    }
+
+    public void MergeFrom(pb::CodedInputStream input) {
+      timeScale_ = 0;
+      uint tag;
+      while ((tag = input.ReadTag()) != 0) {
+        switch(tag) {
+          default:
+            input.SkipLastField();
+            break;
+          case 8: {
+            TimeScale = input.ReadInt32();
+            break;
+          }
+        }
+      }
+    }
+
+  }
+
   /// <summary>
   /// 仿真结束 
   /// </summary>

+ 11 - 7
KYNetwork/Message/OuterOpcode.cs

@@ -63,6 +63,9 @@ namespace KYFramework.Network
 	[Message(OuterOpcode.C2S_StmulationStart)]
 	public partial class C2S_StmulationStart : IMessage {}
 
+	[Message(OuterOpcode.C2S_StmulationTimeScale)]
+	public partial class C2S_StmulationTimeScale : IMessage {}
+
 	[Message(OuterOpcode.S2C_StmulationEnd)]
 	public partial class S2C_StmulationEnd : IMessage {}
 
@@ -110,12 +113,13 @@ namespace KYFramework.Network
 		 public const ushort PlanTurningPoint = 119;
 		 public const ushort S2C_TurningPointOutput = 120;
 		 public const ushort C2S_StmulationStart = 121;
-		 public const ushort S2C_StmulationEnd = 122;
-		 public const ushort EntitySheetReportValue = 123;
-		 public const ushort SheetReportValue = 124;
-		 public const ushort ReportValue = 125;
-		 public const ushort C2S_SimulationResult = 126;
-		 public const ushort S2C_SimulatinResult = 127;
-		 public const ushort S2C_FireSpread = 128;
+		 public const ushort C2S_StmulationTimeScale = 122;
+		 public const ushort S2C_StmulationEnd = 123;
+		 public const ushort EntitySheetReportValue = 124;
+		 public const ushort SheetReportValue = 125;
+		 public const ushort ReportValue = 126;
+		 public const ushort C2S_SimulationResult = 127;
+		 public const ushort S2C_SimulatinResult = 128;
+		 public const ushort S2C_FireSpread = 129;
 	}
 }

BIN
Proto2CS.zip


+ 6 - 0
Proto2CS/bin/Debug/net7.0/OuterMessage.proto

@@ -304,6 +304,12 @@ message C2S_StmulationStart // IMessage
 	
 }
 
+/* 仿真倍速调整 */
+message C2S_StmulationTimeScale // IMessage
+{
+	int32 TimeScale = 1;
+}
+
 /* 仿真结束 */
 message S2C_StmulationEnd // IMessage
 {

+ 14 - 0
SimulationServer/MessageHandler/C2S_StmulationTimeScaleMessageHandler.cs

@@ -0,0 +1,14 @@
+using Cysharp.Threading.Tasks;
+using KYFramework.Network;
+
+namespace SimulationServer;
+
+[MessageHandler]
+public class C2S_StmulationTimeScaleMessageHandler: AMHandler<C2S_StmulationTimeScale>
+{
+    protected override UniTask Run(Session session, C2S_StmulationTimeScale message)
+    {
+        Init.SimulationSpeed = message.TimeScale;
+        return UniTask.CompletedTask;
+    }
+}

BIN
SimulationServer/bin/Debug/net7.0/KYNetwork.dll


BIN
SimulationServer/bin/Debug/net7.0/KYNetwork.pdb


BIN
SimulationServer/bin/Debug/net7.0/SimulationServer.dll


BIN
SimulationServer/bin/Debug/net7.0/SimulationServer.exe


BIN
SimulationServer/bin/Debug/net7.0/SimulationServer.pdb


BIN
SimulationServer/bin/Debug/server.zip