public InstallerProp(string name, string description, PropType type, object defaultValue)
 {
     localName=name;
     localDescription=description;
     localType= type;
     localDefaultValue= defaultValue;
 }
示例#2
0
文件: Renmas.cs 项目: mario007/renmas
        public List<PropDesc> get_props_descs(PropType prop_type, string group="")
        {
            List<PropDesc> descs = new List<PropDesc>();
            string result = "";
            string args = "";
            switch (prop_type)
            {
                case PropType.Options:
                    args = "options," + group;
                    result = PyUtils.ExectueObjMethod(this.ID, "get_props_descs", args);
                    break;
                case PropType.ToneMapping:
                    args = "tone," + group;
                    result = PyUtils.ExectueObjMethod(this.ID, "get_props_descs", args);
                    break;
                default:
                    result = "";
                    break;
            }

            string[] words = result.Split(',');
            for (int i = 0; i < words.Length; i = i + 2)
            {
                descs.Add(new PropDesc(words[i], words[i + 1]));
            }
            return descs;
        }
示例#3
0
 public Response(bool status, string property, string value, PropType propType, string receiver)
 {
     Status = status;
     Value = value;
     Receiver = receiver;
     Property = property;
     PropType = propType;
 }
示例#4
0
 public Message(string receiver, MessageAction action, string property, string value, PropType propType)
 {
     Action = action;
     Receiver = receiver;
     Property = property;
     PropType = propType;
     Value = value;
 }
 //用于外界添加道具
 public void AddProp(PropType paraType)
 {
     if (m_leftProp.spriteName == "NULL")
     {
         switch (paraType)
         { 
             case PropType.Watermelon:
                 AddPropToUI("Watermelon");
                 break;
             case PropType.SkateBoard:
                 AddPropToUI("SkateBoard");
                 break;
             case PropType.Rope:
                 AddPropToUI("Rope");
                 break;
             case PropType.Skelon:
                 AddPropToUI("Skelon");
                 break;
             case PropType.Protected:
                 AddPropToUI("Protected");
                 break;
         }
     }
 }
示例#6
0
文件: Renmas.cs 项目: mario007/renmas
 private RenmasProperty create_property(PropDesc desc, PropType type)
 {
     if (desc.type == "int")
     {
         return new PyWrapper.IntProperty(this.ID, desc.name, type, "");
     }
     else if (desc.type == "float")
     {
         return new PyWrapper.FloatProperty(this.ID, desc.name, type, "");
     }
     else
     {
         throw new Exception("Unknown property type");
     }
 }
