Ejemplo n.º 1
0
 public static void AddInstalledSoul(GoodsLightWeaponSoul soul)
 {
     if (!ItemManager.Instance.InstalledLightWeaponSoul.ContainsKey(soul.Pos_Type))
     {
         ItemManager.Instance.InstalledLightWeaponSoul[soul.Pos_Type] = new Dictionary <uint, GoodsLightWeaponSoul>();
     }
     soul.IsWearing = true;
     ItemManager.Instance.InstalledLightWeaponSoul[soul.Pos_Type][soul.Pos_Index] = soul;
 }
Ejemplo n.º 2
0
 public static int SortFunc(GoodsLightWeaponSoul a, GoodsLightWeaponSoul b)
 {
     if (a.Pos_Type == b.Pos_Type)
     {
         if (a.Pos_Index == b.Pos_Index)
         {
             if (a.Score == b.Score)
             {
                 if (a.color_type == b.color_type)
                 {
                     if (a.sort_id == b.sort_id)
                     {
                         return((int)(b.id - a.id));
                     }
                     return((int)b.sort_id - (int)a.sort_id);
                 }
                 else
                 {
                     return((int)b.color_type - (int)a.color_type);
                 }
             }
             else
             {
                 return((int)b.Score - (int)a.Score);
             }
         }
         else
         {
             return((int)a.Pos_Index - (int)b.Pos_Index);
         }
     }
     else
     {
         return((int)a.Pos_Type - (int)b.Pos_Type);
     }
 }
Ejemplo n.º 3
0
        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);
        }