public static IItemBase GetItem(int id) { IItemBase item = null; item = CSTable.StaticDataManager.ItemTpl[id]; if (item == null) { item = CSTable.StaticDataManager.ItemEquip[id]; } if (item == null) { item = CSTable.StaticDataManager.ItemFashion[id]; } if (item == null) { item = CSTable.StaticDataManager.ItemPackage[id]; } if (item == null) { item = CSTable.StaticDataManager.ItemGift[id]; } if (item == null) { item = CSTable.StaticDataManager.ItemGem[id]; } return(item); }
private static nfloat GetCellHeight(IItemBase item) { nfloat finalHeight = 0; if (item is AllEventsItem) { return(72); } if (item is EventCategoryDouble) { var imageWidth = (UIScreen.MainScreen.Bounds.Width - 42) / 2; finalHeight += imageWidth * 0.65f; finalHeight += 28; } if (item is EventCategory) { finalHeight += 50; } if (item is Event) { finalHeight += UIScreen.MainScreen.Bounds.Width * 0.5f + 2; } return(finalHeight); }
private void Start() { if (this.item != null) { IItemBase itemObj = ItemManager.create <IItemBase>(this.item, this.transform.position, this.transform.rotation); } }
public void ChangeLinkedItems(IItemBase newSourceItem, IItemBase newTargetItem) { var relationship = Context.Relationships.GetRelation(Id); _relationship.SourceEntityId = relationship.SourceEntityId = newSourceItem.ItemId; _relationship.TargetEntityId = relationship.TargetEntityId = newTargetItem.ItemId; Context.Relationships.UpdateRelation(relationship); }
/// <summary> /// Called when the craft button is clicked. /// </summary> public void callback_craftButtonClick() { Recipe r = this.selectedRecipe.getRecipe(); ContainerContents <IItemBase> inventory = this.getPlayer().inventory; // Remove the items from the players inventory. foreach (ItemData item in r.getIngredients()) { int i; inventory.containsItem(item, out i); if (i != -1) { ItemManager.destroyItem(this.getPlayer(), i); } } // Add the new item to the players inventory. if (r.getResult() != null) { IItemBase item = ItemManager.create <IItemBase>(r.getResult()); item.setInWorld(false, Vector3.zero, Quaternion.identity); inventory.addItem(item); } // Set the selected recipe to be null. this.selectedRecipe.setOutlined(false); this.setSelectedRecipe(null); }
/// <summary> /// Called by a slot game object when it is clicked on. /// </summary> public virtual void onSlotClick(int i, bool leftBtn, bool rightBtn, bool middleBtn) { ContainerHeldItem cm = this.player.playerUI.heldItem; IItemBase heldStack = cm.getHeldItem(); IItemBase slotContents = this.contents.getItem(i); if (leftBtn) { if (heldStack == null && slotContents != null) { // Slot is empty, hand is occupied. Pick up the stack. cm.setHeldStack(slotContents); this.contents.setItem(i, null); } else if (heldStack != null && slotContents == null) { // Slot is occupied, hand is not. Drop off the stack. this.contents.setItem(i, heldStack); cm.setHeldStack(null); } else if (heldStack != null && slotContents != null) { // Both hand and slot have stuff. // Swap. IItemBase temp = slotContents; this.contents.setItem(i, heldStack); cm.setHeldStack(temp); } } }
/// <summary> /// 根据列表项信息创建节点 /// </summary> /// <param name="item"></param> /// <param name="imgIndex">图片索引</param> /// <returns></returns> public static TreeNode CreateNode(this IItemBase item, int imgIndex) { var text = item is IPluginItem pluginItem && pluginItem.AppendSplit ? item.Text + "(|)" : item.Text; return(new TreeNode { Name = item.Name, Text = text, Tag = item, ImageIndex = imgIndex }); }
/// <summary> /// Renders the slot contents on the screen. /// </summary> public virtual void renderSlotContents() { IItemBase item = this.container.getContents().getItem(this.index); if (item != null) { RenderHelper.renderItemMesh(item, this.transform.position, this.transform.rotation, this.transform.localScale); } }
public static IFolderDataBase NewFolderDataBase(IItemBase itemBase) { switch (itemBase.ItemKind) { case ItemKind.Folder: return new FolderDataBaseDefault() { DisplayName = itemBase.DisplayName, FolderType = GetFolderType(itemBase) }; default: return new FolderDataBaseDefault() { DisplayName = itemBase.DisplayName, FolderType = DefaultFolderType }; } }
public Item(IItemBase itemBase) { BaseType = itemBase; ItemClass = itemBase.ItemClass; Tags = itemBase.Tags; Width = itemBase.InventoryWidth; Height = itemBase.InventoryHeight; RequirementsFromBase(); Image = itemBase.Image; Properties = new ObservableCollection <ItemMod>(itemBase.GetRawProperties()); }
public void generateItem() { if (this.areaEnabled == true && this.lootTable != null) { ItemData itemData = this.lootTable.getRndItem(); if (itemData != null) { Quaternion rndRot = Quaternion.identity; // TODO IItemBase item = ItemManager.create <IItemBase>(itemData, this.getRndPoint(), rndRot); } } }
public void drawHotbarItems(ContainerContents <IItemBase> container) { for (int i = 0; i < 4; i++) { IItemBase item = container.getItem(i); if (item != null) { Transform t = this.hotbarSquares[i].transform; RenderHelper.renderItemMesh(item, t.position, t.rotation, t.localScale, this.orthoCamera); } } }
/// <summary> /// Sets the stack held by the mouse. You can pass null. /// </summary> public void setHeldStack(IItemBase item) { if (item == null) { this.heldItem = null; this.textHeldItemName.text = string.Empty; } else { this.heldItem = item; this.textHeldItemName.text = ((IItem)item).getItemName(); } }
public void AddItem(IItemBase item) { int index = this.IndexOfItem(item.ProductId); if (index == -1) { this.Items.Add(item); } else { this.Items[index] = item; } this.CalculateCartTotals(); }
public override void onRightClick(Player player) { base.onRightClick(player); player.health.heal(this.data.healthRestored); this.onConsume(); ItemManager.destroyHeldItem(player); IItemBase item = ItemManager.create <IItemBase>(this.data.leftoverItem); item.setInWorld(false, Vector3.zero, Quaternion.identity); player.inventory.addItem(item); }
protected void dropItem(int index, Vector3 pos) { IItemBase item = this.inventory.getItem(index); if (item != null) { item.setInWorld(true, pos, Quaternion.identity); this.inventory.setItem(index, null); if (this is Player) { ((Player)this).heldItemDisplayer.heldItemLastFrame = null; } } }
public static string GetFolderType(IItemBase itemBase) { if (itemBase.ItemKind != ItemKind.Folder) throw new ArgumentException("Type is wrong.", "itemBase"); if (itemBase is LoadedTreeItem) { var str = ((LoadedTreeItem)itemBase).ItemData; var des = new JavaScriptSerializer(); FolderModel item = des.Deserialize<FolderModel>(str); return item.FolderType; } else if (itemBase is IFolderData) { return ((IFolderData)itemBase).FolderType; } else throw new NotSupportedException("Type is wrong."); }
public OrderItem(IItemBase value) { if (value == null) { throw new System.ArgumentNullException(nameof(value)); } this.Description = value.Description; this.ExPrice = value.ExPrice; this.ExTotal = value.ExTotal; this.Gst = value.Gst; this.GstTotal = value.GstTotal; this.ImageUrl = value.ImageUrl; this.IncPrice = value.IncPrice; this.IncTotal = value.IncTotal; this.ProductId = value.ProductId; this.ProductName = value.ProductName; this.Quantity = value.Quantity; }
private void ModifyEventDetailCell(UITableViewCell cell, IItemBase item) { var eventDetailCell = cell as EventDetailCell; if (eventDetailCell != null) { var @event = item as IEvent; if (@event != null) { SetEventCellAboutText(@event, eventDetailCell); eventDetailCell.SetImagesVisible(@event.Images.Any()); eventDetailCell.SetAttendeesVisible(@event.Attendees.Any()); } } }
/// <summary> /// /// </summary> /// <param name="cell"></param> /// <param name="item"></param> /// <param name="path"></param> private void ModifyCommentCell(UITableViewCell cell, IItemBase item, NSIndexPath path) { var commentCell = cell as CommentCell; if (commentCell != null) { SetCommentCellText(item as IComment, commentCell); // Last cell has different ruler if (path.Section == TableView.IndexPathForLastRow.Section && path.Row == TableView.IndexPathForLastRow.Row) { commentCell.SetRulerFullWidth(true); } else { commentCell.SetRulerFullWidth(false); } } }
/// <summary> /// Modify the cell when it is a post /// </summary> /// <param name="item"></param> /// <param name="cell"></param> private void ModifyPostCell(IItemBase item, UITableViewCell cell) { var post = item as IFeedPost; if (post != null) { SetFeedPostCellText(post, cell); var postCell = cell as FeedPostCell; if (postCell != null) { postCell.SetBottomSpacing(false); postCell.SetCommentingEnabled(false); if (post.NumberOfImages == 1) { postCell.SetMainImageVisible(); } else if (post.NumberOfImages == 2) { postCell.SetSubImagesVisible(); } else if (post.NumberOfImages > 2) { postCell.SetAllImagesVisible(); } else { postCell.SetNoImagesVisible(); } postCell.SetInformationVisible(post.Title != null); } } }
public static IMailboxData GetMailboxData(IItemBase itemBase) { if (itemBase.ItemKind != ItemKind.Mailbox) throw new ArgumentException("Type is wrong.", "itemBase"); if (itemBase is LoadedTreeItem) { var str = ((LoadedTreeItem)itemBase).ItemData; var des = new JavaScriptSerializer(); MailClass item = des.Deserialize<MailClass>(str); return item; } else if (itemBase is IMailboxData) { return itemBase as IMailboxData; } else throw new NotSupportedException("Type is wrong."); }
public static string GetItemSuffix(IItemBase itemBase, ExportType exportType) { if (exportType == ExportType.Msg) return ".msg"; return GetItemSuffix(GetItemClass(itemBase)); }
public static ItemClass GetItemClass(IItemBase itemBase) { return GetItemClass(GetItemClassStr(itemBase)); }
public void ChangeTargetItem(IItemBase newTargetItem) { var relationship = Context.Relationships.GetRelation(Id); _relationship.TargetEntityId = relationship.TargetEntityId = newTargetItem.ItemId; Context.Relationships.UpdateRelation(relationship); }
/// <summary> /// Renders an ItemStack on the screen. Used by containers. /// </summary> public static void renderItemMesh(IItemBase item, Vector3 position, Quaternion rotation, Vector3 scale, Camera camera = null) { RenderHelper.renderItemMesh(item.getData(), position, rotation, scale, camera); }
public bool IsAncestorOf(IItemBase item) { return(Context.PathBuilder.IsAncestorPath(_info.Path, item.Path)); }
public bool IsDescendantOf(IItemBase item) { return(_context.PathBuilder.IsDescendantPath(_info.Path, item.Path)); }
/// <summary> /// Destroys the passed Item. /// </summary> public static void destroy(IItemBase item) { GameObject.Destroy(item.getTransform().gameObject); }
public void ChangeSourceItem(IItemBase newSourceItem) { var relationship = Context.Relationships.GetRelation(Id); _relationship.SourceEntityId = relationship.SourceEntityId = newSourceItem.ItemId; Context.Relationships.UpdateRelation(relationship); }