本文整理汇总了C#中System.Result.failed方法的典型用法代码示例。如果您正苦于以下问题:C# Result.failed方法的具体用法?C# Result.failed怎么用?C# Result.failed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Result
的用法示例。
在下文中一共展示了Result.failed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Operate
protected void Operate( object sender, EventArgs args )
{
Planet planet = getPlanet();
Result result = null;
try {
string operation = GetVar("currentOperation");
string resource = GetVar("resource");
string quantityToOperate = quantity.Text;
quantity.Text = "";
switch(operation) {
case "sell":
result = Chronos.Trade.Market.Sell(planet, resource, int.Parse(quantityToOperate));
break;
case "buy":
result = Chronos.Trade.Market.Buy(planet, resource, int.Parse(quantityToOperate));
break;
default:
throw new Exception();
}
} catch {
result = new Result();
result.failed( new InvalidOperation() );
} finally {
operationReport.ResultSet = result;
}
}
示例2: demolish
/// <summary>Comando de build de um recurso</summary>
private void demolish( ResourceManager planet )
{
if( planet is Planet ) {
Planet p = (Planet) planet;
if( p.IsInBattle ) {
Result result = new Result();
result.failed( new PlanetInBattle() );
QueueError.ResultSet = result;
return;
}
if( p.BuilingsDemolished > 2 ) {
Result result = new Result();
//result.failed( new CanNotDemolish() );
QueueError.ResultSet = result;
return;
}
++p.BuilingsDemolished;
}
int curr = planet.getResourceCount(Category, resource);
if( quantity <= curr ) {
planet.take(Category, resource, quantity);
}
}