Example #1
0
        protected override async ETTask Run(Scene scene, G2M_CreateGamer request, M2G_CreateGamer response, Action reply)
        {
            DBComponent db    = scene.GetComponent <DBComponent>();
            Gamer       gamer = await GamerDBHelper.GetGamerFromDB(scene.Domain, db, request.GamerId);

            gamer.AddComponent <MailBoxComponent>();
            await gamer.AddLocation();

            gamer.AddComponent <GamerGateComponent, long>(request.GateSessionId);
            scene.GetComponent <GamerComponent>().Add(gamer);

            response.SelfGamer = GamerHelper.CreateGamerInfo(gamer);
            reply();
        }
Example #2
0
        protected override async ETTask Run(Scene scene, R2G_CreateAccount request, G2R_CreateAccount response, Action reply)
        {
            // 1 首次创建Gamer对象
            Gamer gamer = GamerHelper.InitGamer(scene.Domain, request.Account);

            // 2 存出Gamer对象到DB
            DBComponent db = scene.GetComponent <DBComponent>();
            await GamerDBHelper.AddGamerToDB(db, gamer);

            // 3 创建Player对象
            DPlayer player = PlayerHelper.InitPlayer(request.Account, request.Password, gamer.Id);
            await PlayerDBHelper.AddPlayerToDB(db, player);

            reply();
        }