Beispiel #1
0
    public FashionData GetFashionData(uint fashion_id)
    {
        FashionData data = null;

        fashionDatas.TryGetValue(fashion_id, out data);
        return(data);
    }
Beispiel #2
0
    static int GetFashionData(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        FashionConfig obj  = (FashionConfig)LuaScriptMgr.GetNetObjectSelf(L, 1, "FashionConfig");
        uint          arg0 = (uint)LuaScriptMgr.GetNumber(L, 2);
        FashionData   o    = obj.GetFashionData(arg0);

        LuaScriptMgr.PushObject(L, o);
        return(1);
    }
    static int _CreateFashionData(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 0)
        {
            FashionData obj = new FashionData();
            LuaScriptMgr.PushObject(L, obj);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: FashionData.New");
        }

        return(0);
    }
Beispiel #4
0
 protected void OnGetFashionInfo(short state, SendFashionInfo down = null)
 {
     Debug.Log(string.Concat(new object[]
     {
         "OnGetFashionInfo: ",
         state,
         " ",
         down.Info.get_Count(),
         " ",
         down.wearFashion.get_Count()
     }));
     if (state != 0)
     {
         StateManager.Instance.StateShow(state, 0);
         return;
     }
     if (down == null)
     {
         return;
     }
     this.fashionImformation.Clear();
     this.dressingFashionData.Clear();
     for (int i = 0; i < down.Info.get_Count(); i++)
     {
         FashionData fashionData = new FashionData();
         fashionData.dataID    = down.Info.get_Item(i).fashionId;
         fashionData.time      = down.Info.get_Item(i).times;
         fashionData.state     = ((!down.Info.get_Item(i).isWear) ? ((down.Info.get_Item(i).times != 0) ? FashionData.FashionDataState.Own : FashionData.FashionDataState.Expired) : FashionData.FashionDataState.Dressing);
         fashionData.isAddAttr = down.Info.get_Item(i).hasEffect;
         this.fashionImformation.Add(down.Info.get_Item(i).fashionId, fashionData);
     }
     for (int j = 0; j < 3; j++)
     {
         if (j < down.wearFashion.get_Count())
         {
             this.dressingFashionData.Add(j + FashionDataSelete.Clothes, down.wearFashion.get_Item(j));
         }
         else
         {
             this.dressingFashionData.Add(j + FashionDataSelete.Clothes, string.Empty);
         }
     }
     this.TryFlushFashionUI();
     this.TryFlushShopUI();
 }
    static int get_reset_id(IntPtr L)
    {
        object      o   = LuaScriptMgr.GetLuaObject(L, 1);
        FashionData obj = (FashionData)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name reset_id");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index reset_id on a nil value");
            }
        }

        LuaScriptMgr.Push(L, obj.reset_id);
        return(1);
    }
    static int set_reset_num(IntPtr L)
    {
        object      o   = LuaScriptMgr.GetLuaObject(L, 1);
        FashionData obj = (FashionData)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name reset_num");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index reset_num on a nil value");
            }
        }

        obj.reset_num = (uint)LuaScriptMgr.GetNumber(L, 3);
        return(0);
    }
    public void SetData(FashionData fashionInformation, bool isShowHighLight)
    {
        this.fashionDataID = fashionInformation.dataID;
        ShiZhuangXiTong shiZhuangXiTong = DataReader <ShiZhuangXiTong> .Get(fashionInformation.dataID);

        if (DataReader <Items> .Contains(shiZhuangXiTong.itemsID))
        {
            Items items = DataReader <Items> .Get(shiZhuangXiTong.itemsID);

            this.SetIcon(items);
            this.SetName(GameDataUtils.GetChineseContent(items.name, false));
            this.SetLevel(GameDataUtils.GetChineseContent(items.describeId2, false));
            this.SetTimeLimit(this.GetTimeStringByTimeout(fashionInformation.state, fashionInformation.time));
            this.SetState(fashionInformation.state);
            this.SetMask(this.GetIsMaskOn(fashionInformation.state));
        }
        else
        {
            this.SetName(string.Empty);
            this.SetLevel(string.Empty);
            this.SetTimeLimit(string.Empty);
            this.SetState(FashionData.FashionDataState.None);
            this.SetMask(true);
        }
        if (isShowHighLight)
        {
            if (this.highLightFxID == 0)
            {
                this.highLightFxID = FXSpineManager.Instance.PlaySpine(603, base.get_transform(), "FashionUI", 3010, null, "UI", 0f, -3f, 1.1f, 1.2f, true, FXMaskLayer.MaskState.None);
            }
        }
        else
        {
            FXSpineManager.Instance.DeleteSpine(this.highLightFxID, true);
            this.highLightFxID = 0;
        }
    }
