Inheritance: global::ProtoBuf.IExtensible
示例#1
0
 static public int get_m_AccountState(IntPtr l)
 {
     try {
         GameFrameworkMessage.Msg_LC_GmQueryAccount self = (GameFrameworkMessage.Msg_LC_GmQueryAccount)checkSelf(l);
         pushValue(l, true);
         pushEnum(l, (int)self.m_AccountState);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#2
0
 static public int constructor(IntPtr l)
 {
     try {
         GameFrameworkMessage.Msg_LC_GmQueryAccount o;
         o = new GameFrameworkMessage.Msg_LC_GmQueryAccount();
         pushValue(l, true);
         pushValue(l, o);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#3
0
 static public int set_m_AccountState(IntPtr l)
 {
     try {
         GameFrameworkMessage.Msg_LC_GmQueryAccount self = (GameFrameworkMessage.Msg_LC_GmQueryAccount)checkSelf(l);
         GameFrameworkMessage.GmStateEnum           v;
         checkEnum(l, 2, out v);
         self.m_AccountState = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#4
0
 static public int set_m_QueryAccount(IntPtr l)
 {
     try {
         GameFrameworkMessage.Msg_LC_GmQueryAccount self = (GameFrameworkMessage.Msg_LC_GmQueryAccount)checkSelf(l);
         string v;
         checkType(l, 2, out v);
         self.m_QueryAccount = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
        //
        internal void GMLoadAccount(string gmAccount, string accountId, int nodeHandle)
        {
            Msg_LD_Load msg = new Msg_LD_Load();

            msg.MsgId = (int)DataEnum.TableAccount;
            msg.PrimaryKeys.Add(accountId);
            Msg_LD_SingleLoadRequest reqAccount = new Msg_LD_SingleLoadRequest();

            reqAccount.MsgId    = (int)DataEnum.TableAccount;
            reqAccount.LoadType = Msg_LD_SingleLoadRequest.LoadTypeEnum.LoadSingle;
            reqAccount.Keys.Add(accountId);
            msg.LoadRequests.Add(reqAccount);
            RequestLoad(msg, (ret) => {
                JsonMessage resultMsg = new JsonMessage(LobbyGmMessageDefine.Msg_CL_GmQueryAccount, gmAccount);
                GameFrameworkMessage.Msg_LC_GmQueryAccount protoData = new GameFrameworkMessage.Msg_LC_GmQueryAccount();
                protoData.m_Result       = GameFrameworkMessage.GmResultEnum.Failed;
                protoData.m_QueryAccount = accountId;
                protoData.m_AccountState = GameFrameworkMessage.GmStateEnum.Offline;
                resultMsg.m_ProtoData    = protoData;

                KeyString primaryKey = KeyString.Wrap(ret.PrimaryKeys);
                if (Msg_DL_LoadResult.ErrorNoEnum.Success == ret.ErrorNo)
                {
                    LogSys.Log(LOG_TYPE.INFO, ConsoleColor.Green, "DataCache Load Success: Msg:{0}, Key:{1}", "GmAccount", primaryKey);
                    TableAccount dataAccount = null;
                    foreach (var result in ret.Results)
                    {
                        object _msg;
                        if (DbDataSerializer.Decode(result.Data, DataEnum2Type.Query(result.MsgId), out _msg))
                        {
                            DataEnum msgEnum = (DataEnum)result.MsgId;
                            switch (msgEnum)
                            {
                            case DataEnum.TableAccount:
                                dataAccount = _msg as TableAccount;
                                break;

                            default:
                                LogSys.Log(LOG_TYPE.ERROR, ConsoleColor.Red, "Decode account data ERROR. Wrong message id. Account:{0}, WrongId:{1}", result.PrimaryKeys[0], msgEnum);
                                break;
                            }
                        }
                    }
                    protoData.m_Result       = GameFrameworkMessage.GmResultEnum.Success;
                    protoData.m_QueryAccount = dataAccount.AccountId;
                    protoData.m_AccountState = GameFrameworkMessage.GmStateEnum.Online;
                    if (dataAccount.IsBanned)
                    {
                        protoData.m_AccountState = GameFrameworkMessage.GmStateEnum.Banned;
                    }
                }
                else if (Msg_DL_LoadResult.ErrorNoEnum.NotFound == ret.ErrorNo)
                {
                    LogSys.Log(LOG_TYPE.INFO, ConsoleColor.Yellow, "DataCache Load NotFound: Msg:{0}, Key:{1}", "GmAccount", primaryKey);
                }
                else
                {
                    LogSys.Log(LOG_TYPE.ERROR, ConsoleColor.Red, "DataCache Load Failed: Msg:{0}, Key:{1}, ERROR:{2}", "GmAccount", primaryKey, ret.ErrorInfo);
                }
                resultMsg.m_ProtoData = protoData;
                JsonGmMessageDispatcher.SendNodeMessage(nodeHandle, resultMsg);
            });
        }