Beispiel #1
0
    void OnLoginReturn(INetData receiveData)
    {
        var msg = new LoginLoginMsg_1_1();

        msg.read(receiveData.GetMemoryStream());
        //msg.loginInfo.icon
    }
Beispiel #2
0
        /// <summary>
        ///     获取角色列表返回
        /// </summary>
        private void Fun_1_1(INetData data)
        {
            var loginMsg = new LoginLoginMsg_1_1();

            loginMsg.read(data.GetMemoryStream());

            PLoginInfo[] loginInfoArrary = loginMsg.loginInfo.ToArray();

            if (loginMsg.code != 0)
            {
                Log.info(this, "-Fun_1_1 登陆失败!code:" + loginMsg.code);
                if (loginMsg.code == 12)
                {
                    Log.debug(this, "没有创建角色,进入角色创建界面");
                    Singleton <LoginView> .Instance.CloseView();

                    if (!startMoviePlayed)
                    {
                        startMoviePlayed = true;
                        //如果没有创建角色,播放开场动画、开场音乐
                        MovieStart1PlayStart();
                    }
                }
                else
                {
//					ErrorCodeManager.ShowError(loginMsg.code);
                    SysErrorCodeVo errorCodeVo = BaseDataMgr.instance.GetErrorCodeVo(uint.Parse(loginMsg.code.ToString(CultureInfo.InvariantCulture)));
                    string         result      = "";
                    if (errorCodeVo == null)
                    {
                        result = string.Format("Errorcode {0} is not defined", loginMsg.code);
                    }
                    else
                    {
                        result = errorCodeVo.desc;
                    }
                    ConfirmMgr.Instance.ShowOkAlert(result + ",退出游戏再试一次吧,亲~", ConfirmCommands.OK_CANCEL,
                                                    QuitGame, LanguageManager.GetWord("ConfirmView.Ok"));
                }
            }
            else
            {
                Log.debug(this, "-Fun_1_1 登录成功,获取登陆角色信息:");
                for (int i = 0; i < loginInfoArrary.Length; ++i)
                {
                    Log.debug(this, "id: " + loginInfoArrary[i].id);
                    Log.debug(this, "name: " + loginInfoArrary[i].name);
                    Log.debug(this, "job: " + loginInfoArrary[i].job);
                    Log.debug(this, "level: " + loginInfoArrary[i].level);
                    Log.debug(this, "sex id: " + loginInfoArrary[i].sex);
                    Log.debug(this, "lastLoginTime: " + loginInfoArrary[i].lastLoginTime);
                    Log.debug(this, "serverId: " + loginInfoArrary[i].serverId);
                }

                Log.debug(this, "-Fun_1_1 默认选择第一个游戏角色进入游戏");
                MeVo.instance.Id            = loginInfoArrary[0].id;
                myID                        = MeVo.instance.Id; //保存我自己的ID
                MeVo.instance.Name          = loginInfoArrary[0].name;
                MeVo.instance.job           = loginInfoArrary[0].job;
                MeVo.instance.Level         = loginInfoArrary[0].level;
                MeVo.instance.sex           = loginInfoArrary[0].sex;
                MeVo.instance.lastLoginTime = loginInfoArrary[0].lastLoginTime;
                MeVo.instance.serverId      = loginInfoArrary[0].serverId;

                var msdata = new MemoryStream();
                Module_1.write_1_2(msdata, MeVo.instance.Id);
                AppNet.gameNet.send(msdata, 1, 2);

                SoundMgr.Instance.PlaySceneAudio(SoundId.Music_EnterGame);
            }
        }