本文整理汇总了C#中ItemData类的典型用法代码示例。如果您正苦于以下问题:C# ItemData类的具体用法?C# ItemData怎么用?C# ItemData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ItemData类属于命名空间,在下文中一共展示了ItemData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: isItemSelected
public override bool isItemSelected(ItemData item, IEnumerable behaviourPairs, bool IsInverted = false)
{
foreach (string behaviourString in behaviourPairs)
{
ItemFilterSystem.BehaviourPair pair = JsonConvert.DeserializeObject<ItemFilterSystem.BehaviourPair>(behaviourString);
if (item.classID == pair.classID)
{
foreach (BehaviourDefinition itemBehaviour in item.behaviours)
{
if (itemBehaviour.ID == pair.behaviourID)
{
if (!IsInverted)
return true;
else
{
return false;
}
}
}
}
}
if (!IsInverted)
return false;
else
{
return true;
}
}
开发者ID:hjupter,项目名称:CloudGoodsSDK,代码行数:28,代码来源:BehaviourItemSelector.cs
示例2: DoAction
public override void DoAction(ItemData itemData)
{
///Tmp moves all to vault on backend
MoveMultipleStacks stacks = new MoveMultipleStacks();
stacks.StackInfos = new List<MoveItemStackInfo>();
foreach (ItemData item in SourceContainer.containerItems)
{
MoveItemStackInfo info = new MoveItemStackInfo();
info.MoveAmount = item.stackSize;
info.StackID = item.stackID;
stacks.StackInfos.Add(info);
}
string convert = JsonConvert.SerializeObject(stacks);
WebserviceCalls.webservice.MoveItemStacks(convert, ItemSystemGameData.UserID.ToString(), "User", ItemSystemGameData.AppID, DestinationLocation, delegate(MoveMultipleItemsResponse x)
{
ItemData[] containerItems = new ItemData[SourceContainer.containerItems.Count];
SourceContainer.containerItems.CopyTo(containerItems);
foreach (MovedItemsInfo info in x.movedItems)
{
foreach (ItemData data in containerItems)
{
if (data.stackID == info.OriginalStackID)
{
data.stackID = info.NewStackID;
SourceContainer.Remove(data, true);
DestinationContainer.Add(data, -1, false);
}
}
}
});
}
开发者ID:hjupter,项目名称:CloudGoodsSDK,代码行数:33,代码来源:ContainerMoveAllItemsAction.cs
示例3: AddItemByIdemData
public void AddItemByIdemData(ItemData item, int num, int numtag,int shortcut)
{
UpdateCount+=1;
if (itemManager != null) {
if (item != null && num > 0) {
ItemData itemdata = itemManager.CloneItemData (item);
if (itemdata != null) {
ItemCollector itemc = new ItemCollector ();
itemc.Index = itemManager.GetIndexByID (itemdata.ItemID);
itemc.Item = itemdata;
itemc.NumTag = numtag;
itemc.Shortcut = shortcut;
for (int i=0; i<Items.Count; i++) {
if (Items [i].Item != null && Items [i].Item.ItemID == itemdata.ItemID && itemdata.Stack) {
Items [i].Num += num;
return;
}
}
itemc.Num += num;
Items.Add (itemc);
if (itemc.Index == -1) {
Debug.Log (itemdata.name + " Is not registered in Item Manager! this item will not save");
}
}
}
}
}
开发者ID:sparxcrossroads,项目名称:UnitZ,代码行数:28,代码来源:CharacterInventory.cs
示例4: AddItem
protected override void AddItem(ItemData modified, int amount = -1, bool isSave = true)
{
modified.ownerContainer.Remove(modified, false, modified.stackSize);
WebserviceCalls.webservice.DeductStackAmount(modified.stackID, modified.stackSize, ReturnedString);
Destroy(modified.gameObject);
}
开发者ID:hjupter,项目名称:CloudGoodsSDK,代码行数:7,代码来源:TrashCanContainer.cs
示例5: CreatePanelByData
public void CreatePanelByData(ItemData data,int num)
{
GameObject o = CreatePanel(data,num);
o.GetComponent<Button>().onClick.AddListener(() => {
selectType = data.type;
bottomText.text = data.explanation;
//ホーム画面なら
if(homeManager){
homeManager.ChangeItem(data);
}
if(mainManager){
switch(data.type){
case ItemType.GreatLifeOrb:
mainManager.NotifyUseAll();
break;
default:
mainManager.NotifyUseOne();
break;
}
}
ResetColor();
ColorBlock cblock = o.GetComponent<Button>().colors;
cblock.normalColor = Color.white;
cblock.highlightedColor = Color.white;
o.GetComponent<Button>().colors = cblock;
});
}
开发者ID:jansou,项目名称:ScrollShooting,代码行数:31,代码来源:ItemWindowManager.cs
示例6: insertItems
public static void insertItems()
{
ItemData item;
item = new ItemData ();
item.id = 1;
item.name = "Queso de cabra";
item.description = "Hecho en el mejor caserío muggle";
item.price = 40;
item.health = 20;
item.type = Item.ItemType.Consumable;
item.subType = Item.ItemSubType.Health;
item.create ();
item = new ItemData ();
item.id = 2;
item.name = "Colgante de Dermor";
item.description = "No se me ocurre nada bueno";
item.price = 2500;
item.type = Item.ItemType.Armor;
item.subType = Item.ItemSubType.Necklace;
item.create ();
item = new ItemData ();
item.id = 3;
item.name = "Varita de principiante";
item.description = "La varita reglamentaria del centro";
item.price = 40;
item.type = Item.ItemType.Weapon;
item.subType = Item.ItemSubType.Wand;
item.create ();
}
开发者ID:hefanzhou,项目名称:hogwarts,代码行数:32,代码来源:DBSetup.cs
示例7: ShowItem
public void ShowItem(ItemData item)
{
ItemData itemInCurrentSlot;
CrewInspector.Instance.CurrentInspectedCharacter.GetItemInSlot(CrewInspector.Instance.CurrentInspectedSlot, out itemInCurrentSlot);
showingEquippedItem = itemInCurrentSlot == item;
gameObject.SetActive(true);
itemName.text = item.itemName;
itemDescription.text = item.itemDescription;
itemImage.sprite = item.LoadItemIcon();
string itemProps = item.GetItemStatModifiersList();
if (string.IsNullOrEmpty(itemProps))
itemProperties.text = "No properties";
else
itemProperties.text = itemProps;
if (showingEquippedItem) {
equipUnequipButton.GetComponentInChildren<Text>().text = "Unequip";
EnableEquipButton(true);
}
else {
equipUnequipButton.GetComponentInChildren<Text>().text = "Equip";
EnableEquipButton(CrewInventory.Instance.GetFreeItemAmount(item.itemName) > 0);
}
}
开发者ID:ullizei,项目名称:pirates,代码行数:25,代码来源:ItemInfoPanel.cs
示例8: AddItem
protected override void AddItem(ItemData modified, int amount = -1, bool isSave = true)
{
ItemData newItem = null;
if (amount == -1)
{
amount = modified.stackSize;
modified.ownerContainer = this;
if (!AddToExistingStack(modified, modified.stackSize, isSave))
{
modified.CreatNew(out newItem, amount, this);
containerItems.Add(newItem);
AddItemEvent(newItem, isSave);
}
}
else
{
modified.CreatNew(out newItem, amount, this);
if (!AddToExistingStack(newItem, amount, isSave))
{
containerItems.Add(newItem);
AddItemEvent(newItem, isSave);
}
}
Destroy(modified.gameObject);
}
开发者ID:hjupter,项目名称:CloudGoodsSDK,代码行数:28,代码来源:LimitlessItemContainer.cs
示例9: CreateItemDataFromGameObject
private ItemData CreateItemDataFromGameObject(GameObject gameObject)
{
ValidateGameObject (gameObject);
ItemData itemData = new ItemData ();
itemData.transformData.position = gameObject.transform.position;
itemData.transformData.rotation = gameObject.transform.eulerAngles;
itemData.transformData.scale = gameObject.transform.localScale;
itemData.name = gameObject.name;
foreach (IPersistable persistable in gameObject.GetComponents<IPersistable>()) {
SerializableDictionary<string, object> componentConfiguration = new SerializableDictionary<string, object> ();
foreach (FieldInfo field in persistable.GetType().GetFields()) {
componentConfiguration.Add (field.Name, field.GetValue (persistable));
}
string componentName = persistable.GetType ().FullName;
itemData.componentData.configurations.Add (componentName, componentConfiguration);
}
foreach (Transform child in gameObject.transform) {
if (child.GetComponents<IPersistable> ().Length > 0) {
itemData.children.Add (CreateItemDataFromGameObject (child.gameObject));
}
}
return itemData;
}
开发者ID:brwagner,项目名称:rocket-gilbs-v2,代码行数:30,代码来源:XmlIO.cs
示例10: registerItem
public static void registerItem(String id, Texture invTexture, GameObject model)
{
if (items.ContainsKey(id))
throw new Exception("Cannot have two items with the same id (" + id + ")");
items[id] = new ItemData(invTexture, model);
}
开发者ID:MarjieVolk,项目名称:BeautyAndTheBeast,代码行数:7,代码来源:Item.cs
示例11: GetItem
public void GetItem(ItemData item)
{
Player.Instance().hpComponent.AddHp(item.addHp);
Player.Instance().AddAttack(item.addAttack);
Player.Instance().AddDefence(item.addDefence);
Player.Instance().AddGold(item.addGold);
Message.RaiseOneMessage<Player>("PlayerShow", this, this);
string str = "你获得了" + item.name;
if (item.addHp > 0)
{
str += ",生命值增加了" + item.addHp;
}
if (item.addAttack > 0)
{
str += ",攻击力增加了" + item.addAttack;
}
if (item.addDefence > 0)
{
str += ",防御力增加了" + item.addDefence;
}
if (item.addGold > 0)
{
str += ",金币增加了" + item.addGold;
}
str += "。";
Game.Instance().ShowMessage(str, Game.Instance().gamePosition);
}
开发者ID:shuitian,项目名称:pokemon_rpg,代码行数:27,代码来源:Player.cs
示例12: Create
public static ItemSelectButton Create(ItemData data)
{
GameObject button = Instantiate(Resources.Load("GUI/CrewInspector/ItemSelectButton")) as GameObject;
ItemSelectButton buttonScript = button.GetComponent<ItemSelectButton>();
buttonScript.Init(data);
return buttonScript;
}
开发者ID:ullizei,项目名称:pirates,代码行数:7,代码来源:ItemSelectButton.cs
示例13: equipment_removedItem
void equipment_removedItem(ItemData item, int amount, bool isMovedToAnotherContainer)
{
if (item.assetURL == currentItem.assetURL && amount == item.stackSize)
{
Destroy(ActiveModel);
}
}
开发者ID:hjupter,项目名称:CloudGoodsSDK,代码行数:7,代码来源:EquipModelDisplay.cs
示例14: AddItemEvent
protected void AddItemEvent(ItemData item, bool isSave)
{
if (AddedItem != null)
{
AddedItem(item, isSave);
}
}
开发者ID:hjupter,项目名称:CloudGoodsSDK,代码行数:7,代码来源:ItemContainer.cs
示例15: RemoveItemEvent
protected void RemoveItemEvent(ItemData item, int amount, bool isMoving)
{
if (RemovedItem != null)
{
RemovedItem(item, amount, isMoving);
}
}
开发者ID:hjupter,项目名称:CloudGoodsSDK,代码行数:7,代码来源:ItemContainer.cs
示例16: AddToSlot
public void AddToSlot(ItemData modified, int slotID, int amount = -1, bool isSave = true)
{
SlottedContainerSlotData selectedSlot = slots[slotID];
ItemData NewSlotData = null;
int TargetStackSize = amount;
if (amount == -1)
TargetStackSize = modified.stackSize;
if (TargetStackSize > selectedSlot.slotMaxCountLimit)
{
TargetStackSize = selectedSlot.slotMaxCountLimit;
}
modified.CreatNew(out NewSlotData, TargetStackSize, this);
selectedSlot.slotData = NewSlotData;
ModdifyStatsByFactor(NewSlotData, 1);
containerItems.Add(NewSlotData);
Destroy(modified.gameObject);
AddItemEvent(NewSlotData, isSave);
selectedSlot.OnItemChangedWrapper();
}
开发者ID:hjupter,项目名称:CloudGoodsSDK,代码行数:25,代码来源:SlottedItemContainer.cs
示例17: ModifiedItemEvent
protected void ModifiedItemEvent(ItemData item, bool isSave)
{
if (ModifiedItem != null)
{
ModifiedItem(item, isSave);
}
}
开发者ID:hjupter,项目名称:CloudGoodsSDK,代码行数:7,代码来源:ItemContainer.cs
示例18: Init
public void Init(int itemID, int num)
{
itemData = DataManager.Instance.GetItemDataSet().GetItemData(itemID);
nameText.text = itemData.name;
descriptionText.text = itemData.shortDesc;
numText.text = "*" + num.ToString();
if(itemData.type == ItemType.Weapon)
{
WeaponData weaponData = itemData as WeaponData;
descriptionText.text = System.String.Format("攻击:{0}~{1} 命中:{2} 速度:{3}\n暴击:{4} 打断:{5}",
weaponData.basicATKMin, weaponData.basicATKMax, weaponData.basicACC, weaponData.basicSPD, weaponData.basicCRT, weaponData.interrupt);
}
else if(itemData.type == ItemType.Magic)
{
MagicData magicData = itemData as MagicData;
descriptionText.text = System.String.Format("攻击:{0}~{1} 命中:{2} 速度:{3}\n暴击:{4} 打断:{5}",
magicData.basicATKMin, magicData.basicATKMax, magicData.basicACC, magicData.basicSPD, magicData.basicCRT, magicData.interrupt);
}
GetComponent<Button>().onClick.AddListener(delegate()
{
OnClick(name);
});
}
开发者ID:huzhangyang,项目名称:ChineseRoguelikeGame,代码行数:26,代码来源:ItemButtonUIEvent.cs
示例19: AddItem
protected override void AddItem(ItemData modified, int amount = -1, bool isSave = true)
{
if (slots.Count == 0) return; // No active slots to check.
Dictionary<int, SlottedContainerSlotData> ShortList = GetAllAvalibleSlots(modified);
if (ShortList.Count == 0 || ShortList == null)
{
return; // did not find any matching slots.
}
if (slotSelector == null)
throw new Exception("Slot selector must be set before adding items to slots.");
SlottedContainerSlotData selectedSlot = slotSelector.PickBestSlot(ShortList);
if (selectedSlot == null)
{
return; // slected slot did not exist.
}
AddToSlot(modified, int.Parse(selectedSlot.slotNameID), amount, isSave);
return;
}
开发者ID:hjupter,项目名称:CloudGoodsSDK,代码行数:25,代码来源:SlottedItemContainer.cs
示例20: ChestModifySlotEventArgs
public ChestModifySlotEventArgs(TSPlayer player, int chestIndex, int slotIndex, ItemData newItem)
: base(player)
{
this.ChestIndex = chestIndex;
this.SlotIndex = slotIndex;
this.NewItem = newItem;
}
开发者ID:Enerdy,项目名称:PluginCommonLibrary,代码行数:7,代码来源:ChestModifySlotEventArgs.cs
注:本文中的ItemData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论