Photon——Extending Lite 扩展Lite

 

Extending Lite 扩展Lite

     Persistency is currently not covered in the SDKs we provide. None of our applications saves any data. Every game and application is different and on a high performance server solution, you probably want to control this aspect yourself.
     持久性是目前没有包含在我们提供的sdk里。我们没有应用程序要保存任何数据。在高性能服务器解决方案中每个游戏和应用程序都是不同的,你可能想要控制这个方面通过你自己。

     You are free to use any of the many professional solutions developed in C#. As example, take a look at:

  • NHibernate : Mature, open source object-relational mapper for the .NET framework
  • Membase : Distributed key-value database management system
  • CSharp-SQLite : SQL database in a local file
  • Lightspeed : High performance .NET domain modeling and O/R mapping framework
     你可以自由的使用任何专业的基于C#的开发解决方案。例如:
  • NHibernate:成熟的,开放源的对象关系映射器的
  • Membase:分布式数据库键值管理系统
  • CSharp-SQLite:SQL数据库在一个本地文件
  • Lightspeed:高性能建模和O/R映射框架

Trigger Game-Logic In Intervals 在时间间隔触发游戏逻辑

     If you want your server application to execute some logic in intervals, add this as method into LiteGame and schedule a message for the room. By using a message, the method call will be in sequence with any operations (avoiding threading issues).In the Lite Lobby Application’s LiteLobbyRoom.cs we used this code:
     如果你想让你的服务器应用程序在时间间隔内执行某些逻辑,添加这个方法到LiteGame和安排房间的消息。通过使用一个消息,方法调用将带着任何操作入队 (避免线程问题)。在Lite Lobby应用程序的LiteLobbyRoom.cs中我们使用这些代码:
 
/// <summary>Schedules a broadcast of all changes.</summary>
private void SchedulePublishChanges()
{
     var message = new RoomMessage(( byte )LobbyMessageCode.PublishChangeList);
     this .schedule = this .ScheduleMessage(message, LobbySettings.Default.LobbyUpdateIntervalMs);
}
 
/// <summary>Initializes a new instance of the LiteLobbyRoom class.</summary>
public LiteLobbyRoom( string lobbyName)
     : base (lobbyName)
{
     this .roomList = new Hashtable();
     this .changedRoomList = new Hashtable();
 
     // schedule sending the change list
     this .SchedulePublishChanges();
}
 
/// <summary>Sends the change list to all users in the lobby and then clears it.</summary>
private void PublishChangeList()
{
     //do something in intervals...
 
     //schedule the next call!
     this .SchedulePublishChanges();
}
 
     As you can see, at the end of   PublishChangeList  the next call is scheduled explicitly.
     我们可以看到,在 PublishChangeList 的最后安排了下一个调用。

转载于:https://www.cnblogs.com/liusuqi/archive/2013/05/15/3079716.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值