当前位置: 首页 > news >正文

专业网站制作的公司哪家好上海装修网官网

专业网站制作的公司哪家好,上海装修网官网,如何做品牌营销策划,wordpress图片资源主题文章目录 Unity进阶--通过PhotonServer实现联网登录注册功能(服务器端)--PhotonServer(二)服务器端大体结构图BLL层#xff08;控制层#xff09;DAL层#xff08;数据控制层#xff09;模型层DLC 服务器配置类 发送消息类 以及消息类 Unity进阶–通过PhotonServer实现联网… 文章目录 Unity进阶--通过PhotonServer实现联网登录注册功能(服务器端)--PhotonServer(二)服务器端大体结构图BLL层控制层DAL层数据控制层模型层DLC 服务器配置类 发送消息类 以及消息类 Unity进阶–通过PhotonServer实现联网登录注册功能(服务器端)–PhotonServer(二) 如何配置PhotonServer服务器https://blog.csdn.net/abaidaye/article/details/132096415 服务器端 大体结构图 结构图示意 BLL层控制层 总管理类 using System; using System.Collections.Generic; using System.Linq; using System.Text;namespace PhotonServerFirst.Bll {public class BLLManager{private static BLLManager bLLManager;public static BLLManager Instance{get{if(bLLManager null){bLLManager new BLLManager();}return bLLManager;}}//登录注册管理public IMessageHandler accountBLL;private BLLManager(){accountBLL new Account.AccountBLL();}} } 控制层接口 using Net;namespace PhotonServerFirst.Bll {public interface IMessageHandler{//处理客户端断开的后续工作void OnDisconnect(PSpeer peer);//处理客户端的请求void OnOperationRequest(PSpeer peer, PhotonMessage message);} } 登录注册控制类 using Net; using PhotonServerFirst.Dal;namespace PhotonServerFirst.Bll.Account {class AccountBLL : IMessageHandler{public void OnDisconnect(PSpeer peer){throw new System.NotImplementedException();}public void OnOperationRequest(PSpeer peer, PhotonMessage message){//判断命令switch (message.Command){case MessageType.Account_Register:Register(peer, message);break;case MessageType.Account_Login:Login(peer, message);break;}}//注册请求 0账号1密码void Register(PSpeer peer, PhotonMessage message){object[] objs (object[])message.Content;//添加用户int res DAlManager.Instance.accountDAL.Add((string)objs[0],(string)objs[1]);//服务器响应SendMessage.Send(peer, MessageType.Type_Account, MessageType.Account_Register_Res, res);}//登陆请求 0账号1密码void Login(PSpeer peer, PhotonMessage message){object[] objs (object[])message.Content;//登录int res DAlManager.Instance.accountDAL.Login(peer, (string)objs[0], (string)objs[1]);//响应SendMessage.Send(peer, MessageType.Type_Account, MessageType.Account_Login_res, res);}} } DAL层数据控制层 总数据管理层 using PhotonServerFirst.Bll; using System; using System.Collections.Generic; using System.Linq; using System.Text;namespace PhotonServerFirst.Dal {class DAlManager{private static DAlManager dALManager;public static DAlManager Instance{get{if (dALManager null){dALManager new DAlManager();}return dALManager;}}//登录注册管理public AccountDAL accountDAL;private DAlManager(){accountDAL new AccountDAL();}} } 登录注册数据管理层 using PhotonServerFirst.Model; using System; using System.Collections.Generic; using System.Linq; using System.Text;namespace PhotonServerFirst.Dal {class AccountDAL{/// summary/// 保存注册的账号/// /summaryprivate ListAccountModel accountList new ListAccountModel();private int id 1;///summary///保存已经登录的账号/// /summaryprivate DictionaryPSpeer, AccountModel peerAccountDic new DictionaryPSpeer, AccountModel();///summary/// 添加账号////summary///param nameaccount 用户名/param///param namepassword密码/param///returns1 成功 -1账号已存在 0失败/returnspublic int Add(string account, string password){//如果账号已经存在foreach (AccountModel model in accountList){if (model.Account account){return -1;}}//如果不存在AccountModel accountModel new AccountModel();accountModel.Account account;accountModel.Password password;accountModel.ID id;accountList.Add(accountModel);return 1;}/// summary/// 登录账号/// /summary/// param namepeer连接对象/param/// param nameaccount账号/param/// param namepassword密码/param/// returns登陆成功返回账号id -1已经登陆 0用户名密码错误/returnspublic int Login(PSpeer peer, string account, string password){//是否已经登陆foreach (AccountModel model in peerAccountDic.Values){if (model.Account account){return -1;}}//判断用户名密码是否正确foreach (AccountModel model in accountList){if (model.Account account model.Password password){peerAccountDic.Add(peer, model);return model.ID;}}return 0;}} } 模型层 登录注册层 using System; using System.Collections.Generic; using System.Linq; using System.Text;namespace PhotonServerFirst.Model {/// summary/// 账号模型/// /summaryclass AccountModel{public int ID;public string Account; public string Password;} } DLC 服务器配置类 发送消息类 以及消息类 服务器配置类 using Photon.SocketServer; using ExitGames.Logging; using ExitGames.Logging.Log4Net; using log4net.Config; using System.IO;namespace PhotonServerFirst {public class PSTest : ApplicationBase{//日志需要的public static readonly ILogger log LogManager.GetCurrentClassLogger();protected override PeerBase CreatePeer(InitRequest initRequest){ return new PSpeer(initRequest);}//初始化protected override void Setup(){InitLog();}//server端关闭的时候protected override void TearDown(){}#region 日志/// summary/// 初始化日志以及配置/// /summaryprivate void InitLog(){//日志的初始化log4net.GlobalContext.Properties[Photon:ApplicationLogPath] this.ApplicationRootPath \bin_Win64\log;//设置日志的路径FileInfo configFileInfo new FileInfo(this.BinaryPath \log4net.config);//获取配置文件if (configFileInfo.Exists){//对photonserver设置日志为log4netLogManager.SetLoggerFactory(Log4NetLoggerFactory.Instance);XmlConfigurator.ConfigureAndWatch(configFileInfo);log.Info(初始化成功);}}#endregion } } 服务器面向客户端类 using System; using System.Collections.Generic; using Net; using Photon.SocketServer; using PhotonHostRuntimeInterfaces; using PhotonServerFirst.Bll;namespace PhotonServerFirst {public class PSpeer : ClientPeer{public PSpeer(InitRequest initRequest) : base(initRequest){}//处理客户端断开的后续工作protected override void OnDisconnect(DisconnectReason reasonCode, string reasonDetail){//关闭管理器BLLManager.Instance.accountBLL.OnDisconnect(this);}//处理客户端的请求protected override void OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters){var dic operationRequest.Parameters;//转为PhotonMessagePhotonMessage message new PhotonMessage();message.Type (byte)dic[0];message.Command (int)dic[1];Listobject objs new Listobject();for (byte i 2; i dic.Count; i){objs.Add(dic[i]);}message.Content objs.ToArray();//消息分发switch (message.Type){case MessageType.Type_Account:BLLManager.Instance.accountBLL.OnOperationRequest(this, message); break;case MessageType.Type_User:break;}}} } 消息类 因为这个类是unity和服务器端都需要有的所以最好生成为dll文件放进unitynet3.5以下 namespace Net {public class PhotonMessage{public byte Type;public int Command;public object Content;public PhotonMessage() { }public PhotonMessage(byte type, int command, object content){Type type;Command command;Content content;}}//消息类型public class MessageType{public const byte Type_Account 1;public const byte Type_User 2;//注册账号public const int Account_Register 100;public const int Account_Register_Res 101;//登陆public const int Account_Login 102;public const int Account_Login_res 103;} } 发送消息类 using Photon.SocketServer; using System; using System.Collections.Generic; using System.Linq; using System.Text;namespace PhotonServerFirst {class SendMessage{/// summary/// 发送消息/// / summary/// param name peer 连接对象 / param /// param nametype类型/param/// param namecommand 命令/param/// param name objs 参数 / param public static void Send(PSpeer peer, byte type,int command,params object[] objs){Dictionarybyte, object dic new Dictionarybyte, object(); dic.Add(0, type);dic.Add(1, command);byte i 2;foreach (object o in objs){dic.Add(i,o);}EventData ed new EventData(0, dic);peer.SendEvent(ed, new SendParameters());}} }
http://www.pierceye.com/news/895948/

