本文整理汇总了C#中Game.OnUnexpectedOperationError方法的典型用法代码示例。如果您正苦于以下问题:C# Game.OnUnexpectedOperationError方法的具体用法?C# Game.OnUnexpectedOperationError怎么用?C# Game.OnUnexpectedOperationError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Game
的用法示例。
在下文中一共展示了Game.OnUnexpectedOperationError方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnOperationReturn
/// <summary>
/// The on operation return.
/// </summary>
/// <param name="game">
/// The mmo game.
/// </param>
/// <param name="response">
/// The operation response.
/// </param>
public void OnOperationReturn(Game game, OperationResponse response)
{
if (response.ReturnCode == 0)
{
switch ((OperationCode)response.OperationCode)
{
case OperationCode.RemoveInterestArea:
case OperationCode.AddInterestArea:
{
return;
}
case OperationCode.AttachInterestArea:
{
HandleEventInterestAreaAttached(game, response.Parameters);
return;
}
case OperationCode.DetachInterestArea:
{
HandleEventInterestAreaDetached(game);
return;
}
case OperationCode.SpawnItem:
{
HandleEventItemSpawned(game, response.Parameters);
return;
}
case OperationCode.RadarSubscribe:
{
return;
}
}
}
game.OnUnexpectedOperationError(response);
}
示例2: OnOperationReturn
/// <summary>
/// The on operation return.
/// </summary>
/// <param name="game">
/// The mmo game.
/// </param>
/// <param name="response">
/// The operation response.
/// </param>
public void OnOperationReturn(Game game, OperationResponse response)
{
if (response.ReturnCode == 0)
{
switch ((OperationCode)response.OperationCode)
{
case OperationCode.RemoveInterestArea:
case OperationCode.AddInterestArea:
{
return;
}
case OperationCode.AttachInterestArea:
{
HandleEventInterestAreaAttached(game, response.Parameters);
return;
}
case OperationCode.DetachInterestArea:
{
HandleEventInterestAreaDetached(game);
return;
}
case OperationCode.SpawnItem:
{
HandleEventItemSpawned(game, response.Parameters);
return;
}
case OperationCode.RadarSubscribe:
{
return;
}
#region PopBloop Codes
case OperationCode.QuestJournal:
{
return;
}
case OperationCode.UpdateInventory:
{
// Every time we update the inventory, we should refetch the new one
Operations.FetchInventory(game);
return;
}
case OperationCode.FetchInventory:
{
HandleEventFetchInventory(game, response.Parameters);
return;
}
case OperationCode.UpdateEquipment:
{
Operations.FetchEquipments(game);
return;
}
case OperationCode.FetchEquipments:
{
HandleEventFetchEquipments(game, response.Parameters);
return;
}
case OperationCode.LevelInfo:
{
HandleGetLevelInfo(game, response.Parameters);
return;
}
#endregion
}
}
game.Listener.LogDebug(game, "WorldEntered: Error with return code " + response.ReturnCode + " opcode = " + response.OperationCode);
game.OnUnexpectedOperationError(response);
}
示例3: OnOperationReturn
//.........这里部分代码省略.........
return;
}
case OperationCode.GameItemMove:
case OperationCode.GameItemAnimate:
{
// DO NOTHING, THIS WILL BE HANDLED BY WORLDENTERED STATE
return;
}
#region ORIGINAL CODES
/*
case OperationCode.CreateWorld:
{
game.Avatar.EnterWorld();
return;
}
case OperationCode.EnterWorld:
{
var worldData = new WorldData
{
Name = (string)response.Parameters[(byte)ParameterCode.WorldName],
BottomRightCorner = (float[])response.Parameters[(byte)ParameterCode.BottomRightCorner],
TopLeftCorner = (float[])response.Parameters[(byte)ParameterCode.TopLeftCorner],
TileDimensions = (float[])response.Parameters[(byte)ParameterCode.TileDimensions]
};
game.SetStateWorldEntered(worldData);
return;
}
*/
#endregion
}
}
else
{
switch ((OperationCode)response.OperationCode)
{
case OperationCode.LoadWorld:
{
// Do something when load world is failed
game.Listener.LogError(game, "LoadWorld failed: " + ((ReturnCode)response.ReturnCode).ToString() + " => " + response.DebugMessage);
if (game.Listener.IsDebugLogEnabled)
{
game.Listener.LogError(game, "LoadWorld failed, Game disconnected, Return Code: " + response.ReturnCode + ", OpCode: " + response.OperationCode + ", " +
response.DebugMessage);
}
game.Listener.OnAuthenticated(game, false);
return;
}
case OperationCode.Login:
case OperationCode.Authenticate:
{
game.Listener.LogError(game, "Auth failed: " + ((ReturnCode)response.ReturnCode).ToString() + " => " + response.DebugMessage);
if (game.Listener.IsDebugLogEnabled)
{
game.Listener.LogError(game, "Authentication failed, Game disconnected, Return Code: " + response.ReturnCode + ", OpCode: " + response.OperationCode + ", " +
response.DebugMessage);
}
game.Listener.OnAuthenticated(game, false);
return;
}
case OperationCode.EnterWorld:
{
if (game.Listener.IsDebugLogEnabled)
{
game.Listener.LogDebug(game, "OpCode: Invalid EnterWorld");
}
Operations.CreateWorld(
game, game.WorldData.Name, game.WorldData.TopLeftCorner, game.WorldData.BottomRightCorner, game.WorldData.TileDimensions);
return;
}
#region ORIGINAL CODES
/*
case OperationCode.EnterWorld:
{
Operations.CreateWorld(
game, game.WorldData.Name, game.WorldData.TopLeftCorner, game.WorldData.BottomRightCorner, game.WorldData.TileDimensions);
return;
}
*/
#endregion
}
}
game.OnUnexpectedOperationError(response);
}
示例4: OnOperationReturn
/// <summary>
/// The on operation return.
/// </summary>
/// <param name="game">
/// The game logic.
/// </param>
/// <param name="response">
/// The response.
/// </param>
public void OnOperationReturn(Game game, OperationResponse response)
{
// by default, a return of 0 is "successfully done"
if (response.ReturnCode == 0)
{
switch ((OperationCode)response.OperationCode)
{
case OperationCode.CreateWorld:
{
game.Avatar.EnterWorld();
return;
}
case OperationCode.EnterWorld:
{
var worldData = new WorldData
{
Name = (string)response.Parameters[(byte)ParameterCode.WorldName],
BottomRightCorner = (float[])response.Parameters[(byte)ParameterCode.BottomRightCorner],
TopLeftCorner = (float[])response.Parameters[(byte)ParameterCode.TopLeftCorner],
TileDimensions = (float[])response.Parameters[(byte)ParameterCode.TileDimensions]
};
game.SetStateWorldEntered(worldData);
return;
}
}
}
else
{
switch ((OperationCode)response.OperationCode)
{
case OperationCode.EnterWorld:
{
Operations.CreateWorld(
game, game.WorldData.Name, game.WorldData.TopLeftCorner, game.WorldData.BottomRightCorner, game.WorldData.TileDimensions);
return;
}
}
}
game.OnUnexpectedOperationError(response);
}
示例5: OnOperationReturn
public void OnOperationReturn(Game game, OperationResponse operationResponse)
{
game.OnUnexpectedOperationError(operationResponse);
}