예제 #1
0
        public override void Deserialize(MemoryStream ms)
        {
            this.stream = ms;
            var tag = 0;

            while (reader.BaseStream.Position < reader.BaseStream.Length && (tag = reader.ReadInt32()) != 0)
            {
                switch (tag)
                {
                case 1:
                {
                    username = reader.ReadString();
                    break;
                }

                case 2:
                {
                    password = reader.ReadString();
                    break;
                }

                case 3:
                {
                    ePartnerID = (EPartnerID)reader.ReadInt32();
                    break;
                }
                }
            }
        }
예제 #2
0
    public static void OnLogin(string username, string password, EPartnerID ePartnerID)
    {
        var req = new PktLoginRequest();

        req.username   = username;
        req.password   = password;
        req.ePartnerID = (int)ePartnerID;
        AClientApp.RemoteCall <PktLoginResult>(req, OnLoginCb);
    }
예제 #3
0
    public AAvatarServer OnCreateAvatar(EPartnerID ePartnerID, string uid, string avatarName, int sex, Player player)
    {
        var oid  = ObjectId.GenerateNewId();
        var inst = ADBManager.Get(InitValueDefs.dbconnect, InitValueDefs.dbname).UpdateOneData(ParamNameDefs.TableAvatar
                                                                                               , ADBAccessor.filter_eq(ParamNameDefs.UID, uid) & ADBAccessor.filter_eq(ParamNameDefs.PartnerID, (int)ePartnerID) & ADBAccessor.filter_eq(ParamNameDefs.AvatarName, avatarName)
                                                                                               , ADBAccessor.updates_build(ADBAccessor.update(ParamNameDefs.AvatarSex, sex), ADBAccessor.update(ParamNameDefs.CollectionID, oid)), true);
        var a = new AAvatarServer(uid, null, oid, player);

        OnAddAvatar(a, player);
        return(a);
    }
예제 #4
0
 public override void rcvLoginCb(bool bSuccess, string uid, EPartnerID ePartnerID)
 {
     if (bSuccess)
     {
         AClientApis.OnEnterGame();
     }
     UEventListener.Instance.OnDispatchEvent(UEvents.Login, new EventLogin()
     {
         bSuccess = bSuccess
     });
 }
예제 #5
0
        internal void Create(string unionid, EPartnerID ePartnerID, string avatarName, int sex)
        {
            SetValue(ParamNameDefs.UnionID, unionid);
            SetValue(ParamNameDefs.PartnerID, (int)ePartnerID);
            SetValue(ParamNameDefs.AvatarName, avatarName);
            SetValue(ParamNameDefs.AvatarSex, sex);
            SetValue(ParamNameDefs.AvatarLevel, 1);

            SCommonds.AddItem("create", id, InitValueDefs.gold, 10000);
            SCommonds.AddItem("create", id, InitValueDefs.money, 10);
        }
예제 #6
0
 internal override void rcvLoginCb(bool bSuccess, string uid, EPartnerID ePartnerID)
 {
     if (bSuccess)
     {
         AClientApis.OnEnterGame();
     }
     else
     {
         UEventListener.Instance.OnDispatchEvent(UEvents.LoginFailed, new EventLoginFailed());
     }
     AOutput.Log($"rcvLoginCb {bSuccess}, {uid}");
 }
예제 #7
0
 public void OnAddPlayer(string uid, EPartnerID ePartnerID, IResponer client)
 {
     if (dConnectionIndexedPlayers.ContainsKey(client.playerConnDesc))
     {
         dConnectionIndexedPlayers[client.playerConnDesc].client.Response(new PktServerMessage()
         {
             message = "duplicatelogin"
         });
         if (dConnectionIndexedPlayers[client.playerConnDesc].avatar != null)
         {
             dConnectionIndexedPlayers[client.playerConnDesc].avatar.OnDispose();
         }
         dConnectionIndexedPlayers.Remove(client.playerConnDesc);
     }
     dConnectionIndexedPlayers.Add(client.playerConnDesc, new Player(uid, ePartnerID, client));
 }
예제 #8
0
    public void OnAddPlayer(string uid, EPartnerID ePartnerID, IResponer client)
    {
        if (dUIDIndexedPlayers.ContainsKey(uid))
        {
            dUIDIndexedPlayers[uid].client.Response(new PktServerMessage()
            {
                message = "duplicatelogin"
            });
            dUIDIndexedPlayers[uid].OnDisconnect();
            dUIDIndexedPlayers.Remove(uid);
        }
        if (dConnectionIndexedPlayers.ContainsKey(client.playerConnDesc))
        {
            dConnectionIndexedPlayers[client.playerConnDesc].OnDisconnect();
            dConnectionIndexedPlayers.Remove(client.playerConnDesc);
        }
        var p = new Player(uid, ePartnerID, client);

        dConnectionIndexedPlayers.Add(client.playerConnDesc, p);
        dUIDIndexedPlayers.Add(uid, p);
    }
예제 #9
0
 public Player(string uid, EPartnerID ePartnerID, IResponer client)
 {
     this.client     = client;
     this.uid        = uid;
     this.ePartnerID = ePartnerID;
 }
예제 #10
0
 internal virtual void rcvLoginCb(bool bSuccess, string uid, EPartnerID ePartnerID)
 {
     AOutput.Log($"NotImplemented rcvLoginCb");
 }
예제 #11
0
 public override void rcvLoginCb(bool bSuccess, string uid, EPartnerID ePartnerID)
 {
     AOutput.Log($"rcvLoginCb {bSuccess}, {uid}, {ePartnerID}");
 }
예제 #12
0
 public virtual void rcvLoginCb(bool bSuccess, string uid, EPartnerID ePartnerID)
 {
     AOutput.Log($"NotImplemented rcvLoginCb {bSuccess} {uid} {ePartnerID}");
 }