本文整理汇总了C#中Tera.Data.Structures.Player.Player.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Player.Equals方法的具体用法?C# Player.Equals怎么用?C# Player.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tera.Data.Structures.Player.Player
的用法示例。
在下文中一共展示了Player.Equals方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChangeMoney
public void ChangeMoney(Player player, long money)
{
if (!(player.Controller is PlayerTradeController))
return;
PlayerTradeController controller = (PlayerTradeController) player.Controller;
Storage storage = player.Equals(controller.Player1) ? controller.Storage1 : controller.Storage2;
if(money < storage.Money)
controller.RemoveMoney(player, storage.Money - money);
else if(money > storage.Money)
controller.AddMoney(player, money - storage.Money);
}
示例2: RemoveMoney
public void RemoveMoney(Player arrivedFrom, long money)
{
lock (TradeLock)
{
if (IsTradeFinished())
return;
if (arrivedFrom != Player1 && arrivedFrom != Player2)
return;
Storage storage = arrivedFrom.Equals(Player1) ? Storage1 : Storage2;
if (storage.Locked)
{
SystemMessages.TradeListLocked.Send(arrivedFrom);
return;
}
if (!Communication.Global.StorageService.RemoveMoney(arrivedFrom, storage, money))
return;
Communication.Global.StorageService.AddMoneys(arrivedFrom, arrivedFrom.Inventory, money);
CheckLock(arrivedFrom.Equals(Player1) ? Storage2 : Storage1);
SystemMessages.YouOfferedMoney(storage.Money).Send(arrivedFrom);
SystemMessages.OpponentOfferedMoney(arrivedFrom.PlayerData.Name, storage.Money).Send(
arrivedFrom.Equals(Player1) ? Player2 : Player1);
UpdateWindow();
}
}
示例3: Lock
public void Lock(Player arrivedFrom)
{
lock (TradeLock)
{
if (IsTradeFinished())
return;
if (arrivedFrom != Player1 && arrivedFrom != Player2)
return;
if (arrivedFrom.Equals(Player1))
{
Storage1.Locked = !Storage1.Locked;
if (Storage1.Locked)
SystemMessages.OpponentLockedTradeList(Player1.PlayerData.Name).Send(Player1, Player2);
}
else
{
Storage2.Locked = !Storage2.Locked;
if (Storage2.Locked)
SystemMessages.OpponentLockedTradeList(Player2.PlayerData.Name).Send(Player1, Player2);
}
if (Storage1.Locked && Storage2.Locked)
Accept();
else
UpdateWindow();
}
}
示例4: RemoveItem
public void RemoveItem(Player arrivedFrom, int slot, int count)
{
lock (TradeLock)
{
if (IsTradeFinished())
return;
if (arrivedFrom != Player1 && arrivedFrom != Player2)
return;
Storage storage = arrivedFrom.Equals(Player1) ? Storage1 : Storage2;
if (storage.Locked)
{
SystemMessages.TradeListLocked.Send(arrivedFrom);
return;
}
StorageItem item = Communication.Global.StorageService.GetItemBySlot(storage, slot);
if (item == null)
return;
if (!Communication.Global.StorageService.AddItem(arrivedFrom, arrivedFrom.Inventory, item.ItemId, count))
return;
CheckLock(storage.Equals(Storage1) ? Storage2 : Storage1);
Communication.Global.StorageService.RemoveItem(arrivedFrom, storage, slot - 20, count);
SystemMessages.YouRemovedItemNameXItemAmountToTrade(item.ItemId, item.Amount).Send(arrivedFrom);
SystemMessages.OpponentRemovedItemNameItemAmount(arrivedFrom.PlayerData.Name, item.ItemId, count).Send(
arrivedFrom.Equals(Player1) ? Player2 : Player1);
UpdateWindow();
}
}