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


C# PlayerMobile.EquipItem方法代碼示例

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


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

示例1: RestoreState


//.........這裏部分代碼省略.........
								if (parent != null)
								{
									if (item == pack || item == bank)
									{
										m.AddItem(item);
									}
									else if (parent == pack || parent == oldPack)
									{
										p = item.Location;
										pack.DropItem(item);
										item.Location = p;
									}
									else if (parent == bank || parent == oldBank)
									{
										p = item.Location;
										bank.DropItem(item);
										item.Location = p;
									}
									else if (parent is Container)
									{
										if (parent.Deleted)
										{
											bank.DropItem(item);
										}
										else
										{
											p = item.Location;
											((Container)parent).DropItem(item);
											item.Location = p;
										}
									}
									else if (parent is Mobile)
									{
										if (!m.EquipItem(item))
										{
											pack.DropItem(item);
										}
									}
									else
									{
										bank.DropItem(item);
									}

									item.SetLastMoved();
									item.UpdateTotals();
									item.Delta(ItemDelta.Update);
								}
								else if (Cleanup.IsBuggable(item))
								{
									--idxCreated;
									++idxDeleted;

									item.Delete();
								}
								else
								{
									item.Internalize();
								}
							}

							if (oldPack != null && oldPack != pack && !restored.ContainsKey(oldPack))
							{
								oldPack.Delete();
							}

							if (oldBank != null && oldBank != bank && !restored.ContainsKey(oldBank))
開發者ID:Ravenwolfe,項目名稱:Core,代碼行數:67,代碼來源:PlayerBackup.cs

示例2: LoadPlayer

        public void LoadPlayer(PlayerMobile pm)
        {
            Backpack pack = (Backpack)pm.Backpack;
			//pm.SendMessage(String.Format("SettingBackpack"));
			
			TeleportAllPets( pm, (Point3D)PlayerLocations[pm.Serial], (Map)PlayerMaps[pm.Serial] );
			
            pm.Location = (Point3D)PlayerLocations[pm.Serial];
			PlayerLocations.Remove(pm.Serial);
			//pm.SendMessage(String.Format("SettingLocation"));
			
            pm.Map = (Map)PlayerMaps[pm.Serial];
			PlayerMaps.Remove(pm.Serial);
			//pm.SendMessage(String.Format("SettingMap"));

            ArrayList items = (ArrayList)PlayerItems[pm.Serial];
			PlayerItems.Remove(pm.Serial);
			//pm.SendMessage(String.Format("Setting Arraylist of Items"));
            for (int i = 0; i < items.Count; ++i)
            {
				//pm.SendMessage(String.Format("LoadPlayer() {0} / {1}.", i , items.Count));
                Item item = (Item)items[i];
                if (item.Layer == Layer.Invalid)
                {
					//pm.SendMessage(String.Format("Layer Invalid!"));
                    item.Location = (Point3D)ItemLocations[item.Serial];
					ItemLocations.Remove(item.Serial);
                    pack.AddItem(item);
                }
                else
                {
                    Item test = (Item)pm.FindItemOnLayer(item.Layer);

                    if (test == null || test == item)
                    {
						ItemLocations.Remove(item.Serial);
                        pm.EquipItem(item);
                        test = (Item)pm.FindItemOnLayer(item.Layer);
                        if ( test == null )
                        	pack.AddItem(item);
                    }
                    else
                    {
                        item.Location = (Point3D)ItemLocations[item.Serial];
						ItemLocations.Remove(item.Serial);
                        if (item != pm.Backpack && item != pm.BankBox)
                            pack.AddItem(item);
                    }
                }
            }
	    
        }
開發者ID:nick12344356,項目名稱:The-Basement,代碼行數:52,代碼來源:FieldController.cs


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