void Start()
    {
        selectRoleView = UISceneCtrl.Instance.Load(UISceneType.SelectRole).GetComponent <UISceneSelectRoleView>();
        selectRoleView.OnClickSelectRoleItem = OnClickSelectRoleItem;
        selectRoleView.NextJobButton         = OnClickNextJobButton;
        selectRoleView.EnterGameButton       = OnClickEnterGameButton;
        selectRoleView.DeleteRoleButton      = OnClickDeleteRoleButton;
        selectRoleView.CreateRoleButton      = OnClickCreateRoleButton;
        selectRoleView.ReturnButton          = OnClickReturnButton;

        LoadRole();

        RoleOpration_LogOnGameServerProto proto = new RoleOpration_LogOnGameServerProto();

        proto.AccoutID = Global.Instance.AccountEntity.Id;
        NetWorkSocket.Instance.SendMsg(proto.ToArray());
        SocketDispatcher.Instance.AddEventListen(ProtoCodeDef.LogOnGameServerReturnProto, OnLogOnGameServerReturnProto);
        SocketDispatcher.Instance.AddEventListen(ProtoCodeDef.DeleteRoleReturnProto, OnDeleteRoleReturnProto);
        SocketDispatcher.Instance.AddEventListen(ProtoCodeDef.EnterGameReturnProto, OnEnterGameReturnProto);
        SocketDispatcher.Instance.AddEventListen(ProtoCodeDef.SelectRoleInfoReturnProto, OnSelectRoleInfoReturnProto);
        SocketDispatcher.Instance.AddEventListen(ProtoCodeDef.CreateRoleReturnProto, OnCreateRoleReturnProto);
        SocketDispatcher.Instance.AddEventListen(ProtoCodeDef.SkillReturnReturnProto, OnSkillReturnReturnProto);
        //加载完成
        if (DelegateDefine.Instance.OnLoadSceneOK != null)
        {
            DelegateDefine.Instance.OnLoadSceneOK();
        }
    }
示例#2
0
        private void LogOnGameServerProtoCallBack(Role role, byte[] content)
        {
            RoleOpration_LogOnGameServerProto logOnProto = RoleOpration_LogOnGameServerProto.ToProto(content);
            int accountId = logOnProto.AccoutID;

            role.AccountId = accountId;
            LogonGameServerReturn(role, accountId);
        }
 public static RoleOpration_LogOnGameServerProto ToProto(byte[] buffer)
 {
     using (MMO_MemoryStream ms = new MMO_MemoryStream(buffer))
     {
         RoleOpration_LogOnGameServerProto proto = new RoleOpration_LogOnGameServerProto();
         proto.AccoutID = ms.ReadInt();
         return(proto);
     }
 }