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


C# Key.Delete方法代碼示例

本文整理匯總了C#中Server.Items.Key.Delete方法的典型用法代碼示例。如果您正苦於以下問題:C# Key.Delete方法的具體用法?C# Key.Delete怎麽用?C# Key.Delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Server.Items.Key的用法示例。


在下文中一共展示了Key.Delete方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: OnTarget

        protected override void OnTarget(Mobile from, object target) // Override the protected OnTarget() for our feature
        {
            if (target is BaseDoor)
            {
                BaseDoor door = target as BaseDoor;
                BaseHouse h1 = BaseHouse.FindHouseAt(door);
                BaseHouse h2 = BaseHouse.FindHouseAt(from);
                if (h1 == null || h1 != h2)
                {
                    from.SendLocalizedMessage(502094); // You must be in your house to do this.
                    return;
                }
                else if (h1.IsOwner(from) == false)
                {
                    from.SendLocalizedMessage(501303); // Only the house owner may change the house locks.
                    return;
                }

                // don't remove old keys because you will endup removing the main house keys
                //  we need to single this door out somehow
                // Key.RemoveKeys( from, oldKeyValue );

                // make the keys
                uint keyValue = Key.RandomValue();
                Key packKey = new Key(KeyType.Gold);
                Key bankKey = new Key(KeyType.Gold);
                packKey.KeyValue = keyValue;
                bankKey.KeyValue = keyValue;
                BankBox box = from.BankBox;
                if (box == null || !box.TryDropItem(from, bankKey, false))
                    bankKey.Delete();
                from.AddToBackpack(packKey);

                // rekey door
                door.KeyValue = keyValue;

                from.SendMessage("The lock on this door has been changed, and new master key has been placed in your bank and your backpack.");
                m_Deed.Delete(); // Delete the deed                
            }
            else
            {
                from.SendMessage("That is not a door.");
            }
        }
開發者ID:zerodowned,項目名稱:angelisland,代碼行數:44,代碼來源:DoorRekeyingContract.cs

示例2: CreateKeys

		public uint CreateKeys( Mobile m )
		{
			uint value = Key.RandomValue();

			if ( !IsAosRules )
			{
				Key packKey = new Key( KeyType.Gold );
				Key bankKey = new Key( KeyType.Gold );

				packKey.KeyValue = value;
				bankKey.KeyValue = value;

				packKey.LootType = LootType.Newbied;
				bankKey.LootType = LootType.Newbied;

				BankBox box = m.BankBox;

				if ( !box.TryDropItem( m, bankKey, false ) )
					bankKey.Delete();

				m.AddToBackpack( packKey );
			}

			return value;
		}
開發者ID:ITLongwell,項目名稱:mondains-legacy,代碼行數:25,代碼來源:BaseHouse.cs

示例3: CreateKeys

		public uint CreateKeys( Mobile m )
		{
			uint value = Key.RandomValue();

			Key packKey = new Key( KeyType.Gold, value, this );
			Key bankKey = new Key( KeyType.Gold, value, this );

			packKey.MaxRange = 10;
			bankKey.MaxRange = 10;

			packKey.Name = "a ship key";
			bankKey.Name = "a ship key";

			BankBox box = m.BankBox;

			if ( !box.TryDropItem( m, bankKey, false ) )
				bankKey.Delete();
			else
				m.LocalOverheadMessage( MessageType.Regular, 0x3B2, 502484 ); // A ship's key is now in my safety deposit box.

			if ( m.AddToBackpack( packKey ) )
				m.LocalOverheadMessage( MessageType.Regular, 0x3B2, 502485 ); // A ship's key is now in my backpack.
			else
				m.LocalOverheadMessage( MessageType.Regular, 0x3B2, 502483 ); // A ship's key is now at my feet.

			return value;
		}
開發者ID:PepeBiondi,項目名稱:runsa,代碼行數:27,代碼來源:BaseBoat.cs

示例4: CreateTentKeys

        public uint CreateTentKeys(Mobile m)
        {
            uint value = Key.RandomValue();

            m_KeyOwner = value;

            if (!IsAosRules)
            {

                Key packKey = new Key(KeyType.Iron);
                Key bankKey = new Key(KeyType.Iron);

                packKey.KeyValue = value;
                bankKey.KeyValue = value;

                packKey.LootType = LootType.Regular;
                bankKey.LootType = LootType.Regular;

                BankBox box = m.BankBox;

                if (box == null || !box.TryDropItem(m, bankKey, false))
                    bankKey.Delete();
                else
                    m.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "A house key is now in my safety deposit box."); // A ship's key is now in my safety deposit box.

                if (m.AddToBackpack(packKey))
                    m.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "A house key is now in my backpack."); // A ship's key is now in my backpack.
                else
                    m.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "A house key is now at my feet."); // A ship's key is now at my feet.
            }

            return value;
        }
開發者ID:Godkong,項目名稱:RunUO,代碼行數:33,代碼來源:BaseHouse.cs

示例5: CreateKeys

        public uint CreateKeys(Mobile m)
        {
            uint value = Key.RandomValue();

            Key packKey = new Key(KeyType.Copper);
            Key bankKey = new Key(KeyType.Copper);

            packKey.KeyValue = value;
            bankKey.KeyValue = value;

            m_HouseKeyVal = value;

            packKey.LootType = LootType.Regular;
            bankKey.LootType = LootType.Regular;

            BankBox box = m.BankBox;

            if (!box.TryDropItem(m, bankKey, false))
                bankKey.Delete();

            m.AddToBackpack(packKey);

            return value;
        }
開發者ID:FreeReign,項目名稱:imaginenation,代碼行數:24,代碼來源:TownHouseSign.cs

示例6: CreateKeys

        public uint CreateKeys( Mobile m )
        {
            uint value = Key.RandomValue();

            Key packKey = new Key( KeyType.Gold, value, this );
            Key bankKey = new Key( KeyType.Gold, value, this );

            packKey.MaxRange = 10;
            bankKey.MaxRange = 10;

            BankBox box = m.BankBox;

            if ( box == null || !box.TryDropItem( m, bankKey, false ) )
                bankKey.Delete();
            else
                m.SendLocalizedMessage( 502484 ); // A ship's key is now in my safety deposit box.

            if ( m.AddToBackpack( packKey ) )
                m.SendLocalizedMessage( 502485 ); // A ship's key is now in my backpack.
            else
                m.SendLocalizedMessage( 502483 ); // A ship's key is now at my feet.

            return value;
        }
開發者ID:FreeReign,項目名稱:Rebirth-Repack,代碼行數:24,代碼來源:BaseBoat.cs


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