bool PickableObjectPickToInv () { Debug.Log("Pick up detected!"); if (storage == null) return false; if(storage != null){ for(int i=0; i<=storage.maxItemCount; i++){ if( null==storage.GetItem(i) ){ Debug.Log("Item put in "+i+" slot"); List<InvBaseItem> list = InvDatabase.list[0].items; if (list.Count == 0) return false; int qualityLevels = (int)quality; int index = Random.Range(0, list.Count); InvBaseItem item = list[inventoryItem.baseItemID]; InvGameItem gi = new InvGameItem(index, item); gi.quality = inventoryItem.quality; gi.itemLevel = inventoryItem.itemLevel; storage.Replace(i, gi); PickableObjectDestory(); return true; } } } Debug.Log("Package full or INVALID package!"); return false; }
private void Start() { if ((this.itemIDs != null) && (this.itemIDs.Length > 0)) { InvEquipment component = base.GetComponent<InvEquipment>(); if (component == null) { component = base.gameObject.AddComponent<InvEquipment>(); } int max = 12; int index = 0; int length = this.itemIDs.Length; while (index < length) { int num4 = this.itemIDs[index]; InvBaseItem bi = InvDatabase.FindByID(num4); if (bi != null) { InvGameItem item = new InvGameItem(num4, bi); item.quality = (InvGameItem.Quality) UnityEngine.Random.Range(0, max); item.itemLevel = NGUITools.RandomRange(bi.minItemLevel, bi.maxItemLevel); component.Equip(item); } else { Debug.LogWarning("Can't resolve the item ID of " + num4); } index++; } } UnityEngine.Object.Destroy(this); }
void Start () { if (itemIDs != null && itemIDs.Length > 0) { InvEquipment eq = GetComponent<InvEquipment>(); if (eq == null) eq = gameObject.AddComponent<InvEquipment>(); int qualityLevels = (int)InvGameItem.Quality._LastDoNotUse; for (int i = 0, imax = itemIDs.Length; i < imax; ++i) { int index = itemIDs[i]; InvBaseItem item = InvDatabase.FindByID(index); if (item != null) { InvGameItem gi = new InvGameItem(index, item); gi.quality = (InvGameItem.Quality)Random.Range(0, qualityLevels); gi.itemLevel = NGUITools.RandomRange(item.minItemLevel, item.maxItemLevel); eq.Equip(gi); } else { Debug.LogWarning("Can't resolve the item ID of " + index); } } } Destroy(this); }
void Start() { if (itemIDs != null && itemIDs.Length > 0) { int qualityLevels = (int)InvGameItem.Quality._LastDoNotUse; for (int i = 0, imax = itemIDs.Length; i < imax; ++i) { int index = itemIDs[i]; InvBaseItem item = InvDatabase.FindByID(index); if (item != null) { InvGameItem gi = new InvGameItem(index, item); gi.quality = (InvGameItem.Quality)Random.Range(0, qualityLevels); gi.itemLevel = NGUITools.RandomRange(item.minItemLevel, item.maxItemLevel); satchel.PlaceItemInNextAvailableSlot(gi); } else { Debug.LogWarning("Can't resolve the item ID of " + index); } } } Destroy(this); }
/// <summary> /// Start dragging the item. /// </summary> void OnDrag(Vector2 delta) { if (mDraggedItem == null && mItem != null) { mDraggedItem = Replace(null); NGUITools.PlaySound(grabSound); UpdateCursor(); } }
/// <summary> /// Start dragging the item. /// </summary> void OnDrag(Vector2 delta) { if (mDraggedItem == null && mItem != null) { UICamera.currentTouch.clickNotification = UICamera.ClickNotification.BasedOnDelta; mDraggedItem = Replace(null); NGUITools.PlaySound(grabSound); UpdateCursor(); } }
/// <summary> /// Equip the specified item and return the item that was replaced. /// </summary> public InvGameItem Equip (InvGameItem item) { if (item != null) { InvBaseItem baseItem = item.baseItem; if (baseItem != null) return Replace(baseItem.slot, item); else Debug.LogWarning("Can't resolve the item ID of " + item.baseItemID); } return item; }
/// <summary> /// Replace an item in the container with the specified one. /// </summary> /// <returns>An item that was replaced.</returns> public InvGameItem Replace (int slot, InvGameItem item) { if (slot < maxItemCount) { InvGameItem prev = items[slot]; mItems[slot] = item; return prev; } return item; }
public InvGameItem Replace(int slot, InvGameItem item) { if (slot < this.maxItemCount) { InvGameItem item2 = this.items[slot]; this.mItems[slot] = item; return item2; } return item; }
protected override InvGameItem ReplaceExisting(InvGameItem item) { string msg = "replacing if not null. equipment is: "; if (equipment == null) msg += "null!"; else msg += equipment.name; Debug.Log(msg); return (equipment != null) ? equipment.Replace(slot, item) : item; }
private void OnDrag(Vector2 delta) { if ((mDraggedItem == null) && (this.mItem != null)) { UICamera.currentTouch.clickNotification = UICamera.ClickNotification.BasedOnDelta; mDraggedItem = this.Replace(null); NGUITools.PlaySound(this.grabSound); this.UpdateCursor(); } }
/// <summary> /// Whether the specified item is currently equipped. /// </summary> public bool HasEquipped(InvGameItem item) { if (mItems != null) { for (int i = 0, imax = mItems.Length; i < imax; ++i) { if (mItems[i] == item) return true; } } return false; }
/// <summary> /// Whether the specified item is currently equipped. /// </summary> public bool HasEquipped(InvGameItem item) { if (mItems != null) { foreach (InvGameItem i in mItems) { if (i == item) return true; } } return false; }
/// <summary> /// Equip the specified item and return the item that was replaced. /// </summary> public InvGameItem Equip(InvGameItem item) { if (item != null) { InvBaseItem baseItem = item.baseItem; if (baseItem != null) return Replace(baseItem.slot, item); else Debug.Log("Can't resolve the item ID of " + item.baseItemID); } else Debug.Log("cannot find null item..."); return item; }
/// <summary> /// Allow to move objects around via drag & drop. /// </summary> void OnClick() { if (mDraggedItem != null) { OnDrop(null); } else if (mItem != null) { mDraggedItem = Replace(null); if (mDraggedItem != null) NGUITools.PlaySound(grabSound); UpdateCursor(); } }
void OnClick() { if (equipment == null) return; List<InvBaseItem> list = InvDatabase.list[0].items; if (list.Count == 0) return; int qualityLevels = (int)InvGameItem.Quality._LastDoNotUse; int index = Random.Range(0, list.Count); InvBaseItem item = list[index]; InvGameItem gi = new InvGameItem(index, item); gi.quality = (InvGameItem.Quality)Random.Range(0, qualityLevels); gi.itemLevel = NGUITools.RandomRange(item.minItemLevel, item.maxItemLevel); equipment.Equip(gi); }
/// <summary> /// Equip the specified item automatically replacing an existing one. /// </summary> public InvGameItem Replace (InvBaseItem.Slot slot, InvGameItem item) { InvBaseItem baseItem = (item != null) ? item.baseItem : null; if (slot != InvBaseItem.Slot.None) { // If the item is not of appropriate type, we shouldn't do anything if (baseItem != null && baseItem.slot != slot) return item; if (mItems == null) { // Automatically figure out how many item slots we need int count = (int)InvBaseItem.Slot._LastDoNotUse; mItems = new InvGameItem[count]; } // Equip this item InvGameItem prev = mItems[(int)slot - 1]; mItems[(int)slot - 1] = item; // Get the list of all attachment points if (mAttachments == null) mAttachments = GetComponentsInChildren<InvAttachmentPoint>(); // Equip the item visually for (int i = 0, imax = mAttachments.Length; i < imax; ++i) { InvAttachmentPoint ip = mAttachments[i]; if (ip.slot == slot) { GameObject go = ip.Attach(baseItem != null ? baseItem.attachment : null); if (baseItem != null && go != null) { //Renderer ren = go.renderer; Renderer ren = go.GetComponent<Renderer>(); if (ren != null) ren.material.color = baseItem.color; } } } return prev; } else if (item != null) { Debug.LogWarning("Can't equip \"" + item.name + "\" because it doesn't specify an item slot"); } return item; }
private void OnClick() { if (mDraggedItem != null) { this.OnDrop(null); } else if (this.mItem != null) { mDraggedItem = this.Replace(null); if (mDraggedItem != null) { NGUITools.PlaySound(this.grabSound); } this.UpdateCursor(); } }
public InvGameItem Replace(InvBaseItem.Slot slot, InvGameItem item) { InvBaseItem item2 = (item == null) ? null : item.baseItem; if (slot != InvBaseItem.Slot.None) { if ((item2 != null) && (item2.slot != slot)) { return item; } if (this.mItems == null) { int num = 8; this.mItems = new InvGameItem[num]; } InvGameItem item3 = this.mItems[((int) slot) - 1]; this.mItems[((int) slot) - 1] = item; if (this.mAttachments == null) { this.mAttachments = base.GetComponentsInChildren<InvAttachmentPoint>(); } int index = 0; int length = this.mAttachments.Length; while (index < length) { InvAttachmentPoint point = this.mAttachments[index]; if (point.slot == slot) { GameObject obj2 = point.Attach((item2 == null) ? null : item2.attachment); if ((item2 != null) && (obj2 != null)) { Renderer renderer = obj2.renderer; if (renderer != null) { renderer.material.color = item2.color; } } } index++; } return item3; } if (item != null) { Debug.LogWarning("Can't equip \"" + item.name + "\" because it doesn't specify an item slot"); } return item; }
public bool HasEquipped(InvGameItem item) { if (this.mItems != null) { int index = 0; int length = this.mItems.Length; while (index < length) { if (this.mItems[index] == item) { return true; } index++; } } return false; }
public bool HasEquipped(InvGameItem item) { if (this.mItems != null) { int i = 0; int num = this.mItems.Length; while (i < num) { if (this.mItems[i] == item) { return true; } i++; } } return false; }
private void OnClick() { if (this.equipment != null) { List<InvBaseItem> items = InvDatabase.list[0].items; if (items.Count != 0) { int max = 12; int id = UnityEngine.Random.Range(0, items.Count); InvBaseItem bi = items[id]; InvGameItem item = new InvGameItem(id, bi); item.quality = (InvGameItem.Quality) UnityEngine.Random.Range(0, max); item.itemLevel = NGUITools.RandomRange(bi.minItemLevel, bi.maxItemLevel); this.equipment.Equip(item); } } }
/// <summary> /// Allow to move objects around via drag & drop. /// </summary> void OnClick() { Debug.Log("OnClick"); if (mDraggedItem != null) { OnDrop(null); } else if (mItem != null) { mDraggedItem = Replace(null); if (mDraggedItem != null) { NGUITools.PlaySound(grabSound); Debug.Log("dragged item: "+mDraggedItem.name); } UpdateCursor(); } }
private void OnDrop(GameObject go) { InvGameItem item = this.Replace(mDraggedItem); if (mDraggedItem == item) { NGUITools.PlaySound(this.errorSound); } else if (item != null) { NGUITools.PlaySound(this.grabSound); } else { NGUITools.PlaySound(this.placeSound); } mDraggedItem = item; this.UpdateCursor(); }
/// <summary> /// Replace the observed item with the specified value. Should return the item that was replaced. /// </summary> override protected InvGameItem Replace (InvGameItem item) { if(equipmentDemo != null && equipmentMain != null){ InvGameItem iItem = null; if(null==item){ equipmentMain.Unequip(slot); iItem = equipmentDemo.Unequip(slot); }else{ equipmentMain.Equip(item); iItem = equipmentDemo.Equip(item); } Debug.Log("equipmentDemo "+equipmentDemo.equippedItems.Length); Debug.Log("equipmentMain "+equipmentMain.equippedItems.Length); return iItem; } Debug.LogWarning("equipmentMain or equipmentDemo not declare!"); return null; }
/// <summary> /// Show a tooltip with the tooltip text for the specified item. /// </summary> public static void ShowItem(InvGameItem item) { if (item != null) { InvBaseItem bi = item.baseItem; if (bi != null) { string t = "[" + NGUITools.EncodeColor(item.color) + "]" + item.name + "[-]\n"; t += "[AFAFAF]Level " + item.itemLevel + " " + bi.slot; List<InvStat> stats = item.CalculateStats(); for (int i = 0, imax = stats.Count; i < imax; ++i) { InvStat stat = stats[i]; if (stat.amount == 0) continue; if (stat.amount < 0) { t += "\n[FF0000]" + stat.amount; } else { t += "\n[00FF00]+" + stat.amount; } if (stat.modifier == InvStat.Modifier.Percent) t += "%"; t += " " + stat.id; t += "[-]"; } if (!string.IsNullOrEmpty(bi.description)) t += "\n[FF9900]" + bi.description; ShowText(t); return; } } if (mInstance != null) mInstance.mTarget = 0f; }
public void AddToInventory(int itemID) { InvEquipment eq = GetComponent<InvEquipment>(); if (eq == null) eq = gameObject.AddComponent<InvEquipment>(); int qualityLevels = (int)InvGameItem.Quality._LastDoNotUse; InvBaseItem item = InvDatabase.FindByID(itemID); Debug.Log("attempting to add: "+item.name); if (item != null) { InvGameItem gi = new InvGameItem(itemID, item); gi.quality = (InvGameItem.Quality)Random.Range(0, qualityLevels); gi.itemLevel = NGUITools.RandomRange(item.minItemLevel, item.maxItemLevel); if (storageScript.PlaceItemInNextAvailableSlot(gi)) Debug.Log(item.name + " added to inventory"); else Debug.Log("out of room!"); } else { Debug.Log("Can't resolve the item ID of " + itemID); } }
// Token: 0x060005D4 RID: 1492 RVA: 0x00004762 File Offset: 0x00002962 protected virtual InvGameItem NCIJFNFQDPP(InvGameItem PDIBIIKFBDH) { return((!(this.FLCHLNKGNJF != null)) ? PDIBIIKFBDH : this.FLCHLNKGNJF.ONJPJJEBMQJ(this.COQJPLDFJBB, PDIBIIKFBDH)); }
// Token: 0x060005D9 RID: 1497 RVA: 0x000047D0 File Offset: 0x000029D0 protected virtual InvGameItem MIICBDCEQNH(InvGameItem PDIBIIKFBDH) { return((!(this.FLCHLNKGNJF != null)) ? PDIBIIKFBDH : this.FLCHLNKGNJF.NGDJGOEHLHG(this.COQJPLDFJBB, PDIBIIKFBDH)); }
// Token: 0x060005D6 RID: 1494 RVA: 0x000047AB File Offset: 0x000029AB protected virtual InvGameItem QDMFMMKBBFE(InvGameItem PDIBIIKFBDH) { return((!(this.FLCHLNKGNJF != null)) ? PDIBIIKFBDH : this.FLCHLNKGNJF.FKEECBBDPFF(this.COQJPLDFJBB, PDIBIIKFBDH)); }
// Token: 0x060005FA RID: 1530 RVA: 0x00004861 File Offset: 0x00002A61 protected virtual InvGameItem OBMDEFHHJIK(InvGameItem PDIBIIKFBDH) { return((!(this.FLCHLNKGNJF != null)) ? PDIBIIKFBDH : this.FLCHLNKGNJF.IOCFJDGOOCK(this.COQJPLDFJBB, PDIBIIKFBDH)); }
// Token: 0x060005DA RID: 1498 RVA: 0x0000473D File Offset: 0x0000293D protected virtual InvGameItem FIBOFCBJONE(InvGameItem PDIBIIKFBDH) { return((!(this.FLCHLNKGNJF != null)) ? PDIBIIKFBDH : this.FLCHLNKGNJF.KKLBBJCFFDJ(this.COQJPLDFJBB, PDIBIIKFBDH)); }
protected override InvGameItem Replace(InvGameItem item) { return((!(this.equipment != null)) ? item : this.equipment.Replace(this.slot, item)); }
// Token: 0x06000579 RID: 1401 RVA: 0x00004347 File Offset: 0x00002547 protected virtual InvGameItem FGIBKGPIMFE(InvGameItem PDIBIIKFBDH) { return((!(this.KEJQDPGPKBM != null)) ? PDIBIIKFBDH : this.KEJQDPGPKBM.JQGGPEGENOO(this.COQJPLDFJBB, PDIBIIKFBDH)); }
// Token: 0x060005D3 RID: 1491 RVA: 0x000046CF File Offset: 0x000028CF protected virtual InvGameItem IOCFJDGOOCK(InvGameItem PDIBIIKFBDH) { return((!(this.FLCHLNKGNJF != null)) ? PDIBIIKFBDH : this.FLCHLNKGNJF.OHBKMDLQJNM(this.COQJPLDFJBB, PDIBIIKFBDH)); }
// Token: 0x060005D0 RID: 1488 RVA: 0x000046AA File Offset: 0x000028AA protected virtual InvGameItem JMPJMQMBQIJ(InvGameItem PDIBIIKFBDH) { return((!(this.FLCHLNKGNJF != null)) ? PDIBIIKFBDH : this.FLCHLNKGNJF.EMPFQKIKODE(this.COQJPLDFJBB, PDIBIIKFBDH)); }
// Token: 0x06000586 RID: 1414 RVA: 0x00004390 File Offset: 0x00002590 protected virtual InvGameItem KDFBHCKIGFC(InvGameItem PDIBIIKFBDH) { return((!(this.KEJQDPGPKBM != null)) ? PDIBIIKFBDH : this.KEJQDPGPKBM.LDGOBEFKNGE(this.COQJPLDFJBB, PDIBIIKFBDH)); }
// Token: 0x060005A0 RID: 1440 RVA: 0x0004E35C File Offset: 0x0004C55C private void IFGPPIQKOPM(bool OHOBDLMNJMC) { InvGameItem invGameItem = (!OHOBDLMNJMC) ? null : this.QEHIHKOHHFJ; if (invGameItem != null) { InvBaseItem baseItem = invGameItem.baseItem; if (baseItem != null) { string text = string.Concat(new string[] { "[", JGDHIPBGCFP.JPHIJCIGHPQ(invGameItem.color), "]", invGameItem.name, "[-]\n" }); string text2 = text; text = string.Concat(new object[] { text2, "[AFAFAF]Level ", invGameItem.itemLevel, " ", baseItem.slot }); List <InvStat> list = invGameItem.QNNCKNCFNMK(); int i = 0; int count = list.Count; while (i < count) { InvStat invStat = list[i]; if (invStat.amount != 0) { if (invStat.amount < 0) { text = text + "\n[FF0000]" + invStat.amount; } else { text = text + "\n[00FF00]+" + invStat.amount; } if (invStat.modifier == InvStat.JPLHHNKQLOI.Percent) { text += "%"; } text = text + " " + invStat.id; text += "[-]"; } i++; } if (!string.IsNullOrEmpty(baseItem.description)) { text = text + "\n[FF9900]" + baseItem.description; } GGGPJQEKNJD.MFONIPHOFGF(text); return; } } GGGPJQEKNJD.Hide(); }
// Token: 0x06000589 RID: 1417 RVA: 0x0000444E File Offset: 0x0000264E protected virtual InvGameItem MKCCKDEEBFH(InvGameItem PDIBIIKFBDH) { return((!(this.KEJQDPGPKBM != null)) ? PDIBIIKFBDH : this.KEJQDPGPKBM.FKEECBBDPFF(this.COQJPLDFJBB, PDIBIIKFBDH)); }
/// <summary> /// Replace the observed item with the specified value. Should return the item that was replaced. /// </summary> override protected InvGameItem Replace(InvGameItem item) { return((equipment != null) ? equipment.Replace(slot, item) : item); }
protected override InvGameItem Replace(InvGameItem item) { return(equipment == null ? item : equipment.Replace(slot, item)); }
// Token: 0x0600057C RID: 1404 RVA: 0x000043B5 File Offset: 0x000025B5 protected virtual InvGameItem HJEFKEHGGKP(InvGameItem PDIBIIKFBDH) { return((!(this.KEJQDPGPKBM != null)) ? PDIBIIKFBDH : this.KEJQDPGPKBM.MLHGDGKOLPI(this.COQJPLDFJBB, PDIBIIKFBDH)); }
/// <summary> /// Keep an eye on the item and update the icon when it changes. /// </summary> void Update () { InvGameItem i = observedItem; if (mItem != i) { mItem = i; InvBaseItem baseItem = (i != null) ? i.baseItem : null; if (label != null) { string itemName = (i != null) ? i.name : null; if (string.IsNullOrEmpty(mText)) mText = label.text; label.text = (itemName != null) ? itemName : mText; } if (icon != null) { if (baseItem == null || baseItem.iconAtlas == null) { icon.enabled = false; } else { icon.atlas = baseItem.iconAtlas; icon.spriteName = baseItem.iconName; icon.enabled = true; icon.MakePixelPerfect(); } } if (background != null) { background.color = (i != null) ? i.color : Color.white; } } }
// Token: 0x0600058C RID: 1420 RVA: 0x0000444E File Offset: 0x0000264E protected override InvGameItem FKEECBBDPFF(InvGameItem PDIBIIKFBDH) { return((!(this.KEJQDPGPKBM != null)) ? PDIBIIKFBDH : this.KEJQDPGPKBM.FKEECBBDPFF(this.COQJPLDFJBB, PDIBIIKFBDH)); }
protected override InvGameItem Replace(InvGameItem item) { return((!(storage != null)) ? item : storage.Replace(slot, item)); }
// Token: 0x060005D1 RID: 1489 RVA: 0x00004718 File Offset: 0x00002918 protected virtual InvGameItem KOPPJLNNGMN(InvGameItem PDIBIIKFBDH) { return((!(this.FLCHLNKGNJF != null)) ? PDIBIIKFBDH : this.FLCHLNKGNJF.FIBOFCBJONE(this.COQJPLDFJBB, PDIBIIKFBDH)); }
// Token: 0x0600059F RID: 1439 protected abstract InvGameItem FKEECBBDPFF(InvGameItem PDIBIIKFBDH);
/// <summary> /// Replace the observed item with the specified value. Should return the item that was replaced. /// </summary> abstract protected InvGameItem Replace(InvGameItem item);
private void OnTooltip(bool show) { InvGameItem invGameItem = (!show) ? null : this.mItem; if (invGameItem != null) { InvBaseItem baseItem = invGameItem.baseItem; if (baseItem != null) { string text = string.Concat(new string[] { "[", NGUIText.EncodeColor(invGameItem.color), "]", invGameItem.name, "[-]\n" }); string text2 = text; text = string.Concat(new object[] { text2, "[AFAFAF]Level ", invGameItem.itemLevel, " ", baseItem.slot }); List <InvStat> list = invGameItem.CalculateStats(); int i = 0; int count = list.Count; while (i < count) { InvStat invStat = list[i]; if (invStat.amount != 0) { if (invStat.amount < 0) { text = text + "\n[FF0000]" + invStat.amount; } else { text = text + "\n[00FF00]+" + invStat.amount; } if (invStat.modifier == InvStat.Modifier.Percent) { text += "%"; } text = text + " " + invStat.id; text += "[-]"; } i++; } if (!string.IsNullOrEmpty(baseItem.description)) { text = text + "\n[FF9900]" + baseItem.description; } UITooltip.Show(text); return; } } UITooltip.Hide(); }
/// <summary> /// Stop dragging the item. /// </summary> void OnDrop (GameObject go) { InvGameItem item = Replace(mDraggedItem); if (mDraggedItem == item) NGUITools.PlaySound(errorSound); else if (item != null) NGUITools.PlaySound(grabSound); else NGUITools.PlaySound(placeSound); mDraggedItem = item; UpdateCursor(); }
/// <summary> /// Replace the observed item with the specified value. Should return the item that was replaced. /// </summary> override protected InvGameItem Replace(InvGameItem item) { return((storage != null) ? storage.Replace(slot, item) : item); }
/// <summary> /// Replace the observed item with the specified value. Should return the item that was replaced. /// </summary> abstract protected InvGameItem Replace (InvGameItem item);
// Token: 0x060005F7 RID: 1527 RVA: 0x000047AB File Offset: 0x000029AB protected override InvGameItem FKEECBBDPFF(InvGameItem PDIBIIKFBDH) { return((!(this.FLCHLNKGNJF != null)) ? PDIBIIKFBDH : this.FLCHLNKGNJF.FKEECBBDPFF(this.COQJPLDFJBB, PDIBIIKFBDH)); }