예제 #1
0
        private static async ETTask <IActorResponse> Run(this ActorLocationSender self, IActorRequest iActorRequest)
        {
            long instanceId = self.InstanceId;

            using (await CoroutineLockComponent.Instance.Wait(CoroutineLockType.ActorLocationSender, self.Id))
            {
                if (self.InstanceId != instanceId)
                {
                    throw new RpcException(ErrorCode.ERR_ActorRemove, $"{MongoHelper.ToJson(iActorRequest)}");
                }

                return(await self.RunInner(iActorRequest));
            }
        }
예제 #2
0
        protected override async ETTask Run(Session session, C2R_Login request, R2C_Login response, Action reply)
        {
            // 随机分配一个Gate
            StartSceneConfig config = RealmGateAddressHelper.GetGate(session.DomainZone());

            Log.Debug($"gate address: {MongoHelper.ToJson(config)}");

            // 向gate请求一个key,客户端可以拿着这个key连接gate
            G2R_GetLoginKey g2RGetLoginKey = (G2R_GetLoginKey)await ActorMessageSenderComponent.Instance.Call(
                config.InstanceId, new R2G_GetLoginKey()
            {
                Account = request.Account
            });

            response.Address = config.OuterIPPort.ToString();
            response.Key     = g2RGetLoginKey.Key;
            response.GateId  = g2RGetLoginKey.GateId;
            reply();
        }
예제 #3
0
        private void ExportAll(string exportDir)
        {
            string md5File = Path.Combine(ExcelPath, "md5.txt");

            if (!File.Exists(md5File))
            {
                this.md5Info = new ExcelMD5Info();
            }
            else
            {
                this.md5Info = MongoHelper.FromJson <ExcelMD5Info>(File.ReadAllText(md5File));
            }

            foreach (string filePath in Directory.GetFiles(ExcelPath))
            {
                if (Path.GetExtension(filePath) != ".xlsx")
                {
                    continue;
                }

                if (Path.GetFileName(filePath).StartsWith("~"))
                {
                    continue;
                }

                string fileName = Path.GetFileName(filePath);
                string oldMD5   = this.md5Info.Get(fileName);
                string md5      = MD5Helper.FileMD5(filePath);
                this.md5Info.Add(fileName, md5);
                // if (md5 == oldMD5)
                // {
                //  continue;
                // }

                Export(filePath, exportDir);
            }

            File.WriteAllText(md5File, MongoHelper.ToJson(this.md5Info));

            Log.Info("所有表导表完成");
            AssetDatabase.Refresh();
        }
예제 #4
0
파일: Session.cs 프로젝트: warpten2001/ET-1
        public ETTask <IResponse> CallWithoutException(IRequest request)
        {
            int rpcId = ++RpcId;
            var tcs   = new ETTaskCompletionSource <IResponse>();

            this.requestCallback[rpcId] = (response) =>
            {
                if (response is ErrorResponse)
                {
                    tcs.SetException(new Exception($"Rpc error: {MongoHelper.ToJson(response)}"));
                    return;
                }

                tcs.SetResult(response);
            };

            request.RpcId = rpcId;
            this.Send(request);
            return(tcs.Task);
        }
예제 #5
0
 public static string ToJson(object obj)
 {
     return(MongoHelper.ToJson(obj));
 }
예제 #6
0
 public static void Msg(object message)
 {
     globalLog.Debug(MongoHelper.ToJson(message));
 }
예제 #7
0
 public static string MessageToStr(object message)
 {
     return(MongoHelper.ToJson(message));
 }
예제 #8
0
파일: Log.cs 프로젝트: warpten2001/ET-1
 public static void Msg(object msg)
 {
     Debug(MongoHelper.ToJson(msg));
 }