當前位置: 首頁>>代碼示例>>C#>>正文


C# Player.Equals方法代碼示例

本文整理匯總了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);
        }
開發者ID:arkanoid1,項目名稱:Temu,代碼行數:13,代碼來源:TradeService.cs

示例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();
            }
        }
開發者ID:arkanoid1,項目名稱:Temu,代碼行數:29,代碼來源:PlayerTradeController.cs

示例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();
            }
        }
開發者ID:arkanoid1,項目名稱:Temu,代碼行數:31,代碼來源:PlayerTradeController.cs

示例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();
            }
        }
開發者ID:arkanoid1,項目名稱:Temu,代碼行數:32,代碼來源:PlayerTradeController.cs


注:本文中的Tera.Data.Structures.Player.Player.Equals方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。