public new GoodsMagicEquip Clone() { GoodsMagicEquip magicEquip = new GoodsMagicEquip(type_idx, NetMagicEquip); magicEquip.id = id; magicEquip.MagicId = MagicId; magicEquip.StrengthLv = StrengthLv; magicEquip.TotalExp = TotalExp; magicEquip.CurExp = CurExp; magicEquip.CreateGoodsByTypeId(type_idx); return(magicEquip); }
public static void Update(Net.PkgGoodsInfo info, Goods goods) { if (info == null || goods == null) { return; } if (goods.type_idx != info.gid) {//更换了模型ID goods.type_idx = info.gid; var goods_info = GoodsHelper.GetGoodsInfo(info.gid); if (goods_info != null) { goods.main_type = goods_info.type; if (goods is GoodsItem) { (goods as GoodsItem).SetIdFindData(info.gid); } } } goods.num = info.num; goods.bind = info.bind; goods.expire_time = info.expire_time; goods.create_time = info.create_time; if (info.equip != null) //代表它为装备 { GoodsEquip equip = goods as GoodsEquip; if (equip != null) { equip.UpdateAttr(info.gid, info); equip.UpdateGem(info); } } else if (info.soul != null) { GoodsSoul soul = goods as GoodsSoul; if (soul != null) { soul.UpdateSoul(info.soul); } } else if (info.decorate != null) { GoodsDecorate decorate = goods as GoodsDecorate; if (decorate != null) { decorate.UpdateAttr(info.gid, info); } } else if (info.god_equip != null) { GoodsGodEquip godEquip = goods as GoodsGodEquip; if (godEquip != null) { godEquip.UpdateGodEquip(info.god_equip); } } else if (info.ride_equip != null) { //GoodsMountEquip mountEquip = goods as GoodsMountEquip; //if (mountEquip != null) // mountEquip.UpdateMountEquip(info.ride_equip); } else if (info.magic_equip != null) { GoodsMagicEquip magicEquip = goods as GoodsMagicEquip; if (magicEquip != null) { magicEquip.UpdateMagicEquip(info.magic_equip); } } }
public static Goods Create(uint mainType, uint typeId, Net.PkgGoodsInfo info) { Goods goods = null; switch (mainType) { case GameConst.GIVE_TYPE_EQUIP: { goods = new GoodsEquip(typeId, info); break; } case GameConst.GIVE_TYPE_SOUL: { goods = new GoodsSoul(typeId, info); break; } case GameConst.GIVE_TYPE_DECORATE: { goods = new GoodsDecorate(typeId, info); break; } case GameConst.GIVE_TYPE_GOD_EQUIP: { goods = new GoodsGodEquip(typeId, info); break; } case GameConst.GIVE_TYPE_RIDE_EQUIP: { goods = new GoodsMountEquip(typeId, info); break; } case GameConst.GIVE_TYPE_LIGHT_SOUL: { if (info != null) { goods = new GoodsLightWeaponSoul(info); break; } goods = new GoodsLightWeaponSoul(typeId); break; } case GameConst.GIVE_TYPE_MAGIC_EQUIP: { goods = new GoodsMagicEquip(typeId, info); break; } case GameConst.GIVE_TYPE_ARCHIVE: { if (info != null) { goods = new GoodsItem(info) { bag_type = GameConst.BAG_TYPE_ARCHIVE }; } else { goods = new GoodsItem(typeId) { bag_type = GameConst.BAG_TYPE_ARCHIVE }; } break; } default: { var goods_info = GoodsHelper.GetGoodsInfo(typeId); if (goods_info != null) { string luaScript = GoodsHelper.GetGoodsLuaScriptByGoodsId(typeId); if (!string.IsNullOrEmpty(luaScript)) { if (LuaScriptMgr.Instance == null) { goods = new GoodsItem(typeId); } if (LuaScriptMgr.Instance.IsLuaScriptExist(luaScript)) { goods = new GoodsLuaEx(typeId, luaScript); } else { Debug.LogWarning(string.Format("{0}未找到名字为的组件", luaScript)); goods = null; } } else { if (info != null) { goods = new GoodsItem(info); break; } goods = new GoodsItem(typeId); } } break; } } if (goods == null) {//无法正常创建物品 goods = GetDefaultGoods(typeId); } return(goods); }