public void AskRedeem(EquipmentInfo _eq, GUIType _type, BuyType _buyType, int _nums) { nums = 0; if (_eq != null) { curEq = _eq; } nums = _nums; buyType = _buyType; // GameCenter.uIMng.GenGUI(GUIType.BUYWND, true); }
public void OpenBuyWnd(EquipmentInfo _eq, BuyType _buyType, int _restrictionNum = 0) { restrictionNum = _restrictionNum; nums = 0; if (_eq != null) { curEq = _eq; } buyType = _buyType; GameCenter.uIMng.GenGUI(GUIType.BUYWND, true); }
public HPResponseInfo DoBuy(UserInfo user, string gameName, string issueNumber , BuyType buyType, List <string> anteCodes, decimal money, int multiple) { try { HPBuyRequestInfo requestInfo = new HPBuyRequestInfo(); string messengerId = GetAgenceAccountUserName(); string userPassword = GetAgenceAccountPassword(); string messageId = messengerId + DateTime.Now.ToString("yyyyMMdd") + PostManager.EightSerialNumber; string timestamp = DateTime.Now.ToString("yyyyMMddHHmmss"); IssueMappingInfo issueInfo = new IssueMappingInfo(); issueInfo.GameName = gameName; issueInfo.Number = issueNumber; TicketMappingInfo ticket = new TicketMappingInfo(); ticket.TicketId = messengerId + DateTime.Now.ToString("yyyyMMdd") + PostManager.EightSerialNumber; ticket.BuyType = buyType; ticket.Money = money; ticket.Amount = multiple; ticket.AnteCodes = anteCodes; ticket.IssueInfo = issueInfo; ticket.UserProfile = GetAgencyUserProfileInfo(); HPBuyRequestInfo.Body requestBody = new HPBuyRequestInfo.Body(); requestBody._Request = new HPBuyRequestInfo.Body.Request(); requestBody._Request.TicketList = new XmlMappingList <TicketMappingInfo>(); requestBody._Request.TicketList.Add(ticket); string bodyXml = requestBody.ToXmlString("body"); CommunicationObject.RequestHeaderObject requestHeader = new CommunicationObject.RequestHeaderObject(); requestHeader.MessengerId = GetAgenceAccountUserName(); requestHeader.Timestamp = timestamp; requestHeader.TransactionType = TranType.Request103; requestHeader.Digest = PostManager.MD5(messageId + timestamp + userPassword + bodyXml, "gb2312"); string headerXml = requestHeader.ToXmlString("header"); string requestXml = "<?xml version=\"1.0\" encoding=\"GBK\"?><message version=\"1.0\" id=\"" + messageId + "\">" + headerXml + bodyXml + "</message>"; string requestText = "transType=" + (int)TranType.Request103 + "&transMessage=" + requestXml; BuyTicket(ticket, user); string xml = PostManager.Post(GateWayManager.HPIssueQuery_GateWay, requestText, 1200); HPResponseInfo info = XmlAnalyzer.AnalyseResponse <HPResponseInfo>(xml); UpdateTicketStatus(ticket, user, info); return(info); } catch (Exception ex) { throw HandleException(LogCategory.Ticket, "认购失败!", ex); } }
public byte[] ToBin(BuyType type) { NetSocket.ByteArray bin = new NetSocket.ByteArray(); switch (type) { case BuyType.BT_BuyBuilding: bin.Put(buy_build.ToBin()); break; case BuyType.BT_BuyResource: bin.Put(buy_resource.ToBin()); break; default: break; } return(bin.GetData()); }
void SelectBuy() { UIToggle currToggle = UIToggle.current; currToggle.startsActive = true; if (currToggle != null && currToggle.value) { var cfg = MarketRuneListModel.Instance.GetGoodsIno((int)m_RuneID); if (currToggle == m_GoldBuyToggle) { m_BuyType = BuyType.buyGold; } else if (currToggle == m_CrystalBuyToggle) { m_BuyType = BuyType.buyDiamond; } } CalculateConsume(); }
public override int GetHashCode() { int hash = 1; if (BuyType != 0) { hash ^= BuyType.GetHashCode(); } if (Num != 0) { hash ^= Num.GetHashCode(); } if (Gem != 0) { hash ^= Gem.GetHashCode(); } if (Amount != 0) { hash ^= Amount.GetHashCode(); } return(hash); }
public void OpenBuyWnd(BuyType buyType) { StopNavTask(); buyWnd.SetWndState(); buyWnd.SetBuyType(buyType); }
public virtual void UpdateContent(ShopInfo shopInfo, ShopProductInfo shopProductInfo) { this.shopInfo = shopInfo; int maxBuyCount = 0; int tapInfo = 0; textPItemId.text = shopProductInfo.shopProductId.ToString(); textPItemId.text += $" ({shopProductInfo.buyCount}/{maxBuyCount})"; int getCount = 0; TDataShopProductList data = null; TDataItemList item = null; switch (shopInfo.shopId) { case 1: // 이벤트 상품 { if (TableManager.Get().ShopProductList.GetData(shopProductInfo.shopProductId, out data)) { buyType = (BuyType)data.buyType; tapInfo = data.tapInfo; imageName = data.shopImage; maxBuyCount = data.buyLimitCnt; switch (buyType) { case BuyType.gold: imagePriceIcon.sprite = FileHelper.GetIcon("icon_gold"); textPItemBuyCount.text = data.buyPrice.ToString(); break; case BuyType.dia: imagePriceIcon.sprite = FileHelper.GetIcon("icon_dia"); textPItemBuyCount.text = data.buyPrice.ToString(); break; case BuyType.cash: imagePriceIcon.enabled = false; break; case BuyType.free: imagePriceIcon.enabled = false; textPItemBuyCount.text = LocalizationManager.GetLangDesc("Shop_Buyfree"); var pos = textPItemBuyCount.rectTransform.anchoredPosition; pos.x = 0; textPItemBuyCount.rectTransform.anchoredPosition = pos; break; case BuyType.ad: imagePriceIcon.enabled = false; break; } #if UNITY_ANDROID productId = data.googleProductId; #elif UNITY_IOS productId = data.appleProductId; #endif } } break; case 2: // 패키지 상품 { if (TableManager.Get().ShopProductList.GetData(shopProductInfo.shopProductId, out data)) { buyType = (BuyType)data.buyType; tapInfo = data.tapInfo; imageName = data.shopImage; maxBuyCount = data.buyLimitCnt; switch (buyType) { case BuyType.gold: imagePriceIcon.sprite = FileHelper.GetIcon("icon_gold"); textPItemBuyCount.text = data.buyPrice.ToString(); break; case BuyType.dia: imagePriceIcon.sprite = FileHelper.GetIcon("icon_dia"); textPItemBuyCount.text = data.buyPrice.ToString(); break; case BuyType.cash: imagePriceIcon.enabled = false; break; case BuyType.free: imagePriceIcon.enabled = false; textPItemBuyCount.text = LocalizationManager.GetLangDesc("Shop_Buyfree"); var pos = textPItemBuyCount.rectTransform.anchoredPosition; pos.x = 0; textPItemBuyCount.rectTransform.anchoredPosition = pos; break; case BuyType.ad: imagePriceIcon.enabled = false; break; } #if UNITY_ANDROID productId = data.googleProductId; #elif UNITY_IOS productId = data.appleProductId; #endif } } break; case 3: // 일일 상품 { if (TableManager.Get().ShopProductList.GetData(shopProductInfo.shopProductId, out data)) { buyType = (BuyType)data.buyType; tapInfo = data.tapInfo; switch (buyType) { case BuyType.gold: imagePriceIcon.enabled = true; imagePriceIcon.sprite = FileHelper.GetIcon("icon_gold"); textPItemBuyCount.text = data.buyPrice.ToString(); break; case BuyType.dia: imagePriceIcon.enabled = true; imagePriceIcon.sprite = FileHelper.GetIcon("icon_dia"); textPItemBuyCount.text = data.buyPrice.ToString(); break; case BuyType.cash: imagePriceIcon.enabled = false; break; case BuyType.free: imagePriceIcon.enabled = false; textPItemBuyCount.text = LocalizationManager.GetLangDesc("Shop_Buyfree"); var pos = textPItemBuyCount.rectTransform.anchoredPosition; pos.x = 0; textPItemBuyCount.rectTransform.anchoredPosition = pos; break; case BuyType.ad: imagePriceIcon.enabled = false; break; } textPItemId.text = $"x{data.itemValue01}"; if (TableManager.Get().ItemList.GetData(itm => itm.id == data.itemId01, out item)) { imageIcon.sprite = FileHelper.GetIcon(item.itemIcon); } } buttonShopItem.interactable = shopProductInfo.buyCount == 0; } break; case 4: // 박스 { if (TableManager.Get().ShopProductList.GetData(shopProductInfo.shopProductId, out data)) { buyType = (BuyType)data.buyType; tapInfo = data.tapInfo; switch (buyType) { case BuyType.gold: imagePriceIcon.sprite = FileHelper.GetIcon("icon_gold"); textPItemBuyCount.text = data.buyPrice.ToString(); break; case BuyType.dia: imagePriceIcon.sprite = FileHelper.GetIcon("icon_dia"); textPItemBuyCount.text = data.buyPrice.ToString(); break; case BuyType.cash: imagePriceIcon.enabled = false; textPItemBuyCount.text = LocalizationManager.GetLangDesc("Shop_Buyfree"); var pos = textPItemBuyCount.rectTransform.anchoredPosition; pos.x = 0; textPItemBuyCount.rectTransform.anchoredPosition = pos; break; case BuyType.free: imagePriceIcon.enabled = false; textPItemBuyCount.text = LocalizationManager.GetLangDesc("Shop_Buyfree"); pos = textPItemBuyCount.rectTransform.anchoredPosition; pos.x = 0; textPItemBuyCount.rectTransform.anchoredPosition = pos; break; case BuyType.ad: imagePriceIcon.enabled = false; break; } textPItemId.text = $"x{data.itemValue01}"; if (TableManager.Get().ItemList.GetData(itm => itm.id == data.itemId01, out item)) { imageIcon.sprite = FileHelper.GetIcon(item.itemIcon); imageIcon.SetNativeSize(); } textPItemBuyCount.text = $"{data.buyPrice}"; } } break; case 5: // 프리미엄 { if (TableManager.Get().ShopProductList.GetData(shopProductInfo.shopProductId, out data)) { buyType = (BuyType)data.buyType; tapInfo = data.tapInfo; imageName = data.shopImage; switch (buyType) { case BuyType.gold: imagePriceIcon.sprite = FileHelper.GetIcon("icon_gold"); textPItemBuyCount.text = data.buyPrice.ToString(); break; case BuyType.dia: imagePriceIcon.sprite = FileHelper.GetIcon("icon_dia"); textPItemBuyCount.text = data.buyPrice.ToString(); break; case BuyType.cash: imagePriceIcon.enabled = false; break; case BuyType.free: imagePriceIcon.enabled = false; textPItemBuyCount.text = LocalizationManager.GetLangDesc("Shop_Buyfree"); var pos = textPItemBuyCount.rectTransform.anchoredPosition; pos.x = 0; textPItemBuyCount.rectTransform.anchoredPosition = pos; break; case BuyType.ad: imagePriceIcon.enabled = false; break; } #if UNITY_ANDROID productId = data.googleProductId; #elif UNITY_IOS productId = data.appleProductId; #endif } } break; case 6: // 이모티콘 { if (TableManager.Get().ShopProductList.GetData(shopProductInfo.shopProductId, out data)) { buyType = (BuyType)data.buyType; tapInfo = data.tapInfo; textPItemBuyCount.text = $"{data.buyType}:{data.buyPrice}"; } } break; case 7: // 다이아 { if (TableManager.Get().ShopProductList.GetData(shopProductInfo.shopProductId, out data)) { buyType = (BuyType)data.buyType; tapInfo = data.tapInfo; imageName = data.shopImage; #if UNITY_ANDROID productId = data.googleProductId; #elif UNITY_IOS productId = data.appleProductId; #endif switch (buyType) { case BuyType.gold: imagePriceIcon.sprite = FileHelper.GetIcon("icon_gold"); textPItemBuyCount.text = data.buyPrice.ToString(); break; case BuyType.dia: imagePriceIcon.sprite = FileHelper.GetIcon("icon_dia"); textPItemBuyCount.text = data.buyPrice.ToString(); break; case BuyType.cash: imagePriceIcon.enabled = false; textPItemBuyCount.text = LocalizationManager.GetLangDesc("Shop_Buyfree"); var pos = textPItemBuyCount.rectTransform.anchoredPosition; pos.x = 0; textPItemBuyCount.rectTransform.anchoredPosition = pos; break; case BuyType.free: imagePriceIcon.enabled = false; textPItemBuyCount.text = LocalizationManager.GetLangDesc("Shop_Buyfree"); pos = textPItemBuyCount.rectTransform.anchoredPosition; pos.x = 0; textPItemBuyCount.rectTransform.anchoredPosition = pos; break; case BuyType.ad: imagePriceIcon.enabled = false; break; } textPItemId.text = $"x{data.itemValue01}"; if (TableManager.Get().ItemList.GetData(itm => itm.id == data.itemId01, out item)) { imageIcon.sprite = FileHelper.GetIcon(data.shopImage); } } } break; case 8: // 골드 { if (TableManager.Get().ShopProductList.GetData(shopProductInfo.shopProductId, out data)) { buyType = (BuyType)data.buyType; tapInfo = data.tapInfo; imageName = data.shopImage; switch (buyType) { case BuyType.gold: imagePriceIcon.sprite = FileHelper.GetIcon("icon_gold"); textPItemBuyCount.text = data.buyPrice.ToString(); break; case BuyType.dia: imagePriceIcon.sprite = FileHelper.GetIcon("icon_dia"); textPItemBuyCount.text = data.buyPrice.ToString(); break; case BuyType.cash: imagePriceIcon.enabled = false; textPItemBuyCount.text = LocalizationManager.GetLangDesc("Shop_Buyfree"); var pos = textPItemBuyCount.rectTransform.anchoredPosition; pos.x = 0; textPItemBuyCount.rectTransform.anchoredPosition = pos; break; case BuyType.free: imagePriceIcon.enabled = false; textPItemBuyCount.text = LocalizationManager.GetLangDesc("Shop_Buyfree"); pos = textPItemBuyCount.rectTransform.anchoredPosition; pos.x = 0; textPItemBuyCount.rectTransform.anchoredPosition = pos; break; case BuyType.ad: imagePriceIcon.enabled = false; break; } textPItemId.text = $"x{data.itemValue01}"; if (TableManager.Get().ItemList.GetData(itm => itm.id == data.itemId01, out item)) { imageIcon.sprite = FileHelper.GetIcon(data.shopImage); } textPItemBuyCount.text = $"{data.buyPrice}"; } } break; } // Tap if (data != null) { switch ((ETapInfoKey)data.tapInfo) { case ETapInfoKey.tap_hot: textBadge.text = "HOT"; textBadge.transform.parent.gameObject.SetActive(true); textValue.transform.parent.gameObject.SetActive(false); textFirstBuy.transform.parent.gameObject.SetActive(false); break; case ETapInfoKey.tap_best: textBadge.text = "BEST"; textBadge.transform.parent.gameObject.SetActive(true); textValue.transform.parent.gameObject.SetActive(false); textFirstBuy.transform.parent.gameObject.SetActive(false); break; case ETapInfoKey.tap_new: textBadge.text = "NEW"; textBadge.transform.parent.gameObject.SetActive(true); textValue.transform.parent.gameObject.SetActive(false); textFirstBuy.transform.parent.gameObject.SetActive(false); break; case ETapInfoKey.tap_oneplusone: textBadge.text = "1+1"; textBadge.transform.parent.gameObject.SetActive(true); textValue.transform.parent.gameObject.SetActive(false); textFirstBuy.transform.parent.gameObject.SetActive(true); break; case ETapInfoKey.tap_value: textValue.text = $"{data.tapValue}"; textBadge.transform.parent.gameObject.SetActive(false); textValue.transform.parent.gameObject.SetActive(true); textFirstBuy.transform.parent.gameObject.SetActive(false); break; } } buttonShopItem.onClick = new Button.ButtonClickedEvent(); //shopProductInfo.shopProductId 값으로 테이블에 존재하는 상품 데이터 조회 //string productId = "mhl_package_crystal_150"; if (buyType == BuyType.cash) { textPItemBuyCount.text = InAppManager.Instance.GetIDToProduct(productId)?.metadata.localizedPriceString; } //else textPItemBuyCount.text = string.Empty; shopProductId = shopProductInfo.shopProductId; //아이템의 buyType에 따라서 구매 버튼 눌렀을때 다르게 처리하기 buttonShopItem.onClick.AddListener(() => { if (buyType == BuyType.dia || buyType == BuyType.gold) { UI_Main.Get().shopBuyPopup.Initialize(imageIcon.sprite, textPItemId.text, buyType, textPItemBuyCount.text, item, tapInfo, Buy); } else { Buy(); } }); SetColor(); }
private void GetAnteCodes(int playTypeValue, string numbers, out BuyType buyType, out List<string> anteCodes) { GetAnteCode action; switch (playTypeValue) { case 2901: // 直选单式 buyType = BuyType.B201; action = new GetAnteCode(GetSingleCodeFormat); break; case 2902: // 直选复式 buyType = BuyType.B208; action = new GetAnteCode(GetManyCodeFormat); break; case 2903: // 组选单式 buyType = BuyType.B202; action = new GetAnteCode(GetSingleCodeFormat); break; //case 2904: // 组选6 // buyType = BuyType.B230; // action = new GetAnteCode(GetSingleCodeFormat); // break; //case 2905: // 组选3 // buyType = BuyType.B230; // action = new GetAnteCode(GetSingleCodeFormat); // break; case 2908: // 前二单式 buyType = BuyType.B201; action = new GetAnteCode(GetSingleCodeFormat_Left); break; case 2909: // 前二复式 buyType = BuyType.B208; action = new GetAnteCode(GetManyCodeFormat_Left2); break; case 2910: // 后二单式 buyType = BuyType.B201; action = new GetAnteCode(GetSingleCodeFormat_Right); break; case 2911: // 后二复式 buyType = BuyType.B208; action = new GetAnteCode(GetManyCodeFormat_Right2); break; case 2912: // 前一单式 buyType = BuyType.B201; action = new GetAnteCode(GetSingleCodeFormat_Left); break; case 2913: // 前一复式 buyType = BuyType.B208; action = new GetAnteCode(GetManyCodeFormat_Left1); break; case 2914: // 后一单式 buyType = BuyType.B201; action = new GetAnteCode(GetSingleCodeFormat_Right); break; case 2915: // 后一复式 buyType = BuyType.B208; action = new GetAnteCode(GetManyCodeFormat_Right1); break; default: throw new ArgumentOutOfRangeException("玩法类型超出范围:" + playTypeValue); } anteCodes = new List<string>(); foreach (string code in numbers.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries)) { string anteCode = action(code); anteCodes.Add(anteCode); } }
public void SetBuyType(BuyType buyType) { this.buyType = buyType; RefreshUI(); }
public void Initialize(Sprite icon, string count, BuyType priceType, string price, TDataItemList item, int tab, UnityAction callback) { gameObject.SetActive(true); //obj_Double.SetActive(isDouble); image_Icon.sprite = icon; text_Count.text = count; switch (priceType) { case BuyType.gold: image_PriceIcon.enabled = true; image_PriceIcon.sprite = FileHelper.GetIcon("icon_gold"); var pos = text_Price.rectTransform.anchoredPosition; pos.x = 37.5f; text_Price.rectTransform.anchoredPosition = pos; text_Price.text = price; //btn_Buy.interactable = UserInfoManager.Get().GetUserInfo().gold >= Int32.Parse(price); break; case BuyType.dia: image_PriceIcon.enabled = true; image_PriceIcon.sprite = FileHelper.GetIcon("icon_dia"); pos = text_Price.rectTransform.anchoredPosition; pos.x = 37.5f; text_Price.rectTransform.anchoredPosition = pos; text_Price.text = price; //btn_Buy.interactable = UserInfoManager.Get().GetUserInfo().diamond >= Int32.Parse(price); break; case BuyType.cash: image_PriceIcon.enabled = false; text_Price.text = price; pos = text_Price.rectTransform.anchoredPosition; pos.x = 0; text_Price.rectTransform.anchoredPosition = pos; break; case BuyType.free: image_PriceIcon.enabled = false; text_Price.text = LocalizationManager.GetLangDesc("Shop_Buyfree"); pos = text_Price.rectTransform.anchoredPosition; pos.x = 0; text_Price.rectTransform.anchoredPosition = pos; break; case BuyType.ad: image_PriceIcon.enabled = false; break; } if (item != null) { text_Title.text = LocalizationManager.GetLangDesc(item.itemName_langId); if ((ITEM_TYPE)item.itemType == ITEM_TYPE.DICE) { TDataDiceInfo diceInfo; if (TableManager.Get().DiceInfo.GetData(dice => dice.id == item.id, out diceInfo)) { obj_Gauge.SetActive(true); int level = 1; int diceCount = 0; if (UserInfoManager.Get().GetUserInfo().dicGettedDice.ContainsKey(diceInfo.id)) { level = UserInfoManager.Get().GetUserInfo().dicGettedDice[diceInfo.id][0]; diceCount = UserInfoManager.Get().GetUserInfo().dicGettedDice[diceInfo.id][1]; } TDataDiceUpgrade dataDiceUpgrade; if (TableManager.Get().DiceUpgrade .GetData(x => x.diceLv == level + 1 && x.diceGrade == diceInfo.grade, out dataDiceUpgrade)) { int needDiceCount = dataDiceUpgrade.needCard; slider_Gauge.value = diceCount / (float)needDiceCount; text_Class.text = $"{Global.g_class} {level}"; text_DiceCount.text = $"{diceCount}/{needDiceCount}"; obj_UpgradeIcon.SetActive(diceCount >= needDiceCount); } } } else { obj_Gauge.SetActive(false); } } else { text_Title.text = string.Empty; obj_Gauge.SetActive(false); } LayoutRebuilder.ForceRebuildLayoutImmediate(rts_Frame); btn_Buy.onClick.RemoveAllListeners(); btn_Buy.onClick.AddListener(() => { if (priceType == BuyType.gold) { if (UserInfoManager.Get().GetUserInfo().gold < Int32.Parse(price)) { UI_Main.Get().moveShopPopup.Initialize(UI_BoxOpenPopup.COST_TYPE.GOLD); return; } } else if (priceType == BuyType.dia) { if (UserInfoManager.Get().GetUserInfo().diamond < Int32.Parse(price)) { UI_Main.Get().moveShopPopup.Initialize(UI_BoxOpenPopup.COST_TYPE.DIAMOND); return; } } callback?.Invoke(); Close(); }); SetColor(); }
public byte[] ToBin (BuyType type) { NetSocket.ByteArray bin = new NetSocket.ByteArray (); switch( type ) { case BuyType.BT_BuyBuilding: bin.Put(buy_build.ToBin()); break; case BuyType.BT_BuyResource: bin.Put(buy_resource.ToBin()); break; default: break; } return bin.GetData(); }
private void GetAnteCodes(int playTypeValue, string numbers, out BuyType buyType, out List <string> anteCodes) { GetAnteCode action; switch (playTypeValue) { case 2901: // 直选单式 buyType = BuyType.B201; action = new GetAnteCode(GetSingleCodeFormat); break; case 2902: // 直选复式 buyType = BuyType.B208; action = new GetAnteCode(GetManyCodeFormat); break; case 2903: // 组选单式 buyType = BuyType.B202; action = new GetAnteCode(GetSingleCodeFormat); break; //case 2904: // 组选6 // buyType = BuyType.B230; // action = new GetAnteCode(GetSingleCodeFormat); // break; //case 2905: // 组选3 // buyType = BuyType.B230; // action = new GetAnteCode(GetSingleCodeFormat); // break; case 2908: // 前二单式 buyType = BuyType.B201; action = new GetAnteCode(GetSingleCodeFormat_Left); break; case 2909: // 前二复式 buyType = BuyType.B208; action = new GetAnteCode(GetManyCodeFormat_Left2); break; case 2910: // 后二单式 buyType = BuyType.B201; action = new GetAnteCode(GetSingleCodeFormat_Right); break; case 2911: // 后二复式 buyType = BuyType.B208; action = new GetAnteCode(GetManyCodeFormat_Right2); break; case 2912: // 前一单式 buyType = BuyType.B201; action = new GetAnteCode(GetSingleCodeFormat_Left); break; case 2913: // 前一复式 buyType = BuyType.B208; action = new GetAnteCode(GetManyCodeFormat_Left1); break; case 2914: // 后一单式 buyType = BuyType.B201; action = new GetAnteCode(GetSingleCodeFormat_Right); break; case 2915: // 后一复式 buyType = BuyType.B208; action = new GetAnteCode(GetManyCodeFormat_Right1); break; default: throw new ArgumentOutOfRangeException("玩法类型超出范围:" + playTypeValue); } anteCodes = new List <string>(); foreach (string code in numbers.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries)) { string anteCode = action(code); anteCodes.Add(anteCode); } }
public HPResponseInfo DoBuy(UserInfo user, string gameName, string issueNumber , BuyType buyType, List<string> anteCodes, decimal money, int multiple) { try { HPBuyRequestInfo requestInfo = new HPBuyRequestInfo(); string messengerId = GetAgenceAccountUserName(); string userPassword = GetAgenceAccountPassword(); string messageId = messengerId + DateTime.Now.ToString("yyyyMMdd") + PostManager.EightSerialNumber; string timestamp = DateTime.Now.ToString("yyyyMMddHHmmss"); IssueMappingInfo issueInfo = new IssueMappingInfo(); issueInfo.GameName = gameName; issueInfo.Number = issueNumber; TicketMappingInfo ticket = new TicketMappingInfo(); ticket.TicketId = messengerId + DateTime.Now.ToString("yyyyMMdd") + PostManager.EightSerialNumber; ticket.BuyType = buyType; ticket.Money = money; ticket.Amount = multiple; ticket.AnteCodes = anteCodes; ticket.IssueInfo = issueInfo; ticket.UserProfile = GetAgencyUserProfileInfo(); HPBuyRequestInfo.Body requestBody = new HPBuyRequestInfo.Body(); requestBody._Request = new HPBuyRequestInfo.Body.Request(); requestBody._Request.TicketList = new XmlMappingList<TicketMappingInfo>(); requestBody._Request.TicketList.Add(ticket); string bodyXml = requestBody.ToXmlString("body"); CommunicationObject.RequestHeaderObject requestHeader = new CommunicationObject.RequestHeaderObject(); requestHeader.MessengerId = GetAgenceAccountUserName(); requestHeader.Timestamp = timestamp; requestHeader.TransactionType = TranType.Request103; requestHeader.Digest = PostManager.MD5(messageId + timestamp + userPassword + bodyXml, "gb2312"); string headerXml = requestHeader.ToXmlString("header"); string requestXml = "<?xml version=\"1.0\" encoding=\"GBK\"?><message version=\"1.0\" id=\"" + messageId + "\">" + headerXml + bodyXml + "</message>"; string requestText = "transType=" + (int)TranType.Request103 + "&transMessage=" + requestXml; BuyTicket(ticket, user); string xml = PostManager.Post(GateWayManager.HPIssueQuery_GateWay, requestText, 1200); HPResponseInfo info = XmlAnalyzer.AnalyseResponse<HPResponseInfo>(xml); UpdateTicketStatus(ticket, user, info); return info; } catch (Exception ex) { throw HandleException(LogCategory.Ticket, "认购失败!", ex); } }