public void itemClicked() { if (item != null) { WardrobePreviewPanelUpdater wppu = GameObject.Find("Wardrobe").GetComponent <WardrobePreviewPanelUpdater>(); Toggle toggle = GetComponentInChildren <Toggle>(); GearSlot slot = item.allowedSlots.First(); if (!mainPaperdoll.slotSet(slot)) { mainPaperdoll.setGearSlotKey(slot, item.key); wppu.toggle(this, true); } else { long oldKey = mainPaperdoll.getGearSlot(slot); if (oldKey == item.key) { mainPaperdoll.clearGearSlot(slot); wppu.toggle(this, false); } else { mainPaperdoll.setGearSlotKey(slot, item.key); wppu.toggle(this, true); } } } }
public void setItem(ClothingItem item, Paperdoll mainDoll) { Debug.Log("set item [" + item + "] and copy others from mainDoll", this.gameObject); this.item = item; ourPreview.transform.Clear(); if (previewPaperdoll == null) { previewPaperdoll = ourPreview.AddComponent <Paperdoll>(); } ourPreview.name = "PaperDoll" + previewIndex; //GameObject.Destroy(previewPaperdoll); previewPaperdoll.setGender(mainPaperdoll.getGenderString()); previewPaperdoll.setRace(mainPaperdoll.getRaceString()); // start isn't called until the next "update" so we need to start it manually string nifstr = Path.GetFileName(item.nifRef.getNif(1, 0)); ourPreview.name = item.name; Debug.Log("copy appearence from mainDoll", this.gameObject); previewPaperdoll.copy(mainDoll); previewPaperdoll.setGearSlotKey(item.allowedSlots.First(), item.key); SetLayerRecursively(ourPreview, LayerMask.NameToLayer("Preview" + previewIndex)); }