private Purchase DrawOnePurchase(Rect position, Purchase purchase, int index) { if (purchase == null) { return(null); } float xOffset = position.x; DrawType(new Rect(xOffset, position.y, position.width * PurchaseTypeWidth - 1, position.height), purchase, index); xOffset += position.width * PurchaseTypeWidth; if (purchase.Type == PurchaseType.PurchaseWithMarket) { DrawMarketID(new Rect(xOffset, position.y, position.width * PurchaseAssociatedWidth - 1, position.height), purchase); } else { ItemPopupDrawer drawer = index < _purchasePopupDrawers.Count ? _purchasePopupDrawers[index] : null; if (drawer != null) { purchase.VirtualCurrencyID = drawer.Draw(new Rect(xOffset, position.y, position.width * PurchaseAssociatedWidth - 1, position.height), purchase.VirtualCurrencyID, GUIContent.none); } } xOffset += position.width * PurchaseAssociatedWidth; DrawPrice(new Rect(xOffset, position.y, position.width * PurchasePriceWidth - 1, position.height), purchase); return(purchase); }
private void UpdateItemPopupDrawer(GateType gateType) { switch (gateType) { case GateType.ScoreGate: _itemPopupDrawer = new ItemPopupDrawer(ItemType.Score, false, null); _itemPopupLabel = "Score"; break; case GateType.VirtualItemGate: _itemPopupDrawer = new ItemPopupDrawer(ItemType.VirtualItem, false, VirtualItemType.VirtualCurrency | VirtualItemType.SingleUseItem); _itemPopupLabel = "Virtual Item"; break; case GateType.WorldCompletionGate: _itemPopupDrawer = new ItemPopupDrawer(ItemType.World, false, null); _itemPopupLabel = "World"; break; case GateType.PurchasableGate: _itemPopupDrawer = new ItemPopupDrawer(ItemType.VirtualItem, false, VirtualItemType.LifeTimeItem); _itemPopupLabel = "Purchasable Item"; break; default: _itemPopupDrawer = null; break; } UpdateSubGatesPopupDrawers(); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { if (_itemPopupDrawer == null) { ScorePopupAttribute popupAttribute = (ScorePopupAttribute)attribute; _itemPopupDrawer = new ItemPopupDrawer(ItemType.Score, popupAttribute.AllowNone, null); } property.stringValue = _itemPopupDrawer.Draw(position, property.stringValue, label); }
private void DrawVirtualItem(Rect position, PackElement packElement, int index) { ItemPopupDrawer drawer = index < _itemPopupDrawers.Count ? _itemPopupDrawers[index] : null; if (drawer != null) { packElement.ItemID = drawer.Draw(new Rect(position.x, position.y, position.width * 0.5f - 1, position.height), packElement.ItemID, GUIContent.none); } }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { if (_itemPopupDrawer == null) { VirtualItemPopupAttritube popupAttribute = (VirtualItemPopupAttritube)attribute; _itemPopupDrawer = new ItemPopupDrawer(ItemType.VirtualItem, popupAttribute.AllowNone, popupAttribute.TypeInclude); } property.stringValue = _itemPopupDrawer.Draw(position, property.stringValue, label); }