Esempio n. 1
0
 public ErrorCode PostMsgToGS(CSGSInfo csgsInfo, IMessage msg, int msgID, uint gcNetID)
 {
     if (csgsInfo == null)
     {
         return(ErrorCode.NullMsg);
     }
     this.netSessionMgr.TranMsgToSession(csgsInfo.m_n32NSID, msg, msgID, gcNetID == 0 ? 0 : ( int )CSToGS.MsgID.EMsgToGsfromCsOrderPostToGc, gcNetID);
     return(ErrorCode.Success);
 }
Esempio n. 2
0
 /// <summary>
 /// 获取指定逻辑ID的GS信息
 /// </summary>
 public CSGSInfo GetGSInfoByNSID(uint nsID)
 {
     for (int i = 0; i < this.csKernelCfg.un32MaxGSNum; ++i)
     {
         CSGSInfo csgsInfo = this.gsNetInfoList[i].pcGSInfo;
         if (null == csgsInfo)
         {
             continue;
         }
         if (csgsInfo.m_n32NSID == nsID)
         {
             return(csgsInfo);
         }
     }
     return(null);
 }
        public ErrorCode Load()
        {
            Hashtable json;

            try
            {
                string content = File.ReadAllText(@".\Config\CSCfg.json");
                json = ( Hashtable )MiniJSON.JsonDecode(content);
            }
            catch (Exception e)
            {
                Logger.Error($"load CSCfg failed:{e}");
                return(ErrorCode.CfgFailed);
            }
            this.unCSId               = json.GetUInt("GameWorldID");
            this.ipaddress            = json.GetString("CSIP");
            this.n32SSNetListenerPort = json.GetInt("SSPort");
            this.n32GSNetListenerPort = json.GetInt("GSPort");
            this.un32MaxSSNum         = json.GetUInt("MaxSSNum");
            this.un32SSBaseIdx        = json.GetUInt("SSBaseIndex");
            this.un32MaxGSNum         = json.GetUInt("MaxGSNum");
            this.un32GSBaseIdx        = json.GetUInt("GSBaseIndex");
            this.maxWaitingDBNum      = json.GetInt("WaitingDBNum");
            this.redisAddress         = json.GetString("redisAddress");
            this.redisPort            = json.GetInt("redisPort");
            this.redisPwd             = json.GetString("redisPwd");
            this.redisLogicAddress    = json.GetString("redisLogicAddress");
            this.redisLogicPort       = json.GetInt("redisLogicPort");
            this.redisLogicPwd        = json.GetString("redisLogicPwd");
            this.LogAddress           = json.GetString("LogAddress");
            this.LogPort              = json.GetInt("LogPort");

            string ssIndexStr = json.GetString("AllSSIndex");

            string[] ssIndexVec = ssIndexStr.Split(';');

            if (ssIndexVec.Length > 100000)
            {
                Logger.Warn($"too many ss!");
                return(ErrorCode.CfgFailed);
            }

            this.ssInfoList = new CSSSInfo[ssIndexVec.Length];
            for (int i = 0; i != ssIndexVec.Length; ++i)
            {
                string[] ssInfoVec = ssIndexVec[i].Split(',');
                if (ssInfoVec.Length != 3)
                {
                    Logger.Error("load CSCfg.xml failed.");
                    continue;
                }
                CSSSInfo csssInfo = new CSSSInfo();
                csssInfo.m_n32SSID   = int.Parse(ssInfoVec[0]);
                csssInfo.m_szName    = ssInfoVec[1];
                csssInfo.m_szUserPwd = ssInfoVec[2];
                this.ssInfoList[i]   = csssInfo;
            }

            string gsIndexStr = json.GetString("AllGSIndex");

            string[] gsIndexVec = gsIndexStr.Split(';');
            this.gsInfoList = new CSGSInfo[gsIndexVec.Length];
            for (int i = 0; i != gsIndexVec.Length; ++i)
            {
                string[] gsInfoVec = gsIndexVec[i].Split(',');
                if (gsInfoVec.Length != 3)
                {
                    Logger.Error("load CSCfg.xml failed.");
                    continue;
                }
                CSGSInfo csgsInfo = new CSGSInfo();
                csgsInfo.m_n32GSID   = int.Parse(gsInfoVec[0]);
                csgsInfo.m_szName    = gsInfoVec[1];
                csgsInfo.m_szUserPwd = gsInfoVec[2];
                this.gsInfoList[i]   = csgsInfo;
            }

            this.n32RCNetListenerPort = json.GetInt("RSPort");
            this.remoteConsolekey     = json.GetString("RSKey");

            return(ErrorCode.Success);
        }
Esempio n. 4
0
 public ErrorCode PostMsgToGS_KickoutGC(CSGSInfo csgsInfo, uint gcNetID)
 {
     CSToGS.OrderKickoutGC sMsg = new CSToGS.OrderKickoutGC();
     sMsg.Gcnid = ( int )gcNetID;
     return(this.PostMsgToGS(csgsInfo, sMsg, ( int )CSToGS.MsgID.EMsgToGsfromCsOrderKickoutGc, 0));
 }
Esempio n. 5
0
 public ErrorCode InvokeGCMsg(CSGSInfo csgsInfo, int msgID, uint gcNetID, byte[] data, int offset, int size) =>
 this.userMgr.Invoke(csgsInfo, msgID, gcNetID, data, offset, size);