当前位置: 首页>>代码示例>>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;未经允许,请勿转载。