示例#7
0
 // 初始化弹窗类型
 public void InitTipType(PropType pType)
 {
    chooseType = pType;
    TipText.GetComponent<UILabel>().text = ConstantString.LevelBuyTipContent[(int)pType];
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            int? id = _Request.Get<int>("id");

            m_IsEdit = id != null;

            if (m_IsEdit)
            {
                this.m_Prop = PropBO.Instance.GetPropByID(id.Value);

                this.m_PropType = PropBO.GetPropType(this.m_Prop.PropType);
            }
            else
            {
                this.m_Prop = new Prop();

                this.m_PropType = PropBO.GetPropType(_Request.Get("proptype"));
            }

            if (m_PropType == null)
                ShowError("道具类型不存在");

            if (_Request.IsClick("save"))
            {
                MessageDisplay md = CreateMessageDisplay(
                    "icon", "name", "description", 
                    "price", "pricetype", 
                    "packagesize", "totalnumber", "allowexchange", 
                    "autoreplenish", "replenishnumber", "replenishtimespan"
                );

                this.m_Prop.Icon = _Request.Get("icon");

                //默认为猪头卡的图片
                if (string.IsNullOrEmpty(this.m_Prop.Icon))
                {
                   this.m_Prop.Icon="~/max-assets/icon-prop/4.gif";
                }

                this.m_Prop.Name = _Request.Get("name");

                if (string.IsNullOrEmpty(this.m_Prop.Name))
                {
                    md.AddError("name", "道具名称不能为空");
                }

                this.m_Prop.Description = _Request.Get("description");

                if (string.IsNullOrEmpty(this.m_Prop.Description))
                {
                    md.AddError("description", "道具描述不能为空");
                }

                int? sortOrder = _Request.Get<int>("SortOrder");

                if(sortOrder == null)
                {
                    md.AddError("SortOrder", "道具排序必须填写");
                }
                else if(sortOrder.Value < 0)
                {
                    md.AddError("SortOrder", "道具排序必须大于或等于0");
                }
                else
                {
                    this.m_Prop.SortOrder = sortOrder.Value;
                }

                int? price = _Request.Get<int>("price");

                if (price == null)
                {
                    md.AddError("price", "道具价格必须填写");
                }
                else if (price.Value <= 0)
                    md.AddError("price", "道具价格必须大于0");
                else
                    this.m_Prop.Price = price.Value;

                if(m_IsEdit == false)
                    this.m_Prop.PropType = _Request.Get("proptype");

                this.m_Prop.PropParam = m_PropType.GetPropParam(Request);

                int? priceType = _Request.Get<int>("pricetype");

                if (priceType == null)
                {
                    md.AddError("pricetype", "道具售价类型不能为空");
                }
                else
                    this.m_Prop.PriceType = priceType.Value;

                int? packageSize = _Request.Get<int>("packagesize");

                if (packageSize == null)
                {
                    md.AddError("packagesize", "道具重量必须填写");
                }
                else
                    this.m_Prop.PackageSize = packageSize.Value;

                int? totalNumber = _Request.Get<int>("totalnumber");

                if (totalNumber == null)
                {
                    md.AddError("totalnumber", "道具总数必须填写");
                }
                else if(totalNumber <= 0)
                {
                    md.AddError("totalnumber", "道具总数必须大于0");
                }
                else
                    this.m_Prop.TotalNumber = totalNumber.Value;

                bool? allowExchange = _Request.Get<bool>("allowexchange");

                if (allowExchange == null)
                {
                    md.AddError("allowexchange", "道具是否允许出售和赠送必须设置");
                }
                else
                    this.m_Prop.AllowExchange = allowExchange.Value;

                bool? autoReplenish = _Request.Get<bool>("autoreplenish");

                if (autoReplenish == null)
                {
                    md.AddError("autoreplenish", "道具是否自动补货必须设置");
                }
                else
                    this.m_Prop.AutoReplenish = autoReplenish.Value;

                int? replenishLimit = _Request.Get<int>("ReplenishLimit");

                if(replenishLimit == null)
                {
                    md.AddError("ReplenishLimit", "道具补货阀值必须设置");
                }
                else if(replenishLimit.Value < 0)
                {
                    md.AddError("ReplenishLimit", "道具补货阀值必须大于等于0");
                }
                else
                    this.m_Prop.ReplenishLimit = replenishLimit.Value;

                int? replenishNumber = _Request.Get<int>("replenishnumber");

                if (replenishNumber == null)
                {
                    md.AddError("replenishnumber", "道具自动补货数量必须填写");
                }
                else
                    this.m_Prop.ReplenishNumber = replenishNumber.Value;
                
                int? replenishTimespan = _Request.Get<int>("replenishtimespan");

                if (replenishTimespan == null)
                {
                    md.AddError("replenishtimespan", "道具自动补货周期必须设置");
                }
                else
                    this.m_Prop.ReplenishTimeSpan = replenishTimespan.Value;

                BuyPropCondition condition = new BuyPropCondition();

                this.m_Prop.BuyCondition = condition;

                condition.UserGroupIDs = StringUtil.Split2<Guid>(_Request.Get("BuyCondition.groups", Method.Post, string.Empty));

                int? totalPoint = _Request.Get<int>("BuyCondition.totalPoint");

                if (totalPoint != null && totalPoint.Value > 0)
                    condition.TotalPoint = totalPoint.Value;

                UserPointCollection allPoints = AllSettings.Current.PointSettings.UserPoints;

                int[] points = new int[allPoints.Count];

                for (int i = 0; i < points.Length; i++)
                {
                    UserPoint point = allPoints[i];

                    if (point.Enable)
                    {
                        int? value = _Request.Get<int>("BuyCondition." + point.Type);

                        if (value != null)
                            points[i] = value.Value;
                        else
                            points[i] = 0;
                    }
                    else
                    {
                        points[i] = 0;
                    }
                }

                condition.Points = points;

                int? totalPosts = _Request.Get<int>("BuyCondition.totalPosts");

                if (totalPosts != null && totalPosts.Value > 0)
                    condition.TotalPosts = totalPosts.Value;

                int? onlineTime = _Request.Get<int>("BuyCondition.onlinetime");

                if (onlineTime != null && onlineTime.Value > 0)
                    condition.OnlineTime = onlineTime.Value;

                condition.ReleatedMissionIDs = StringUtil.Split2<int>(_Request.Get("BuyCondition.releatedmissionids", Method.Post, string.Empty));

                if (md.HasAnyError())
                    return;

                using (ErrorScope es = new ErrorScope())
                {
                    if(m_IsEdit)
                    {
                        PropBO.Instance.UpdateProp(
                            m_Prop.PropID,
                            m_Prop.Icon,
                            m_Prop.Name,
                            price.Value,
                            priceType.Value,
                            m_Prop.PropType,
                            m_Prop.PropParam,
                            m_Prop.Description,
                            packageSize.Value,
                            totalNumber.Value,
                            allowExchange.Value,
                            autoReplenish.Value,
                            replenishNumber.Value,
                            replenishTimespan.Value,
                            replenishLimit.Value,
                            condition,
                            sortOrder.Value
                        );
                    }
                    else
                    {
                        PropBO.Instance.CreateProp(
                            m_Prop.Icon,
                            m_Prop.Name,
                            price.Value,
                            priceType.Value,
                            m_Prop.PropType,
                            m_Prop.PropParam,
                            m_Prop.Description,
                            packageSize.Value,
                            totalNumber.Value,
                            allowExchange.Value,
                            autoReplenish.Value,
                            replenishNumber.Value,
                            replenishTimespan.Value,
                            replenishLimit.Value,
                            condition,
                            sortOrder.Value
                        );
                    }

                    if (es.HasError)
                    {
                        es.CatchError<ErrorInfo>(delegate(ErrorInfo error)
                        {
                            md.AddError(error);
                        });
                    }
                    else
                        JumpTo("interactive/manage-prop.aspx?page=" + _Request.Get("page"));
                }
            }
        }