Beispiel #8
0
    public void ReadConfig()
    {
        if (isLoadFinish == false)
        {
            return;
        }
        isLoadFinish = false;
        lock (LockObject) { GameSystem.Instance.readConfigCnt += 1; }

        Debug.Log("Config reading " + name1);
        string text = ResourceLoadManager.Instance.GetConfigText(name1);

        if (text == null)
        {
            Debug.LogError("LoadConfig failed: " + name1);
            return;
        }

        //读取以及处理XML文本的类
        XmlDocument doc = CommonFunction.LoadXmlConfig(name1, text);

        XmlNode node_data = doc.SelectSingleNode("Data");

        foreach (XmlNode node_line in node_data.SelectNodes("Line"))
        {
            if (node_line.SelectSingleNode("switch").InnerText == "#")
            {
                continue;
            }

            FashionItem data = new FashionItem();
            data.fashion_id = uint.Parse(node_line.SelectSingleNode("id").InnerText);

            for (int i = 0; i < 6; i++)
            {
                string tmp = "shape_id" + (i + 1);

                string shaderID = node_line.SelectSingleNode(tmp).InnerText;
                if (shaderID == "")
                {
                    continue;
                }

                FashionMatch item = new FashionMatch();

                item.shape_id = shaderID;

                tmp = "bone_id" + (i + 1);
                string   strHideId = node_line.SelectSingleNode(tmp).InnerText;
                string[] tokens    = strHideId.Split('&');
                foreach (string token in tokens)
                {
                    uint hide_Id;
                    if (uint.TryParse(token, out hide_Id))
                    {
                        item.hide_id.Add(hide_Id);
                    }
                }
                tmp            = "body_type" + (i + 1);
                item.body_type = node_line.SelectSingleNode(tmp).InnerText;


                data.fashion_matchs.Add(item.body_type, item);
            }



            configs.Add(data.fashion_id, data);
        }


        Debug.Log("Config reading " + name2);

        text = ResourceLoadManager.Instance.GetConfigText(name2);
        if (text == null)
        {
            Debug.LogError("LoadConfig failed: " + name2);
            return;
        }

        //读取以及处理XML文本的类
        doc       = CommonFunction.LoadXmlConfig(GlobalConst.DIR_XML_BONE_MAPPING, text);
        node_data = doc.SelectSingleNode("Data");
        foreach (XmlNode node_line in node_data.SelectNodes("Line"))
        {
            HidePart data = new HidePart();
            data.hide_id = uint.Parse(node_line.SelectSingleNode("id").InnerText);
            data.part_id = node_line.SelectSingleNode("part").InnerText;
            mapHideParts.Add(data.hide_id, data);
        }


        Debug.Log("Config reading " + name3);
        text = ResourceLoadManager.Instance.GetConfigText(name3);
        if (text == null)
        {
            Debug.LogError("LoadConfig failed: " + name3);
            return;
        }

        //读取以及处理XML文本的类
        doc       = CommonFunction.LoadXmlConfig(GlobalConst.DIR_XML_FASHIONATTR, text);
        node_data = doc.SelectSingleNode("Data");
        foreach (XmlNode node_line in node_data.SelectNodes("Line"))
        {
            if (node_line.SelectSingleNode("switch").InnerText == "#")
            {
                continue;
            }

            FashionAttr fashionAttr = new FashionAttr();
            fashionAttr.attr_id = uint.Parse(node_line.SelectSingleNode("attrs_id").InnerText);
            string   attrsStr = node_line.SelectSingleNode("attrs").InnerText.ToString();
            string[] attr     = attrsStr.Split(':');
            fashionAttr.player_attr_id  = uint.Parse(attr[0]);
            fashionAttr.player_attr_num = uint.Parse(attr[1]);

            if (!fashionAttrs.ContainsKey(fashionAttr.attr_id))
            {
                fashionAttrs.Add(fashionAttr.attr_id, fashionAttr);
            }
        }


        Debug.Log("Config reading " + name4);
        text = ResourceLoadManager.Instance.GetConfigText(name4);
        if (text == null)
        {
            Debug.LogError("LoadConfig failed: " + name4);
            return;
        }

        //读取以及处理XML文本的类
        doc       = CommonFunction.LoadXmlConfig(GlobalConst.DIR_XML_FASHIONDATA, text);
        node_data = doc.SelectSingleNode("Data");
        foreach (XmlNode node_line in node_data.SelectNodes("Line"))
        {
            if (node_line.SelectSingleNode("switch").InnerText == "#")
            {
                continue;
            }

            FashionData fashionData = new FashionData();
            fashionData.fashion_id = uint.Parse(node_line.SelectSingleNode("id").InnerText);
            string   resetInfo = node_line.SelectSingleNode("reset_price").InnerText.ToString();
            string[] resetArr  = resetInfo.Split(':');
            fashionData.reset_id  = uint.Parse(resetArr[0]);
            fashionData.reset_num = uint.Parse(resetArr[1]);

            if (!fashionDatas.ContainsKey(fashionData.fashion_id))
            {
                fashionDatas.Add(fashionData.fashion_id, fashionData);
            }
        }
    }
        public ActionResult GenerateQRcode(int Id, decimal Amount, string sign, int memberId)
        {
            try
            {
                FashionData fd = new FashionData();
                fd.SetValue("Id", Id);
                fd.SetValue("Price", Amount);
                fd.SetValue("UserId", memberId);
                fd.SetValue("sign", sign);
                if (fd.CheckSign())
                {
                    var Price = _storeValueRuleContract.StoreValueRules.Where(x => x.Id == Id).ToList().FirstOrDefault();

                    if (Price != null)
                    {
                        if (Amount == Price.Price)
                        {
                            Dictionary <string, object> m_value = new Dictionary <string, object>();
                            string bodyStr = "";
                            //商品信息描述
                            if (Price.RuleType == 0)
                            {
                                bodyStr = "零时尚充值中心-储值充值";
                            }
                            else
                            {
                                bodyStr = "零时尚充值中心-积分充值";
                            }
                            RechargeOrder order = new RechargeOrder();
                            order.Amount       = Convert.ToDecimal(Amount);
                            order.RechargeType = (MemberActivityFlag)Price.RuleType;
                            order.RuleTypeId   = Convert.ToInt32(Price.Id);
                            if (Price.RuleType == 0)
                            {
                                //储值
                                order.TureAmount = Convert.ToDecimal(Price.RewardMoney + Price.Price);
                            }
                            else if (Price.RuleType == 1)
                            {
                                //积分
                                order.TureAmount = Convert.ToDecimal(Price.Score);
                            }
                            order.Pay_Type = Convert.ToInt32(3);
                            order.UserId   = memberId;
                            //订单号生成规则 当前时间+随机5位数
                            string out_trade_no = DateTime.Now.ToString("yyyyMMddHHmmssffff").ToString() + new Random().Next(10000, 99999).ToString();
                            order.order_Uid = out_trade_no;
                            var res = _rechargeOrderContract.Insert(order);
                            if (res.ResultType == OperationResultType.Success)
                            {
                                var product_id = _rechargeOrderContract.RechargeOrders.Where(x => x.order_Uid == out_trade_no)
                                                 .Select(x => x.Id).FirstOrDefault();
                                WxPayData wxdata = new WxPayData();
                                wxdata.SetValue("body", bodyStr);//商品描述
                                wxdata.SetValue("attach", "test");
                                wxdata.SetValue("out_trade_no", out_trade_no);
                                //总金额    订单总金额,只能为整数,详见支付金额   注意:金额不带小数点,最小为分,即1元=100分,传数据即可
                                wxdata.SetValue("total_fee", 1);
                                wxdata.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));
                                wxdata.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss"));
                                wxdata.SetValue("trade_type", "NATIVE");
                                wxdata.SetValue("nonce_str", Guid.NewGuid().ToString().Replace("-", ""));
                                wxdata.SetValue("product_id", product_id);
                                wxdata.SetValue("appid", PaymentConfigHelper.Wx_XD_AppId);
                                wxdata.SetValue("mch_id", PaymentConfigHelper.Wx_XD_MCHID);  //商户号
                                wxdata.SetValue("spbill_create_ip", PaymentConfigHelper.Ip); //终端ip
                                WxPayData result = WxPayApi.UnifiedOrder(wxdata, 6, 2, 2);
                                ViewData["out_trade_no"] = out_trade_no;
                                if (result.GetValue("return_code").ToString() == "SUCCESS")
                                {
                                    if (result.GetValue("code_url").ToString() != "")
                                    {
                                        string url = result.GetValue("code_url").ToString();//获得统一下单接口返回的二维码链接
                                        ViewBag.image = ImageHelper.CreateQRCode(url, Guid.NewGuid().ToString().Replace("-", ""));
                                    }
                                    else
                                    {
                                        ViewBag.error = "此次充值异常";
                                    }
                                }
                                else
                                {
                                    ViewBag.error = "此次充值异常";
                                }
                            }
                            else
                            {
                                ViewBag.error = "此次充值异常";
                            }
                        }
                        else
                        {
                            ViewBag.error = "充值金额有误";
                        }
                    }
                    else
                    {
                        ViewBag.error = "此次充值异常";
                    }
                }
                else
                {
                    ViewBag.error = "此次充值异常";
                }
            }
            catch (Exception e)
            {
                ViewBag.error = "此次充值异常";
            }
            return(PartialView());
        }
        public ActionResult RechargeWx(int Id, int AddFlag)
        {
            var memberType = _memberContract.Members.Where(x => x.Id == Id).Select(x => x.MemberTypeId).FirstOrDefault();
            var Price      = _storeValueRuleContract.StoreValueRules.Where(x => x.IsDeleted == false && x.IsEnabled == true && x.IsForever == true && x.RuleType == 0)
                             .Select(c => new
            {
                c.StoreValueName,
                Name = c.MemberTypes.Select(x => x.Id),
                c.Price,
                c.RewardMoney,
                c.Score,
                c.StartDate,
                c.EndDate,
                c.IsForever,
                c.Descrip,
                c.Id,
                c.IsDeleted,
                c.IsEnabled,
                c.Sequence,
                c.UpdatedTime,
                c.Operator.Member.MemberName
            }).ToList();
            string priceDiv = "";

            foreach (var item in Price)
            {
                if (item.Name.Contains(memberType))
                {
                    FashionData fd = new FashionData();
                    fd.SetValue("Id", item.Id);
                    fd.SetValue("Price", item.Price);
                    fd.SetValue("UserId", Id);
                    string sign = fd.MakeSign();
                    priceDiv += "<div class=\"col - md - 3\">";
                    priceDiv += "<button type=\"button\" class=\"btn btn-info btn - block\" data-index=\"" + item.Id + "\" data-amount=\"" + item.Price + "\" data-sign=\"" + sign + "\" style=\"height: 50px\">充" + (int)item.Price + "元送" + (int)item.RewardMoney + "元</button>";
                    priceDiv += "</div><br/>";
                }
            }

            var PriceForever = _storeValueRuleContract.StoreValueRules.Where(x => x.IsDeleted == false && x.IsEnabled == true && x.IsForever == false && x.RuleType == 0)
                               .Where(x => x.StartDate <= DateTime.Now && x.EndDate >= DateTime.Now)
                               .Select(c => new
            {
                c.StoreValueName,
                Name = c.MemberTypes.Select(x => x.Id),
                c.Price,
                c.RewardMoney,
                c.Score,
                c.StartDate,
                c.EndDate,
                c.IsForever,
                c.Descrip,
                c.Id,
                c.IsDeleted,
                c.IsEnabled,
                c.Sequence,
                c.UpdatedTime,
                c.Operator.Member.MemberName
            }).ToList();

            foreach (var item in PriceForever)
            {
                if (item.Name.Contains(memberType))
                {
                    FashionData fd = new FashionData();
                    fd.SetValue("Id", item.Id);
                    fd.SetValue("Price", item.Price);
                    fd.SetValue("UserId", Id);
                    string sign = fd.MakeSign();
                    priceDiv += "<div class=\"col - md - 3\">";
                    priceDiv += "<button type=\"button\" class=\"btn btn-info btn - block\" data-index=\"" + item.Id + "\"  data-amount=\"" + item.Price + "\"  data-sign=\"" + sign + "\"   style=\"height: 50px\">充" + (int)item.Price + "元送" + (int)item.RewardMoney + "元<br/>";
                    priceDiv += "活动时间:" + item.StartDate.ToString("D") + "-" + item.EndDate.ToString("D") + "</button>";
                    priceDiv += "</div><br/>";
                }
            }

            var Score = _storeValueRuleContract.StoreValueRules.Where(x => x.IsDeleted == false && x.IsEnabled == true && x.IsForever == true && x.RuleType == 1)
                        .Select(c => new
            {
                c.StoreValueName,
                Name = c.MemberTypes.Select(x => x.Id),
                c.Price,
                c.RewardMoney,
                c.Score,
                c.StartDate,
                c.EndDate,
                c.IsForever,
                c.Descrip,
                c.Id,
                c.IsDeleted,
                c.IsEnabled,
                c.Sequence,
                c.UpdatedTime,
                c.Operator.Member.MemberName
            }).ToList();
            string ScoreDiv = "";

            foreach (var item in Score)
            {
                if (item.Name.Contains(memberType))
                {
                    FashionData fd = new FashionData();
                    fd.SetValue("Id", item.Id);
                    fd.SetValue("Price", item.Price);
                    fd.SetValue("UserId", Id);
                    string sign = fd.MakeSign();
                    ScoreDiv += "<div class=\"col - md - 3\">";
                    ScoreDiv += "<button type=\"button\" class=\"btn btn-info btn - block\" data-index=\"" + item.Id + "\"  data-amount=\"" + item.Price + "\"  data-sign=\"" + sign + "\"   style=\"height: 50px\">充" + (int)item.Price + "元获得" + (int)item.Score + "积分</button>";
                    ScoreDiv += "</div><br/>";
                }
            }

            var ScoreForever = _storeValueRuleContract.StoreValueRules.Where(x => x.IsDeleted == false && x.IsEnabled == true && x.IsForever == false && x.RuleType == 1)
                               .Where(x => x.StartDate <= DateTime.Now && x.EndDate >= DateTime.Now)
                               .Select(c => new
            {
                c.StoreValueName,
                Name = c.MemberTypes.Select(x => x.Id),
                c.Price,
                c.RewardMoney,
                c.Score,
                c.StartDate,
                c.EndDate,
                c.IsForever,
                c.Descrip,
                c.Id,
                c.IsDeleted,
                c.IsEnabled,
                c.Sequence,
                c.UpdatedTime,
                c.Operator.Member.MemberName
            }).ToList();

            foreach (var item in ScoreForever)
            {
                if (item.Name.Contains(memberType))
                {
                    FashionData fd = new FashionData();
                    fd.SetValue("Id", item.Id);
                    fd.SetValue("Price", item.Price);
                    fd.SetValue("UserId", Id);
                    string sign = fd.MakeSign();
                    ScoreDiv += "<div class=\"col - md - 3\">";
                    ScoreDiv += "<button type=\"button\" class=\"btn btn-info btn - block\" data-index=\"" + item.Id + "\"  data-amount=\"" + item.Price + "\"  data-sign=\"" + sign + "\"   style=\"height: 50px\">充" + (int)item.Price + "元获得" + (int)item.Score + "积分<br/>";
                    ScoreDiv += "活动时间:" + item.StartDate.ToString("D") + "-" + item.EndDate.ToString("D") + "</button>";
                    ScoreDiv += "</div><br/>";
                }
            }
            ViewData["priceDiv"] = priceDiv;
            ViewData["ScoreDiv"] = ScoreDiv;
            ViewData["UserId"]   = Id;
            return(PartialView());
        }