コード例 #1
0
 private void CreateBookItem(SysCouponVo couponVo)
 {
     if (this.IsIllegalArgument(couponVo))
     {
         return;
     }
     this.SetQualityFrame(couponVo.quality);
     if (couponVo.mother_type == 1)
     {
         SysHeroMainVo dataById = BaseDataMgr.instance.GetDataById <SysHeroMainVo>(couponVo.mother_id);
         if (this.IsIllegalArgument(dataById))
         {
             return;
         }
         this.SetTexture(dataById.avatar_icon, 140);
     }
     else if (couponVo.mother_type == 2)
     {
         SysHeroSkinVo dataById2 = BaseDataMgr.instance.GetDataById <SysHeroSkinVo>(couponVo.mother_id);
         if (this.IsIllegalArgument(dataById2))
         {
             return;
         }
         this.SetTexture(dataById2.avatar_icon, 140);
     }
     this.CouponIcon.spriteName = "Magic_bottle_tujian_discount_" + couponVo.off_number;
 }
コード例 #2
0
ファイル: Reward_coupon.cs プロジェクト: whztt07/mobahero_src
 public override void Init(string[] param)
 {
     base.Init(param);
     if (base.Valid)
     {
         base.Num = 1;
         SysCouponVo dataById = BaseDataMgr.instance.GetDataById <SysCouponVo>(param[2]);
         if (dataById != null)
         {
             if (dataById.mother_type == 1)
             {
                 SysHeroMainVo dataById2 = BaseDataMgr.instance.GetDataById <SysHeroMainVo>(dataById.mother_id);
                 if (dataById2 != null)
                 {
                     base.SIcon = dataById2.avatar_icon;
                     base.BIcon = dataById2.Loading_icon;
                 }
             }
             else if (dataById.mother_type == 2)
             {
                 SysHeroSkinVo dataById3 = BaseDataMgr.instance.GetDataById <SysHeroSkinVo>(dataById.mother_id);
                 if (dataById3 != null)
                 {
                     base.SIcon = dataById3.avatar_icon;
                     base.BIcon = dataById3.Loading_icon;
                 }
             }
             base.ExtraData = dataById;
             base.TypeDes   = LanguageManager.Instance.GetStringById("Currency_Coupon");
             base.Quality   = dataById.quality;
             base.Valid     = true;
         }
     }
 }
コード例 #3
0
 private void RefreshUI_disCount()
 {
     if (base.Info.Discount)
     {
         SysCouponVo sysCouponVo = base.Info.ExtraData as SysCouponVo;
         if (sysCouponVo != null)
         {
             this.go_discount3.SetActive(3 == sysCouponVo.off_number);
             this.go_discount7.SetActive(7 == sysCouponVo.off_number);
         }
     }
     else
     {
         this.go_discount3.SetActive(false);
         this.go_discount7.SetActive(false);
     }
 }
コード例 #4
0
ファイル: Reward_hero.cs プロジェクト: whztt07/mobahero_src
 public override void Init(string[] param)
 {
     base.Init(param);
     if (base.Valid)
     {
         base.Num = 1;
         SysHeroMainVo sysHeroMainVo = null;
         if (base.Discount)
         {
             SysCouponVo dataById = BaseDataMgr.instance.GetDataById <SysCouponVo>(param[2]);
             base.ExtraData = dataById;
             sysHeroMainVo  = BaseDataMgr.instance.GetHeroMainData(dataById.mother_id);
         }
         else
         {
             int heroId = 0;
             if (int.TryParse(param[2], out heroId))
             {
                 Dictionary <string, SysHeroMainVo> typeDicByType = BaseDataMgr.instance.GetTypeDicByType <SysHeroMainVo>();
                 sysHeroMainVo = typeDicByType.Values.FirstOrDefault((SysHeroMainVo obj) => obj.hero_id == heroId);
             }
         }
         if (sysHeroMainVo != null)
         {
             base.SIcon = sysHeroMainVo.avatar_icon;
             base.BIcon = sysHeroMainVo.Loading_icon;
             if (base.Discount)
             {
                 base.TypeDes = LanguageManager.Instance.GetStringById("Currency_Coupon");
             }
             else
             {
                 base.TypeDes = LanguageManager.Instance.GetStringById("Currency_Hero");
                 base.Des     = LanguageManager.Instance.GetStringById(sysHeroMainVo.name);
             }
             base.Quality = sysHeroMainVo.quality;
             base.Valid   = true;
         }
     }
 }
