您的位置:首页 > 其它

Photon——Extending Lite 扩展Lite

2013-05-15 13:52 176 查看

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 的最后安排了下一个调用。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: