コード例 #1
0
ファイル: Paperdoll.cs プロジェクト: kevinbrill/telarafly
        private void updateGearSlotObject(GearSlot slot)
        {
            //Debug.Log("update gear slot [" + slot + "]", this.gameObject);
            if (state != ClassState.UPDATE)
            {
                Debug.LogError("Cannot update gear slot[" + slot + "] without being update mode");
                return;
            }

            // destroy any existing gear slot
            //Debug.Log("try destroy update gear slot object");
            if (gearSlotObjects.ContainsKey(slot))
            {
                GameObject.Destroy(gearSlotObjects[slot]);
            }

            //Debug.Log("try create update gear slot object if key for slot: " + gearSlotKeys.ContainsKey(slot), this.gameObject);
            if (gearSlotKeys.ContainsKey(slot))
            {
                int          race = WardrobeStuff.raceMap[raceString];
                int          sex  = WardrobeStuff.genderMap[genderString];
                long         key  = gearSlotKeys[slot];
                string       nif  = "";
                ClothingItem item = new ClothingItem(DBInst.inst, key);
                if (item.nifRef != null)
                {
                    nif = item.nifRef.getNif(race, sex);
                }
                else
                {
                    nif = new NIFReference(DBInst.inst, key).getNif(race, sex);
                }

                //Debug.Log("load nif[" + nif + "] for slot:" + slot, this.gameObject);
                gearSlotObjects[slot] = loadNIFForSlot(slot, refModel, costumeParts, Path.GetFileName(nif), "");
            }
        }
コード例 #2
0
        public ClothingItem(DB db, long id, long key)
        {
            this.key = key;
            this.id  = id;
            try
            {
                CObject gearDef = db.toObj(id, key);
                if (id == 7629)
                {
                    this.name = gearDef.getMember(0).convert() + "";
                    if (gearDef.hasMember(1))
                    {
                        this.langKey = gearDef.getMember(1).getIntMember(0);
                    }
                    if (gearDef.hasMember(4))
                    {
                        icon = db.toObj(6009, gearDef.getIntMember(4)).getStringMember(1);
                    }
                    if (gearDef.hasMember(5))
                    {
                        CObject allowedSlotsArray = gearDef.getMember(5);
                        foreach (CObject o in allowedSlotsArray.members)
                        {
                            int slot = int.Parse(o.convert() + "");
                            allowedSlots.Add(WardrobeStuff.getSlot(slot));
                        }
                    }


                    if (gearDef.hasMember(6))
                    {
                        type = WardrobeStuff.getGearType(gearDef.getIntMember(6));
                    }
                    if (gearDef.hasMember(7))
                    {
                        hidden = gearDef.getBoolMember(7, false);
                    }
                    nifKey = gearDef.getIntMember(2);
                    nifRef = new NIFReference(db, nifKey);
                }
                else if (id == 7305)
                {
                    nifRef = new NIFReference(db, key);
                    nifKey = key;


                    if (gearDef.hasMember(2))
                    {
                        string nifPath = gearDef.getMember(2).convert() + "";
                        this.name = System.IO.Path.GetFileName(nifPath);
                        if (nifPath.Contains(@"\player\") && nifPath.Contains(@"\wings\"))
                        {
                            allowedSlots.Add(GearSlot.CAPE);
                        }
                    }

                    if (gearDef.hasMember(15))
                    {
                        CObject allowedSlotsArray = gearDef.getMember(15);
                        foreach (CObject o in allowedSlotsArray.members)
                        {
                            int slot = int.Parse(o.convert() + "");
                            allowedSlots.Add(WardrobeStuff.getSlot(slot));
                        }
                    }
                    else
                    {
                    }
                }
                else
                {
                    throw new Exception("Bad id:" + id);
                }
            }
            catch (Exception ex)
            {
                Debug.Log("Unable to process [" + this + "] nif reference:" + ex);
            }
        }