示例#9
0
 public IntProperty(string parent_id, string name, PropType type, string group)
     : base(parent_id, name, type, group)
 {
 }
示例#10
0
 public RenmasProperty(string parent_id, string name, PropType type, string group)
 {
     this.parent_id = parent_id;
     this.type = type;
     this.name = name;
     this.group = group;
 }
示例#11
0
 PropTag IFilterBuilderHelper.MapNamedProperty(NamedPropData npd, PropType propType)
 {
     return(PropTag.Body);
 }
示例#12
0
 public RenderablePropId(PropType propType, PropId propId)
 {
     _propType = propType;
     _propId   = propId;
 }
示例#13
0
 public ItemProperty(StoreItem item, string dsPropName, string publicPropName, PropType type)
 {
     m_item               = item;
     m_propertyType       = type;
     m_DSPropName         = dsPropName;
     m_publicPropName     = publicPropName;
     m_isBackingValueNull = true;
     SetValue(null);
 }
示例#14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            m_PropID = _Request.Get <int>("propid", -1);

            if (m_PropID != -1)
            {
                m_Prop = PropBO.Instance.GetUserProp(MyUserID, m_PropID);

                if (m_Prop == null)
                {
                    m_PropID = -1;
                }
                else
                {
                    PropType propType = PropBO.GetPropType(m_Prop.PropType);

                    if (propType == null)
                    {
                        m_PropID = -1;
                    }
                    else
                    {
                        m_PropHtml = propType.GetPropApplyFormHtml(Request);
                    }
                }
                if (m_Prop == null)
                {
                    ShowError("您选择的道具不存在");
                }
            }

            if (m_PropID == -1)
            {
                m_PropList = PropBO.Instance.GetUserProps(My);

                PropTypeCategory?category = _Request.Get <PropTypeCategory>("cat");

                if (category != null)
                {
                    for (int i = 0; i < m_PropList.Count;)
                    {
                        PropType type = PropBO.GetPropType(m_PropList[i].PropType);

                        if (type.Category != category.Value)
                        {
                            if (type.Category == PropTypeCategory.User && (category.Value == PropTypeCategory.Thread || category.Value == PropTypeCategory.ThreadReply))
                            {
                                i++;
                            }
                            else
                            {
                                m_PropList.RemoveAt(i);
                            }
                        }
                        else
                        {
                            i++;
                        }
                    }

                    if (m_PropList.Count == 0)
                    {
                        ShowError("在您的道具包中,没有找到适合当前场景使用的道具。");
                    }
                }
            }

            if (_Request.IsClick("use"))
            {
                using (ErrorScope es = new ErrorScope())
                {
                    PropResult result = PropBO.Instance.UseProp(My, m_PropID, Request);

                    if (result.Type == PropResultType.Succeed)
                    {
                        ShowSuccess(string.IsNullOrEmpty(result.Message) ? "道具使用成功!" : result.Message, true);
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(result.Message))
                        {
                            es.CatchError <ErrorInfo>(delegate(ErrorInfo error)
                            {
                                ShowError(error);
                            });
                        }
                        else
                        {
                            ShowError(result.Message);
                        }
                    }
                }
            }
        }