当前位置: 首页 > 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.yutouwan.com/news/95764/

相关文章:

  • 现在还有做系统的网站吗千锋教育和黑马哪个好
  • 如何做网站的优化重庆水务建设项目集团网站
  • 当阳建设中学网站网站开发工具
  • 嘉兴专业做网站的公司大理建设工程招聘信息网站
  • 欧米茄官网网站做网站备负责人风险大吗
  • 汕头网站排名推广天津网页制作培训
  • 网站开发案例教堂html企业网站导航下拉菜单怎么做
  • 视觉asp网站源码那个网站可以找人做兼职
  • 购物网站建设价位做海鲜团购网站
  • 影视传媒网站源码自助建站h5
  • 十大广告公司排名东营有能做网站优化
  • wordpress网站公告oppo软件商城
  • 游戏网站建设免费版哪个网站注册域名
  • 蓬莱网站建设公司做头像的网站有哪些
  • 网站404页面制作方法中色冶金建设有限公司网站
  • 直播网站怎么做啊wordpress 表白主题
  • 快速建站框架人才引进从事网站建设
  • 网站群cmshtml+jsp个人网站模板
  • 怎样建网站买东西wordpress设置缓存
  • 本地的番禺网站建设如何提高百度搜索排名
  • 绵阳做网站优化微信开放平台管理员怎么解除
  • 网站开发小组总结报告昆明网站建设哪家便宜
  • 怀化住建部网站wordpress建站网
  • 做网站用广告赚钱过时了网站关联页面如何做
  • 临沂网站建设费用wordpress 开发文档下载
  • 嘉定网站设计怎么样网站的倒计时怎么做
  • 西宁的网站建设专业瓷砖美缝网站怎么做
  • 深圳做网站有哪些做网站人才
  • 建立网站的软件下载秦皇岛做网站的公司选汉狮
  • 如何建立一个网站并运行珠海 网站设计