void UpdateItem(MarketItemInfo mi) { if (PlayerPrefs.GetInt("PaidForItem" + mi.itemID.ToString(), 0) == 1) { mi.textMesh.text = TextTranslationManager.GetText(TextTranslationManager.TextCollection.itemPrompts, 2, PlayerPrefs.GetInt("Language")); } else { if (mi.price == -1) { mi.textMesh.text = TextTranslationManager.GetText(TextTranslationManager.TextCollection.itemPrompts, 3, PlayerPrefs.GetInt("Language")); } else { mi.textMesh.text = mi.price.ToString(); } } if (PlayerPrefs.GetInt("Language") == 11) { mi.textMesh.font = TextTranslationManager.singleton.arabicFont; mi.textMesh.fontStyle = FontStyle.Bold; } else { mi.textMesh.font = soldFont; mi.textMesh.fontStyle = soldFontStyle; } }
/// <summary> /// 重置数据 /// </summary> void ResetData() { MarketTypes.Clear(); MarketItems.Clear(); MyMarketItems.Clear(); buyType = 0; CurMarketItem = null; CurAuctionItem = null; }
public MarketItemInfo ItemPage(int appId, string hashName) { if (string.IsNullOrEmpty(hashName)) { throw new SteamException("HashName should not be empty"); } var resp = this.steam.Request( Urls.Market + $"/listings/{appId}/{Uri.EscapeDataString(hashName)}", Method.GET, Urls.Market, null, true, proxy: this.Proxy); var content = resp.Data.Content; var nameIdParse = int.TryParse( Regex.Match(content, @"(?<=Market_LoadOrderSpread\()(.*)(?=\);)").Value.Trim(), out var nameId); if (!nameIdParse) { throw new SteamException($"Unable to find name ID of {hashName}"); } var publisherFeePercentMatch = Regex.Match(content, "(?<=\"publisher_fee_percent\":\")(.*?)(?=\")").Value; int publisherFeePercent; if (string.IsNullOrEmpty(publisherFeePercentMatch)) { publisherFeePercent = PublisherFeePercentDefault; } else { var publisherFeePercentParse = decimal.TryParse( publisherFeePercentMatch, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var publisherFeePercentOut); if (!publisherFeePercentParse) { throw new SteamException("Cannot to parse publisher fee percent"); } publisherFeePercent = (int)Math.Round(publisherFeePercentOut * 100); } var item = new MarketItemInfo { NameId = nameId, PublisherFeePercent = publisherFeePercent }; return(item); }
/// <summary> /// 获得拍卖物品数据 /// </summary> /// <param name="_pt"></param> protected void S2C_GetMarketItem(Pt _pt) { pt_shelve_items_info_d550 pt = _pt as pt_shelve_items_info_d550; if (pt != null) { if (marketPage != (int)pt.page) { RefreshScrollView = false; } if (pt.shelve_item_list.Count > 0) { marketPage = (int)pt.page; } if (pt.type == 1) { //MarketItems.Clear(); List <MarketItemInfo> List = new List <MarketItemInfo>(); for (int i = 0; i < pt.shelve_item_list.Count; i++) { MarketItemInfo info = new MarketItemInfo(pt.shelve_item_list[i]); List.Add(info); } MarketItems[(int)pt.page] = List; if (OnMarketItemUpdate != null && targetPage == (int)pt.page) { OnMarketItemUpdate(); } RefreshScrollView = true; // Debug.Log("收到拍卖行数据"); } if (pt.type == 2) { //MyMarketItems.Clear(); List <MarketItemInfo> List = new List <MarketItemInfo>(); for (int i = 0; i < pt.shelve_item_list.Count; i++) { MarketItemInfo info = new MarketItemInfo(pt.shelve_item_list[i]); List.Add(info); } MyMarketItems[(int)pt.page] = List; if (OnMyMarketItemUpdate != null && targetPage == marketPage) { OnMyMarketItemUpdate(); } RefreshScrollView = true; // Debug.Log("收到我的拍卖行数据"); } } // Debug.Log("收到数据后页数为" + marketPage); }
/// <summary> /// 填充数据 /// </summary> /// <param name="_info"></param> public void FillInfo(MarketItemInfo _info) { if (_info == null) { marketItemInfo = null; return; } else { marketItemInfo = _info; } RefreshMarketItem(); }
public static void AddSteamPrices(ref DataGridView data) { for (int i = 0; i < data.RowCount; i++) { MarketItemInfo marketInfo = Info.GetMarketItemInfo(csgoItemInfo + data.Rows[i].Cells["classid"].Value + "_" + data.Rows[i].Cells["instanceid"].Value + "/ru/?key=" + keyMarket); SteamApiItemCS steamInfo = Info.GetApiItemCS(csgobackpacknet + marketInfo.market_hash_name + "&time=7&icon=1");//Info.GetSteamApiItem(@"http://api.csgo.steamlytics.xyz/v1/prices/" + marketInfo.market_hash_name + "?key=8754a7606d6b00db0cc9ce1dee003256"); data.Rows[i].Cells["average_price"].Value = steamInfo.average_price; data.Rows[i].Cells["median_price"].Value = steamInfo.median_price; data.Rows[i].Cells["highest_price"].Value = steamInfo.highest_price; data.Rows[i].Cells["lowest_price"].Value = steamInfo.lowest_price; //data.Rows[i].Cells["hash"].Value = marketInfo.hash; // Thread.Sleep(10500); } }
void statisticOld() { popularSteamItems = SetSteamPopularData(0); List <JsonResult> history = Info.GetUrlJSONlist(csgo_history); history.Distinct(); dataGridViewStatisticMarket.DataSource = history; List <string> columnsNames = new List <string>() { "average_price", "median_price", "highest_price", "lowest_price", "hash", "rank" }; FormsLogic.AddColumns(ref dataGridViewStatisticMarket, columnsNames); for (int i = 0; i < dataGridViewStatisticMarket.RowCount; i++) { MarketItemInfo marketInfo = Info.GetMarketItemInfo(csgo_itemInfo + dataGridViewStatisticMarket.Rows[i].Cells["classid"].Value + "_" + dataGridViewStatisticMarket.Rows[i].Cells["instanceid"].Value + "/ru/?key=" + keyMarket); foreach (SteamPopularItem item in popularSteamItems) { if (item.market_hash_name == marketInfo.market_hash_name) { dataGridViewStatisticMarket.Rows[i].Cells["rank"].Value = item.rank.ToString(); } } //if (name.Contains("™") || name.Contains("★")) // name = Regex.Replace(name, "[^\x0d\x0a\x20-\x7e\t]", ""); //if (name.Contains("StatTrak")) // name = Regex.Replace(name, "StatTrak", ""); // SteamApiItemCS steamInfo = Info.GetApiItemCS(@"http://csgobackpack.net/api/GetItemPrice/?currency=RUB&id=" + marketInfo.market_hash_name + "&time=7&icon=1");//Info.GetSteamApiItem(@"http://api.csgo.steamlytics.xyz/v1/prices/" + marketInfo.market_hash_name + "?key=8754a7606d6b00db0cc9ce1dee003256"); //dataGridViewStatisticMarket.Rows[i].Cells["average_price"].Value = steamInfo.average_price; //dataGridViewStatisticMarket.Rows[i].Cells["median_price"].Value = steamInfo.median_price; //dataGridViewStatisticMarket.Rows[i].Cells["highest_price"].Value = steamInfo.highest_price; //dataGridViewStatisticMarket.Rows[i].Cells["lowest_price"].Value = steamInfo.lowest_price; dataGridViewStatisticMarket.Rows[i].Cells["hash"].Value = marketInfo.hash; // Thread.Sleep(10500); } }
public static void Cache(int appid, string hashName, MarketItemInfo info) { Get()[$"{appid}-{hashName}"] = info; UpdateAll(); }
IEnumerator WaitToDisplay(int promptID, int itemID, ActivateItemsLeafs aiLeaf, ActivateBonusAbility aiBonus, ActivateItemsMasks aiMask, bool bought, bool touched) { while (displaying) { yield return(null); } if (inPromptTrigger[promptID] == true) { displaying = true; animator.ResetTrigger("nextState"); if (tpc == null) { tpc = PlayerManager.GetMainPlayer(); camF = tpc.cam.GetComponent <CameraFollower>(); } tpc.inShop = true; // Time.timeScale = 0f; // tpc.inCutscene = true; // tpc.disableControl = true; // tpc.rb.isKinematic = true; // camF.disableControl = true; yesText.fontSize = 40; promptTitle.fontSize = 300; promptInfo.fontSize = 300; promptTitle.text = TextTranslationManager.GetText(TextTranslationManager.TextCollection.itemPrompts, (promptID * 2) + 4, PlayerPrefs.GetInt("Language")); if (promptID == 6 && PlayerPrefs.GetInt("Language") == 9) { promptTitle.fontSize = 200; } else { promptTitle.fontSize = (int)Mathf.Lerp(300, 150, Mathf.Clamp01((promptTitle.text.Length - 14) / 5f)); } promptInfo.text = TextTranslationManager.GetText(TextTranslationManager.TextCollection.itemPrompts, (promptID * 2) + 5, PlayerPrefs.GetInt("Language")); if (PlayerPrefs.GetInt("Language") == 1) { promptInfo.fontSize = 280; } else { promptInfo.fontSize = 300; } if (PlayerPrefs.GetInt("Language") == 11) { promptInfo.alignment = TextAnchor.MiddleRight; if (promptInfo.lineSpacing > 0f) { promptInfo.lineSpacing *= -1f; } } else { promptInfo.alignment = TextAnchor.MiddleLeft; if (promptInfo.lineSpacing < 0f) { promptInfo.lineSpacing *= -1f; } } promptIcon.sprite = itemPrompts[promptID].icon; if (bought) { if (touched) { yesText.text = TextTranslationManager.GetText(TextTranslationManager.TextCollection.itemPrompts, 53, PlayerPrefs.GetInt("Language")); if (PlayerPrefs.GetInt("Language") == 8) { yesText.fontSize = 35; } else { yesText.fontSize = 40; } curYestText = YesText.unequip; } else { yesText.text = TextTranslationManager.GetText(TextTranslationManager.TextCollection.itemPrompts, 52, PlayerPrefs.GetInt("Language")); curYestText = YesText.equip; } noText.text = TextTranslationManager.GetText(TextTranslationManager.TextCollection.itemPrompts, 54, PlayerPrefs.GetInt("Language")); } else { yesText.text = TextTranslationManager.GetText(TextTranslationManager.TextCollection.itemPrompts, 50, PlayerPrefs.GetInt("Language")); noText.text = TextTranslationManager.GetText(TextTranslationManager.TextCollection.itemPrompts, 51, PlayerPrefs.GetInt("Language")); curYestText = YesText.buy; } if (aiLeaf == null && aiBonus == null && aiMask == null) { yesText.text = TextTranslationManager.GetText(TextTranslationManager.TextCollection.startMenu, 1, PlayerPrefs.GetInt("Language")); if (PlayerPrefs.GetInt("Language") == 1) { yesText.fontSize = 35; } else { yesText.fontSize = 40; } curYestText = YesText.cont; noText.transform.parent.gameObject.SetActive(false); priceText.transform.parent.parent.gameObject.SetActive(false); animator.SetBool("isCollectable", true); } else { if (!noText.transform.parent.gameObject.activeInHierarchy) { noText.transform.parent.gameObject.SetActive(true); } animator.SetBool("isCollectable", false); } aiLeafs = aiLeaf; aiBonuses = aiBonus; aiMasks = aiMask; foreach (MarketItemInfo mi in marketItems) { if (mi.itemID == itemID) { currentMI = mi; } } if (curYestText != YesText.cont && currentMI != null) { if (!bought) { priceText.transform.parent.parent.gameObject.SetActive(true); if (currentMI.useBlueBerries) { tpc.blueberryText.text = tpc.blueberryCount.ToString(); tpc.blueberryHUD.SetBool("function", true); priceIcon.sprite = blueBerry; } else { tpc.berryText.text = tpc.berryCount.ToString(); tpc.berryHUD.SetBool("function", true); priceIcon.sprite = redBerry; } if (currentMI.price == -1) { priceText.text = TextTranslationManager.GetText(TextTranslationManager.TextCollection.itemPrompts, 3, PlayerPrefs.GetInt("Language")); } else { priceText.text = currentMI.price.ToString(); } } else { priceText.transform.parent.parent.gameObject.SetActive(false); } } if (PlayerPrefs.GetInt("Language") == 11) { promptTitle.font = TextTranslationManager.singleton.arabicFont; promptInfo.font = TextTranslationManager.singleton.arabicFont; yesText.font = TextTranslationManager.singleton.arabicFont; noText.font = TextTranslationManager.singleton.arabicFont; priceText.font = TextTranslationManager.singleton.arabicFont; promptTitle.fontStyle = FontStyle.Bold; promptInfo.fontStyle = FontStyle.Bold; yesText.fontStyle = FontStyle.Bold; noText.fontStyle = FontStyle.Bold; priceText.fontStyle = FontStyle.Bold; } else if (PlayerPrefs.GetInt("Language") == (int)LANGUAGES.Russian) { promptTitle.font = TextTranslationManager.singleton.cyrillicFont; promptInfo.font = TextTranslationManager.singleton.cyrillicFont; yesText.font = TextTranslationManager.singleton.cyrillicFont; noText.font = TextTranslationManager.singleton.cyrillicFont; priceText.font = TextTranslationManager.singleton.cyrillicFont; promptTitle.fontStyle = FontStyle.Bold; promptInfo.fontStyle = FontStyle.Bold; yesText.fontStyle = FontStyle.Bold; noText.fontStyle = FontStyle.Bold; priceText.fontStyle = FontStyle.Bold; } else if (PlayerPrefs.GetInt("Language") == (int)LANGUAGES.Korean) { promptTitle.font = TextTranslationManager.singleton.koreanFont; promptInfo.font = TextTranslationManager.singleton.koreanFont; yesText.font = TextTranslationManager.singleton.koreanFont; noText.font = TextTranslationManager.singleton.koreanFont; priceText.font = TextTranslationManager.singleton.koreanFont; promptTitle.fontStyle = FontStyle.Bold; promptInfo.fontStyle = FontStyle.Bold; yesText.fontStyle = FontStyle.Bold; noText.fontStyle = FontStyle.Bold; priceText.fontStyle = FontStyle.Bold; } else if (PlayerPrefs.GetInt("Language") == (int)LANGUAGES.Chinese) { promptTitle.font = TextTranslationManager.singleton.chineseFont; promptInfo.font = TextTranslationManager.singleton.chineseFont; yesText.font = TextTranslationManager.singleton.chineseFont; noText.font = TextTranslationManager.singleton.chineseFont; priceText.font = TextTranslationManager.singleton.chineseFont; promptTitle.fontStyle = FontStyle.Bold; promptInfo.fontStyle = FontStyle.Bold; yesText.fontStyle = FontStyle.Bold; noText.fontStyle = FontStyle.Bold; priceText.fontStyle = FontStyle.Bold; } else if (PlayerPrefs.GetInt("Language") == (int)LANGUAGES.Japanese) { promptTitle.font = TextTranslationManager.singleton.japaneseFont; promptInfo.font = TextTranslationManager.singleton.japaneseFont; yesText.font = TextTranslationManager.singleton.japaneseFont; noText.font = TextTranslationManager.singleton.japaneseFont; priceText.font = TextTranslationManager.singleton.japaneseFont; promptTitle.fontStyle = FontStyle.Bold; promptInfo.fontStyle = FontStyle.Bold; yesText.fontStyle = FontStyle.Bold; noText.fontStyle = FontStyle.Bold; priceText.fontStyle = FontStyle.Bold; } else { promptTitle.font = titleFont; promptInfo.font = infoFont; yesText.font = yesFont; noText.font = noFont; priceText.font = priceFont; promptTitle.fontStyle = titleFontStyle; promptInfo.fontStyle = infoFontStyle; yesText.fontStyle = yesFontStyle; noText.fontStyle = noFontStyle; priceText.fontStyle = priceFontStyle; } PlaySound(openPromptClip); animator.SetBool("promptOn", true); } }