private void InitGuidData()
 {
     if (m_GuidInitStatus == DataInitStatus.Unload)
     {
         if (UserServerConfig.DataStoreAvailable == true)
         {
             m_GuidInitStatus = DataInitStatus.Loading;
             Msg_LD_Load msg = new Msg_LD_Load();
             msg.MsgId = (int)DataEnum.TableGuid;
             GameFrameworkMessage.Msg_LD_SingleLoadRequest slr = new GameFrameworkMessage.Msg_LD_SingleLoadRequest();
             slr.MsgId    = (int)GameFrameworkData.DataEnum.TableGuid;
             slr.LoadType = GameFrameworkMessage.Msg_LD_SingleLoadRequest.LoadTypeEnum.LoadAll;
             slr.Keys.Clear();
             msg.LoadRequests.Add(slr);
             RequestLoad(msg, ((ret) => {
                 if (ret.ErrorNo == Msg_DL_LoadResult.ErrorNoEnum.Success)
                 {
                     List <GuidInfo> guidList = new List <GuidInfo>();
                     foreach (var singlerow in ret.Results)
                     {
                         object _msg;
                         if (DbDataSerializer.Decode(singlerow.Data, DataEnum2Type.Query(slr.MsgId), out _msg))
                         {
                             TableGuid dataGuid = _msg as TableGuid;
                             if (null != dataGuid)
                             {
                                 GuidInfo guidinfo = new GuidInfo();
                                 guidinfo.GuidType = dataGuid.GuidType;
                                 guidinfo.NextGuid = (long)dataGuid.GuidValue;
                                 guidList.Add(guidinfo);
                             }
                         }
                     }
                     UserServer.Instance.GlobalProcessThread.InitGuidData(guidList);
                     m_GuidInitStatus = DataInitStatus.Done;
                     LogSys.Log(LOG_TYPE.INFO, ConsoleColor.Green, "Load DataCache global data success. Table:TableGuid");
                 }
                 else if (ret.ErrorNo == Msg_DL_LoadResult.ErrorNoEnum.NotFound)
                 {
                     //暂时初始化为空列表
                     List <GuidInfo> guidList = new List <GuidInfo>();
                     UserServer.Instance.GlobalProcessThread.InitGuidData(guidList);
                     m_GuidInitStatus = DataInitStatus.Done;
                     LogSys.Log(LOG_TYPE.INFO, ConsoleColor.Green, "Load DataCache global data success. Table:TableGuid (empty)");
                 }
                 else
                 {
                     m_GuidInitStatus = DataInitStatus.Unload;
                     LogSys.Log(LOG_TYPE.ERROR, ConsoleColor.Red, "Load DataCache global data failed. Table: {0}", "TableGuid");
                 }
             }
                               ));
         }
         else
         {
             m_GuidInitStatus = DataInitStatus.Done;
             LogSys.Log(LOG_TYPE.INFO, "init guid done!");
         }
     }
 }
Ejemplo n.º 2
0
        internal void InitGuidData(List <GuidInfo> guidList)
        {
            s_WorldId = (ulong)UserServerConfig.WorldId;
            foreach (var dataGuid in guidList)
            {
                if (dataGuid.GuidType.Equals(s_UserGuidType))
                {
                    m_NextUserGuid = dataGuid.NextGuid;
                }
            }
            GuidInfo userGuidInfo = new GuidInfo();

            userGuidInfo.GuidType = s_UserGuidType;
            userGuidInfo.NextGuid = m_NextUserGuid;
            m_GuidList.Add(userGuidInfo);

            foreach (var dataGuid in guidList)
            {
                if (dataGuid.GuidType.Equals(s_MailGuidType))
                {
                    m_NextMailGuid = dataGuid.NextGuid;
                }
            }
            GuidInfo mailGuidInfo = new GuidInfo();

            mailGuidInfo.GuidType = s_MailGuidType;
            mailGuidInfo.NextGuid = m_NextMailGuid;
            m_GuidList.Add(mailGuidInfo);

            foreach (var dataGuid in guidList)
            {
                if (dataGuid.GuidType.Equals(s_ItemGuidType))
                {
                    m_NextItemGuid = dataGuid.NextGuid;
                }
            }
            GuidInfo itemGuidInfo = new GuidInfo();

            itemGuidInfo.GuidType = s_ItemGuidType;
            itemGuidInfo.NextGuid = m_NextItemGuid;
            m_GuidList.Add(itemGuidInfo);

            foreach (var dataGuid in guidList)
            {
                if (dataGuid.GuidType.Equals(s_MemberGuidType))
                {
                    m_NextMemberGuid = dataGuid.NextGuid;
                }
            }
            GuidInfo memberGuidInfo = new GuidInfo();

            memberGuidInfo.GuidType = s_MemberGuidType;
            memberGuidInfo.NextGuid = m_NextMemberGuid;
            m_GuidList.Add(memberGuidInfo);
        }
Ejemplo n.º 3
0
        internal void InitGuidData(List<GuidInfo> guidList)
        {
            s_WorldId = (ulong)UserServerConfig.WorldId;
              foreach (var dataGuid in guidList) {
            if (dataGuid.GuidType.Equals(s_UserGuidType)) {
              m_NextUserGuid = dataGuid.NextGuid;
            }
              }
              GuidInfo userGuidInfo = new GuidInfo();
              userGuidInfo.GuidType = s_UserGuidType;
              userGuidInfo.NextGuid = m_NextUserGuid;
              m_GuidList.Add(userGuidInfo);

              foreach (var dataGuid in guidList) {
            if (dataGuid.GuidType.Equals(s_MailGuidType)) {
              m_NextMailGuid = dataGuid.NextGuid;
            }
              }
              GuidInfo mailGuidInfo = new GuidInfo();
              mailGuidInfo.GuidType = s_MailGuidType;
              mailGuidInfo.NextGuid = m_NextMailGuid;
              m_GuidList.Add(mailGuidInfo);

              foreach (var dataGuid in guidList) {
            if (dataGuid.GuidType.Equals(s_ItemGuidType)) {
              m_NextItemGuid = dataGuid.NextGuid;
            }
              }
              GuidInfo itemGuidInfo = new GuidInfo();
              itemGuidInfo.GuidType = s_ItemGuidType;
              itemGuidInfo.NextGuid = m_NextItemGuid;
              m_GuidList.Add(itemGuidInfo);

              foreach (var dataGuid in guidList) {
            if (dataGuid.GuidType.Equals(s_MemberGuidType)) {
              m_NextMemberGuid = dataGuid.NextGuid;
            }
              }
              GuidInfo memberGuidInfo = new GuidInfo();
              memberGuidInfo.GuidType = s_MemberGuidType;
              memberGuidInfo.NextGuid = m_NextMemberGuid;
              m_GuidList.Add(memberGuidInfo);
        }