Esempio n. 1
0
        public override void OnRecv(ref Conn conn)
        {
            CG_CreateRole createRole = GetData <CG_CreateRole>(structBytes);

            Console.WriteLine("userName:"******"接受创建name:" + createRole.name);
            Console.WriteLine("接受创建occ:" + createRole.occ);

            TablePlayer playerTable = DBPlayer.Inst.CreatePlayer(createRole.userName, createRole.name, createRole.occ);

            playerTable.X = 140;
            playerTable.Y = 170;
            if (playerTable != null)
            {
                eno        = 0;
                playerData = MsgLogin.CreatePlayer(ref conn, createRole.userName, ref playerTable);
                Console.WriteLine("创建角色成功,返回角色信息");
                // 进入默认场景
                Lobby map = LobbyManager.Inst.GetLobby(playerData.mapId);
                map.AddPlayer(conn.player);
            }
            else
            {
                eno = -1;
                Console.WriteLine("创建角色失败");
            }
            conn.Send(this);
        }
Esempio n. 2
0
        private void OnSendLoginMsg()
        {
            MsgLogin msgLogin = (MsgLogin)NetManager.Inst.GetMessage(eNetMessageID.MsgLogin);

            EGame.m_openid          = GetUserName();
            msgLogin.login.userName = EGame.m_openid;
            msgLogin.login.passWord = GetPassWord();
            NetRunTime.Inst.SendMessage(msgLogin);

            //CG_Login login = new CG_Login();
            //login.userName = EGame.m_openid;
            //login.passWord = GetPassWord();
            //NetRunTime.Inst.SendMessage<CG_Login>(eNetMessageID.MsgLogin, login);
            //Debug.Log("发送登陆");
        }
Esempio n. 3
0
        public override void OnRecv()
        {
            if (eno == 0)
            {
                CreateRoleModule cRole = (CreateRoleModule)LayoutMgr.Inst.GetLogicModule(LogicModuleIndex.eLM_PanelCreate);
                cRole.SetVisible(false);

                Debug.Log("创建角色成功,直接进入大厅");
                SC_PlayerPublicData data = GetData <SC_PlayerPublicData>(structBytes);
                Debug.Log(data.name);
                Debug.Log(data.occ);
                Debug.Log(data.x);
                Debug.Log(data.y);
                Debug.Log(data.dir);



                MsgLogin.EnterMainUI(data);
            }
            else if (eno == -1)
            {
                Debug.Log("创建角色失败");
            }
        }