コード例 #5
0
ファイル: Reward_skin.cs プロジェクト: whztt07/mobahero_src
 public override void Init(string[] param)
 {
     base.Init(param);
     if (base.Valid)
     {
         base.Num = 1;
         string unikey = string.Empty;
         if (base.Discount)
         {
             SysCouponVo dataById = BaseDataMgr.instance.GetDataById <SysCouponVo>(param[2]);
             base.ExtraData = dataById;
             unikey         = dataById.mother_id;
         }
         else
         {
             unikey = param[2];
         }
         SysHeroSkinVo dataById2 = BaseDataMgr.instance.GetDataById <SysHeroSkinVo>(unikey);
         if (dataById2 != null)
         {
             base.SIcon = dataById2.avatar_icon;
             base.BIcon = dataById2.Loading_icon;
             if (base.Discount)
             {
                 base.TypeDes   = LanguageManager.Instance.GetStringById("Currency_Coupon");
                 base.ExtraData = BaseDataMgr.instance.GetDataById <SysCouponVo>(param[2]);
             }
             else
             {
                 base.TypeDes = LanguageManager.Instance.GetStringById("Currency_Skin");
                 base.Des     = LanguageManager.Instance.GetStringById(dataById2.name);
             }
             base.Quality = dataById2.quality;
             base.Valid   = true;
         }
     }
 }
コード例 #6
0
        public static Dictionary <byte, float[]> Get_ShopGoodsPrice(this ModelManager mmng, GoodsData _data, Callback _repeatCall = null, Callback <float> _discountCall = null, Callback <byte, int, DiscountCardData> _couponCall = null)
        {
            if (_data == null)
            {
                return(null);
            }
            Dictionary <byte, float[]> dictionary = new Dictionary <byte, float[]>();

            if (_data.IsSingle > 0)
            {
                if (_data.Type == 1)
                {
                    if (_repeatCall != null && CharacterDataMgr.instance.OwenHeros.Contains(_data.ElementId))
                    {
                        _repeatCall();
                    }
                }
                else if (_data.Type == 2)
                {
                    if (_repeatCall != null && ModelManager.Instance.IsPossessSkin(Convert.ToInt32(_data.ElementId)))
                    {
                        _repeatCall();
                    }
                }
                else if (_data.Type == 5)
                {
                    if (_repeatCall != null && ModelManager.Instance.IsRepeatAvatar("3", _data.ElementId))
                    {
                        _repeatCall();
                    }
                }
                else if (_data.Type == 6 && _repeatCall != null && ModelManager.Instance.IsRepeatAvatar("4", _data.ElementId))
                {
                    _repeatCall();
                }
            }
            string[] array = _data.Price.Split(new char[]
            {
                ','
            });
            float num = 1f;

            string[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                string   text   = array2[i];
                string[] array3 = text.Split(new char[]
                {
                    '|'
                });
                if (array3 != null && array3.Length == 3)
                {
                    float[] array4 = new float[2];
                    array4[0] = float.Parse(array3[1]);
                    float num2 = float.Parse(array3[2]);
                    array4[1] = (float)Mathf.CeilToInt(num2 * array4[0]);
                    byte b = byte.Parse(array3[0]);
                    dictionary.Add(b, array4);
                    if (num2 < 1f)
                    {
                        dictionary.Add(b + 10, null);
                    }
                    if (num2 < num || b == 2)
                    {
                        num = num2;
                    }
                }
            }
            dictionary.Add(100, new float[]
            {
                (float)array.Length
            });
            if (_discountCall != null && num < 1f)
            {
                _discountCall(num);
            }
            if (_data.Type == 1 || _data.Type == 2)
            {
                List <DiscountCardData> list = ModelManager.Instance.Get_GivenItemCouponList(_data.ElementId);
                if (list == null || list.Count == 0)
                {
                    return(dictionary);
                }
                Dictionary <string, object> dicByType        = BaseDataMgr.instance.GetDicByType <SysCouponVo>();
                DiscountCardData            discountCardData = list[0];
                SysCouponVo sysCouponVo = (SysCouponVo)dicByType[discountCardData.modelid.ToString()];
                for (int j = 1; j < list.Count; j++)
                {
                    SysCouponVo sysCouponVo2 = (SysCouponVo)dicByType[list[j].modelid.ToString()];
                    if (sysCouponVo2.other_coupon_convert.ToString().Length < sysCouponVo.other_coupon_convert.ToString().Length)
                    {
                        discountCardData = list[j];
                        sysCouponVo      = sysCouponVo2;
                    }
                }
                if (dictionary.ContainsKey((byte)sysCouponVo.currency_type))
                {
                    dictionary[(byte)sysCouponVo.currency_type][1] = (float)Mathf.CeilToInt(dictionary[(byte)sysCouponVo.currency_type][1] * (float)sysCouponVo.off_number * 0.1f);
                    if (_couponCall != null)
                    {
                        _couponCall((byte)sysCouponVo.currency_type, sysCouponVo.off_number, discountCardData);
                    }
                    dictionary.Add((byte)(sysCouponVo.currency_type + 20), null);
                }
            }
            return(dictionary);
        }
