Beispiel #1
0
        /// <summary>
        /// goods之间赋值要采用此方法
        /// </summary>
        public Goods Copy(Goods _goods)
        {
            //GoodsItem goods = new GoodsItem(_goods.type_idx);
            // 类型id
            id                    = _goods.id;
            bind                  = _goods.bind;
            type_idx              = _goods.type_idx;
            color_type            = _goods.color_type;
            icon_id               = _goods.icon_id;
            name                  = _goods.name;
            raw_name              = _goods.raw_name;
            num                   = _goods.num;
            description           = _goods.description;
            sub_type              = _goods.sub_type;
            drop_effect           = _goods.drop_effect;
            effect                = _goods.effect;
            can_use               = _goods.can_use;
            tips_show             = _goods.tips_show;
            cd                    = _goods.cd;
            start_cd              = _goods.start_cd;
            client_use            = _goods.client_use;
            main_type             = _goods.main_type;
            expire_time           = _goods.expire_time;
            create_time           = _goods.create_time;
            is_display_goods      = _goods.is_display_goods;
            show_step             = _goods.show_step;
            need_count            = _goods.need_count;
            recycle_price         = _goods.recycle_price;
            arg                   = _goods.arg;
            m_group_info          = _goods.m_group_info;
            use_lv                = _goods.use_lv;
            gain_text             = _goods.gain_text;
            src_description       = _goods.src_description;
            m_level_in_add_lv_exp = _goods.m_level_in_add_lv_exp;
            is_precious           = _goods.is_precious;
            discount              = _goods.discount;
            overdue_notice_time   = _goods.overdue_notice_time;

            return(this);
        }
Beispiel #2
0
        /// <summary>
        /// 根据TypeId返回默认Goods
        /// </summary>
        public virtual Goods SetIdFindData(uint _id)
        {
            this.type_idx = _id;

            var goods_info = GoodsHelper.GetGoodsInfo(_id);

            if (goods_info != null)
            {
                this.sub_type = goods_info.sub_type;
                this.effect   = goods_info.effect;
                this.mRawName = goods_info.name;
                this.name     = string.Format("{0}{1}</color>", GoodsHelper.GetGoodsColor(goods_info.color_type), goods_info.name);
                bool is_special_desc = false;
                if (goods_info.effect == "reward_group")//经验和金币类的礼包类的描述需要额外显示
                {
                    List <uint> reward_group_id_array = DBTextResource.ParseArrayUint(goods_info.arg);
                    if (reward_group_id_array != null)
                    {
                        DBRewardGroup db_reward_group = DBManager.Instance.GetDB <DBRewardGroup>();
                        for (int index = 0; index < reward_group_id_array.Count; ++index)
                        {
                            uint reward_group_id = reward_group_id_array[index];
                            DBRewardGroup.DBRewardGroupInfo group_info = db_reward_group.GetOneDBRewardGroupInfo(reward_group_id);
                            if (group_info != null &&
                                (group_info.IsCoinReward || group_info.IsExpReward))
                            {
                                m_group_info    = group_info;
                                is_special_desc = true;
                            }
                        }
                    }
                }
                else if (goods_info.effect == "add_lv_exp")//等级经验丹
                {
                    List <uint> arg_array = DBTextResource.ParseArrayUint(goods_info.arg, ",");
                    if (arg_array != null && arg_array.Count >= 2)
                    {
                        uint level     = arg_array[0]; //直接升级的等级
                        uint reward_id = arg_array[1]; //奖励ID
                        m_level_in_add_lv_exp = level;
                        DBRewardGroup.DBRewardGroupInfo group_info = new DBRewardGroup.DBRewardGroupInfo();
                        group_info.RewardId = reward_id;
                        if (group_info != null &&
                            (group_info.IsCoinReward || group_info.IsExpReward))
                        {
                            m_group_info    = group_info;
                            is_special_desc = true;
                        }
                    }
                }
                string des = goods_info.desc;
                this.src_description = goods_info.desc;
                if (des.CompareTo("") != 0 && is_special_desc == false)
                {
                    if (des[0] == '"')
                    {
                        this.description = des.Substring(1, des.Length - 2);
                    }
                    else
                    {
                        this.description = des;
                    }
                }

                this.arg          = goods_info.arg;
                this.use_lv       = goods_info.use_lv;
                this.use_job      = goods_info.use_job;
                this.use_transfer = goods_info.use_transfer;
                this.gain_text    = goods_info.gain_text;
                this.cd_id        = goods_info.cd_id;
                this.is_mutil_use = goods_info.is_mutil_use == 1 ? true : false;
                this.gain_from    = goods_info.gain_from;
                uint is_quick_int = goods_info.is_quick;
                if (is_quick_int == 0)
                {
                    this.is_quickuse = false;
                }
                else
                {
                    this.is_quickuse = true;
                }

                if (is_quick_int == 2)
                {
                    this.is_quickuse_autoUse = true;
                }
                else
                {
                    this.is_quickuse_autoUse = false;//是否快速使用(有倒计时)
                }
                if (is_quick_int == 3)
                {
                    this.is_quickuse_always = true;
                }
                else
                {
                    this.is_quickuse_always = false;
                }

                this.is_sell_confirmation = goods_info.is_confirmation == 1 ? true : false;
                this.client_use           = goods_info.client_use;
                //暂时没有子类型
                //this.sub_type = DBTextResource.ParseUI(data["sub_type"]);
                this.color_type    = goods_info.color_type;
                this.icon_id       = goods_info.icon_id;
                this.sort_id       = goods_info.sort_id;
                this.sort_top      = goods_info.sort_top;
                this.recycle_price = goods_info.sell_price;

                if (goods_info.is_show == 0)
                {
                    this.tips_show = false;
                }
                else
                {
                    this.tips_show = true;
                }

                this.price_recommend   = goods_info.price_recommend;
                this.price_lower_limit = goods_info.price_lower_limit;
                this.price_upper_limit = goods_info.price_upper_limit;
                this.mktype_1          = goods_info.mktype_1;
                this.mktype_2          = goods_info.mktype_2;
                this.daily_use_limit   = goods_info.daily_use_limit;
                this.guild_wpoint      = goods_info.guild_wpoint;
                this.max_stack         = goods_info.max_stack;
                this.is_display_goods  = goods_info.is_display_goods == 1;
                this.show_step         = goods_info.show_step;
                uint tmpl_is_bind = goods_info.bind;
                if (tmpl_is_bind == 1)
                {
                    mGoodsTmplIsBind = true;
                }
                this.bind                = tmpl_is_bind;
                this.wing_exp            = goods_info.wing_exp;
                this.expire_time_inTmpl  = goods_info.expire_time;
                this.is_precious         = goods_info.is_precious;
                this.discount            = goods_info.discount;
                this.overdue_notice_time = goods_info.overdue_notice_time;
            }
            return(this);
        }