相关文章:

  • 手机网站收费怎么停止网站
  • 网站建设 金疙瘩计划杭州小程序制作公司排行榜
  • 德泰诺网站建设软件著作权登记证书
  • 商标设计网页seo外包公司兴田德润官方地址
  • 网站开发人员岗位成功营销案例分享
  • 赤峰做网站的公司湘潭哪里做网站
  • 免费自助建站郑州官网seo费用
  • 称心的常州网站建设wordpress怎么用两个主题
  • 建设银行北京分行网站做视频网站用什么服务器配置
  • 网站备案流程实名认证医疗网站建设资讯
  • 一个做问卷调查的网站好wordpress七比2
  • 西双版纳网站制作公司临沂企业网站建站模板
  • 培训做网站国内适合个人做外贸的网站有哪些
  • 我想卖自己做的鞋子 上哪个网站好中信银行网站怎么做的怎么烂
  • 在线网站建设工程标准godaddy 上传网站
  • 营销型网站方案ppt模板手机建站平台微点
  • 网站信息备案管理系统电商网页精品欣赏网站
  • 推广公司让实名认证怎么办系统优化设置
  • 公司网站 正式上线如何创建一个软件
  • app备案查询网站上海缪斯设计公司地址
  • 旅游小网站怎样做精不做全组建网站 多少钱
  • 天津城乡住房建设厅网站网站建设观点
  • 电子商务网站建设的认识tk网站免费
  • html网页设计网站开发报告企业做的网站费入什么科目
  • 网站建设辶金手指排名十三郑州经济技术开发区教师招聘公告
  • 企业网站建设课程体会西安网站制作定制
  • 网站主题服务公司管理软件免费版
  • 网站建设主要职责六安网站建设
  • wordpress电影站主题一般做兼职在哪个网站
  • 可信网站友链怎么做网站建设行业标准