コード例 #7
0
ファイル: RewardTools.cs プロジェクト: whztt07/mobahero_src
        private static RewardItemBase GetRewardItem(string typeStr)
        {
            RewardItemBase rewardItemBase = null;

            if (string.IsNullOrEmpty(typeStr))
            {
                return(rewardItemBase);
            }
            string[] array = typeStr.Split(new char[]
            {
                '|'
            });
            if (array.Length != 3)
            {
                ClientLogger.Error("配置错误");
                return(rewardItemBase);
            }
            int num = 0;

            if (!int.TryParse(array[0], out num))
            {
                return(rewardItemBase);
            }
            int num2 = 0;

            if (!int.TryParse(array[1], out num2))
            {
                return(rewardItemBase);
            }
            switch (num)
            {
            case 1:
                rewardItemBase = new Reward_currency();
                break;

            case 2:
            {
                SysGameItemsVo dataById = BaseDataMgr.instance.GetDataById <SysGameItemsVo>(array[1]);
                if (dataById != null)
                {
                    if (dataById.type == 4)
                    {
                        rewardItemBase = new Reward_runes();
                    }
                    else if (dataById.type == 10 && dataById.hero_decorate_type >= 1 && dataById.hero_decorate_type <= 7)
                    {
                        rewardItemBase = new Reward_effect();
                    }
                    else
                    {
                        rewardItemBase = new Reward_item();
                    }
                }
                break;
            }

            case 3:
                switch (num2)
                {
                case 1:
                    rewardItemBase = new Reward_hero(false);
                    break;

                case 2:
                    rewardItemBase = new Reward_skin(false);
                    break;

                case 3:
                    rewardItemBase = new Reward_summonerHeadPortrait();
                    break;

                case 4:
                    rewardItemBase = new Reward_summonerFrame();
                    break;

                case 5:
                {
                    SysCouponVo dataById2 = BaseDataMgr.instance.GetDataById <SysCouponVo>(array[2]);
                    if (dataById2 != null)
                    {
                        if (dataById2.mother_type == 1)
                        {
                            rewardItemBase = new Reward_hero(true);
                        }
                        else if (dataById2.mother_type == 2)
                        {
                            rewardItemBase = new Reward_skin(true);
                        }
                    }
                    break;
                }
                }
                break;

            case 4:
            {
                int num3 = num2;
                if (num3 != 1)
                {
                    if (num3 == 2)
                    {
                        rewardItemBase = new Reward_bottleExp();
                    }
                }
                else
                {
                    rewardItemBase = new Reward_summonerExp();
                }
                break;
            }

            case 6:
                rewardItemBase = new Reward_gameBuff();
                break;
            }
            if (rewardItemBase == null)
            {
                ClientLogger.Error(string.Concat(new string[]
                {
                    "配置错误,找不到对应奖励类型:param=",
                    array[0],
                    ",",
                    array[1],
                    ",",
                    array[2]
                }));
            }
            else
            {
                rewardItemBase.Init(array);
            }
            return(rewardItemBase);
        }