12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- using System;
- using System.Numerics;
- namespace ET.Server
- {
-
-
-
- [ActorMessageHandler(SceneType.Game)]
- public class R2G_LiveCommentHandler: AMActorHandler<Scene, R2G_LiveComment>
- {
- protected override async ETTask Run(Scene scene, R2G_LiveComment request)
- {
- if (string.IsNullOrEmpty(request.OpenId))
- {
- Log.Debug($"未找到openId...");
- return;
- }
-
- Map map = scene.GetComponent<GameMapComponent>().GetMapByRoomId(request.RoomId);
- if (map == null)
- {
- Log.Debug($"未找到房间...");
- return;
- }
-
- int[] units = new int[] { 101, 121, 111, 131 };
- int templateId = 0;
- switch (request.Content)
- {
- case "0":
-
- templateId = RandomGenerator.RandomArray(units);
- break;
- case "1":
-
- templateId = units[0];
- break;
- case "2":
-
- templateId = units[1];
- break;
- case "3":
-
- templateId = units[2];
- break;
- case "4":
-
- templateId = units[3];
- break;
- }
- Vector2 pos = map.GetRandomPlayerPos();
- await map.AddUnitPlayer(request.OpenId, templateId, 1, "", pos.X, pos.Y, request.NickName, request.Url);
- await ETTask.CompletedTask;
- }
- }
- }
|