using System.Collections; using System.Collections.Generic; using UnityEngine; using Newtonsoft.Json.Linq; public class ShenMiaoVo { public ShenMiaoVo(EShenMiaoActiveType type) { this.type = type; //this.id = id; } /// /// 活动类型 /// public EShenMiaoActiveType type { get; set; } /// /// 活动id /// public string id { get { string id = ""; Dictionary aDic = UserProxy.Instance.player.shenmiaoInfo.activeDic; if (aDic.ContainsKey((int)this.type)) { return aDic[(int)this.type].id; } //if (this.type == EShenMiaoActiveType.NewWish || this.type == EShenMiaoActiveType.OpenWish) //{ // int type = (int)EShenMiaoActiveType.NewWish; // id = type.ToString(); //} //else //{ // //根据当前的时间 去找 对应活动 //} return id; } } /// /// 活动名称 /// public string name { get { return sm_shenmiao.GetMoById(this.id).name; } } /// /// 活动描述信息 /// public string desc { get { return sm_shenmiao.GetMoById(this.id).desc; } } /// /// 活动图 /// public string icon { get { return sm_shenmiao.GetMoById(this.id).icon; } } /// /// 消耗道具类型 /// public EItemSubType costType { get { string[] sList = sm_shenmiao.GetMoById(this.id).cost.Split(','); int subType = sm_item_base.GetMoById(int.Parse(sList[0])).subType; return (EItemSubType)subType; } } /// /// 消耗道具id /// public int costId { get { string[] sList = sm_shenmiao.GetMoById(this.id).cost.Split(','); return int.Parse(sList[0]); } } /// /// 是否有折扣 /// public bool isDisCount { get { return sm_shenmiao.GetMoById(this.id).discount != 0?true:false; } } /// /// 1次消耗道具数量 /// public int oneCost { get { string[] sList = sm_shenmiao.GetMoById(this.id).cost.Split(','); return int.Parse(sList[1]); } } /// /// 10次 消耗道具类型 /// public int tenCost { get { string[] sList = sm_shenmiao.GetMoById(this.id).cost.Split(','); int per = sm_shenmiao.GetMoById(this.id).discount; if (per != 0) { float f = 1.0f * per / 100; float n = 10 * f; return (int)n; } return 10; } } /// /// 剩余次数 /// public int num { get { if (this.type == EShenMiaoActiveType.NewWish) { string num = GameConfigData.Ins.globalsettings.UserWishNumLimit.ToString(); Dictionary aDic = UserProxy.Instance.player.shenmiaoInfo.activeDic; if (aDic.ContainsKey((int)this.type)) { int cNum = aDic[(int)this.type].num; int tNum = int.Parse(num) - cNum; if (tNum <= 0) { return 0; } return tNum; } } return 0; } } /// /// 一个券需要的价格 /// public int price { get { string[] sList = sm_shenmiao.GetMoById(this.id).cost.Split(','); int subType = sm_item_base.GetMoById(int.Parse(sList[0])).subType; if (subType == (int)EItemSubType.commonWishCoupons) { return GameConfigData.Ins.GetshopMo("801022").yuanjia; } else { return GameConfigData.Ins.GetshopMo("801023").yuanjia; } return 0; } } public long endTs { get { if (this.type >= EShenMiaoActiveType.HuanlingshiActive) { Dictionary aDic = UserProxy.Instance.player.shenmiaoInfo.activeDic; if (aDic.ContainsKey((int)this.type)) { return sm_shenmiao.GetMoById(aDic[(int)this.type].id).endTs; } } return 0; } } }