| Core/GameEngine/Model/Config/AuctionIndexConfig.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Core/GameEngine/Model/Config/AuctionIndexConfig.cs.meta | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Auction/AuctionInquiry.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Auction/FullServiceAuctionWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Auction/FullServiceAuctioncell.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Utility/ConfigInitiator.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
Core/GameEngine/Model/Config/AuctionIndexConfig.cs
New file @@ -0,0 +1,221 @@ //-------------------------------------------------------- // [Author]: Fish // [ Date ]: Wednesday, March 06, 2019 //-------------------------------------------------------- using System.Collections.Generic; using System.IO; using System.Threading; using System; using UnityEngine; [XLua.LuaCallCSharp] public partial class AuctionIndexConfig { public readonly int Id; public readonly int Job; public readonly int[] ItemType; public readonly int Order; public readonly int[] SpecItemID; public AuctionIndexConfig() { } public AuctionIndexConfig(string input) { try { var tables = input.Split('\t'); int.TryParse(tables[0],out Id); int.TryParse(tables[1],out Job); string[] ItemTypeStringArray = tables[2].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); ItemType = new int[ItemTypeStringArray.Length]; for (int i=0;i<ItemTypeStringArray.Length;i++) { int.TryParse(ItemTypeStringArray[i],out ItemType[i]); } int.TryParse(tables[3],out Order); string[] SpecItemIDStringArray = tables[4].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); SpecItemID = new int[SpecItemIDStringArray.Length]; for (int i=0;i<SpecItemIDStringArray.Length;i++) { int.TryParse(SpecItemIDStringArray[i],out SpecItemID[i]); } } catch (Exception ex) { DebugEx.Log(ex); } } static Dictionary<string, AuctionIndexConfig> configs = new Dictionary<string, AuctionIndexConfig>(); public static AuctionIndexConfig Get(string id) { if (!inited) { Debug.Log("AuctionIndexConfig 还未完成初始化。"); return null; } if (configs.ContainsKey(id)) { return configs[id]; } AuctionIndexConfig config = null; if (rawDatas.ContainsKey(id)) { config = configs[id] = new AuctionIndexConfig(rawDatas[id]); rawDatas.Remove(id); } return config; } public static AuctionIndexConfig Get(int id) { return Get(id.ToString()); } public static List<string> GetKeys() { var keys = new List<string>(); keys.AddRange(configs.Keys); keys.AddRange(rawDatas.Keys); return keys; } public static List<AuctionIndexConfig> GetValues() { var values = new List<AuctionIndexConfig>(); values.AddRange(configs.Values); var keys = new List<string>(rawDatas.Keys); foreach (var key in keys) { values.Add(Get(key)); } return values; } public static bool Has(string id) { return configs.ContainsKey(id) || rawDatas.ContainsKey(id); } public static bool Has(int id) { return Has(id.ToString()); } public static bool inited { get; private set; } protected static Dictionary<string, string> rawDatas = new Dictionary<string, string>(); public static void Init(bool sync=false) { inited = false; var path = string.Empty; if (AssetSource.refdataFromEditor) { path = ResourcesPath.CONFIG_FODLER +"/AuctionIndex.txt"; } else { path = AssetVersionUtility.GetAssetFilePath("config/AuctionIndex.txt"); } var tempConfig = new AuctionIndexConfig(); var preParse = tempConfig is IConfigPostProcess; if (sync) { var lines = File.ReadAllLines(path); if (!preParse) { rawDatas = new Dictionary<string, string>(lines.Length - 3); } for (int i = 3; i < lines.Length; i++) { try { var line = lines[i]; var index = line.IndexOf("\t"); if (index == -1) { continue; } var id = line.Substring(0, index); if (preParse) { var config = new AuctionIndexConfig(line); configs[id] = config; (config as IConfigPostProcess).OnConfigParseCompleted(); } else { rawDatas[id] = line; } } catch (System.Exception ex) { Debug.LogError(ex); } } inited = true; } else { ThreadPool.QueueUserWorkItem((object _object) => { var lines = File.ReadAllLines(path); if (!preParse) { rawDatas = new Dictionary<string, string>(lines.Length - 3); } for (int i = 3; i < lines.Length; i++) { try { var line = lines[i]; var index = line.IndexOf("\t"); if (index == -1) { continue; } var id = line.Substring(0, index); if (preParse) { var config = new AuctionIndexConfig(line); configs[id] = config; (config as IConfigPostProcess).OnConfigParseCompleted(); } else { rawDatas[id] = line; } } catch (System.Exception ex) { Debug.LogError(ex); } } inited = true; }); } } } Core/GameEngine/Model/Config/AuctionIndexConfig.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: a877df4bcbf8671419e77fc1d2852714 timeCreated: 1551856862 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/Auction/AuctionInquiry.cs
@@ -25,96 +25,38 @@ public class AuctionInquiry : Singleton<AuctionInquiry> { AuctionHelpModel auctionHelpModel { get { return ModelCenter.Instance.GetModel<AuctionHelpModel>(); } } //public void SendQueryAuction(string itemGUID,int queryDir,int queryCount=10)//拍卖行查询拍卖中的物品(物品GUID,查询方向,查询个数) //{ // var selectedGenreNow = auctionHelpModel.SelectedGenreNow; // if (!auctionHelpModel.FullServiceAuctionDic.ContainsKey(selectedGenreNow)) // { // DebugEx.LogError("查询类型失效"); // return; // } // var auctionConfig = auctionHelpModel.FullServiceAuctionDic[selectedGenreNow]; // QueryAuctionItem queryAuctionItem = new QueryAuctionItem(); // queryAuctionItem.ItemTypeList = new List<uint>(); // queryAuctionItem.SpecItemIDList = new List<uint>(); // if (auctionConfig.JobTipBool && auctionConfig.TypeTipBool) // { // queryAuctionItem.Job = auctionConfig.JobEntry; // if (auctionConfig.JobEntry == 0 && auctionConfig.TypeEntry == 0)//查询所有类型 // { // for (int i = 0; i < auctionConfig.Config.QueryType.Length; i++) // { // queryAuctionItem.ItemTypeList.Add((uint)auctionConfig.Config.QueryType[i]); // } // } // else if (auctionConfig.JobEntry != 0 && auctionConfig.TypeEntry == 0) // { // if (auctionConfig.JobEntry == 1)//全部龙魂类型 // { // for (int i = 0; i < auctionConfig.Config.QueryTypeJob1.Length; i++) // { // queryAuctionItem.ItemTypeList.Add((uint)auctionConfig.Config.QueryTypeJob1[i]); // } // } // else if (auctionConfig.JobEntry == 2)//全部灵瑶类型 // { // for (int i = 0; i < auctionConfig.Config.QueryTypeJob2.Length; i++) // { // queryAuctionItem.ItemTypeList.Add((uint)auctionConfig.Config.QueryTypeJob2[i]); // } // } // } // else if (auctionConfig.JobEntry == 0 && auctionConfig.TypeEntry != 0)//不分职业 选择某一类别 // { // var type1 = auctionConfig.Config.QueryTypeJob1[auctionConfig.TypeEntry]; // var type2 = auctionConfig.Config.QueryTypeJob2[auctionConfig.TypeEntry]; // queryAuctionItem.ItemTypeList.Add((uint)type1); // queryAuctionItem.ItemTypeList.Add((uint)type2); // } // else if (auctionConfig.JobEntry != 0 && auctionConfig.TypeEntry != 0) // { // if (auctionConfig.JobEntry == 1)//龙魂某种类型 // { // var type = auctionConfig.Config.QueryTypeJob1[auctionConfig.TypeEntry]; // queryAuctionItem.ItemTypeList.Add((uint)type); // } // else if (auctionConfig.JobEntry == 2)//灵瑶某种类型 // { // var type = auctionConfig.Config.QueryTypeJob2[auctionConfig.TypeEntry]; // queryAuctionItem.ItemTypeList.Add((uint)type); // } // } // } // else if (!auctionConfig.JobTipBool && auctionConfig.TypeTipBool) // { // queryAuctionItem.Job = 0; // if (auctionConfig.TypeEntry == 0) // { // for (int i = 0; i < auctionConfig.Config.QueryType.Length; i++) // { // queryAuctionItem.ItemTypeList.Add((uint)auctionConfig.Config.QueryType[i]); // } // } // else // { // var type = auctionConfig.Config.QueryType[auctionConfig.TypeEntry]; // queryAuctionItem.ItemTypeList.Add((uint)type); // } // } // else if (!auctionConfig.JobTipBool && !auctionConfig.TypeTipBool) // { // queryAuctionItem.Job = 0; // for (int i = 0; i < auctionConfig.Config.QueryType.Length; i++) // { // queryAuctionItem.ItemTypeList.Add((uint)auctionConfig.Config.QueryType[i]); // } // } // queryAuctionItem.FromItemGUID = itemGUID; // queryAuctionItem.QueryDir = queryDir; // queryAuctionItem.QueryCount = queryCount; // SendQueryAuctionItem(queryAuctionItem); //} public void SendQueryAuction(string itemGUID,int indexId,int queryDir, int queryCount=10)//拍卖行查询拍卖中的物品(物品GUID,查询方向,查询个数) { var auctionIndex = AuctionIndexConfig.Get(indexId); if (auctionIndex == null) { DebugEx.LogError("拍卖索引表没有查到对应的ID"); return; } QueryAuctionItem queryAuctionItem = new QueryAuctionItem(); queryAuctionItem.FromItemGUID = itemGUID; queryAuctionItem.Job = auctionIndex.Job; queryAuctionItem.ItemTypeList = new List<uint>(); if (auctionIndex.ItemType != null && auctionIndex.ItemType.Length > 0) { for (int i = 0; i < auctionIndex.ItemType.Length; i++) { queryAuctionItem.ItemTypeList.Add((uint)auctionIndex.ItemType[i]); } } queryAuctionItem.ClassLV = auctionIndex.Order; queryAuctionItem.SpecItemIDList = new List<uint>(); if (auctionIndex.SpecItemID != null && auctionIndex.SpecItemID.Length > 0) { for (int i = 0; i < auctionIndex.SpecItemID.Length; i++) { queryAuctionItem.SpecItemIDList.Add((uint)auctionIndex.SpecItemID[i]); } } queryAuctionItem.QueryDir = queryDir; queryAuctionItem.QueryCount = queryCount; SendQueryAuctionItem(queryAuctionItem); } private void SendQueryAuctionItem(QueryAuctionItem queryAuctionItem)//拍卖行查询拍卖中的物品 { CB510_tagCGQueryAuctionItem cb510 = new CB510_tagCGQueryAuctionItem(); System/Auction/FullServiceAuctionWin.cs
@@ -110,61 +110,61 @@ } private void OnRefreshGridCell(ScrollerDataType type, CellView cell) { //var index = cell.index; //if (index >= auctionHelpModel.FullServiceAuctionList.Count) //{ // return; //} //var fullServiceAuction = auctionHelpModel.FullServiceAuctionList[index]; //Text textName = cell.transform.Find("Text").GetComponent<Text>(); //GameObject selected = cell.transform.Find("Selected").gameObject; //ButtonEx button = cell.GetComponent<ButtonEx>(); //textName.text = fullServiceAuction.TypeName; //if (fullServiceAuction.Sort == auctionHelpModel.SelectedGenreNow) //{ // selected.SetActive(true); //} //else //{ // selected.SetActive(false); //} //button.SetListener(() => //{ // if (fullServiceAuction.Sort != auctionHelpModel.SelectedGenreNow) // { // CloseTip(); // auctionHelpModel.SelectedGenreNow = fullServiceAuction.Sort; // Reset(); // m_ScrollerController.m_Scorller.RefreshActiveCellViews();//刷新可见 // OnCreateGridLineCellJob(m_ScrollerControllerJob); // OnCreateGridLineCellType(m_ScrollerControllerType); // SetTipText(); // } //}); var index = cell.index; if (index >= auctionHelpModel.FullServiceAuctionList.Count) { return; } var fullServiceAuction = auctionHelpModel.FullServiceAuctionList[index]; Text textName = cell.transform.Find("Text").GetComponent<Text>(); GameObject selected = cell.transform.Find("Selected").gameObject; ButtonEx button = cell.GetComponent<ButtonEx>(); textName.text = fullServiceAuction.TypeName; if (fullServiceAuction.Id == auctionHelpModel.SelectedGenreNow) { selected.SetActive(true); } else { selected.SetActive(false); } button.SetListener(() => { if (fullServiceAuction.Id != auctionHelpModel.SelectedGenreNow) { CloseTip(); auctionHelpModel.SelectedGenreNow = fullServiceAuction.Id; Reset(); m_ScrollerController.m_Scorller.RefreshActiveCellViews();//刷新可见 OnCreateGridLineCellJob(m_ScrollerControllerJob); OnCreateGridLineCellType(m_ScrollerControllerType); SetTipText(); } }); } private void OnCreateGridLineCellJob(ScrollerController gridCtrl) { //var index = 0; //index = auctionHelpModel.FullServiceAuctionList.FindIndex((x) => //{ // return x.Sort == auctionHelpModel.SelectedGenreNow; //}); //if (index != -1) //{ // var fullServiceAuction = auctionHelpModel.FullServiceAuctionList[index]; // if (fullServiceAuction.ChooseItemName1 != null) // { // gridCtrl.Refresh(); // for (int i = 0; i < fullServiceAuction.ChooseItemName1.Length; i++) // { // gridCtrl.AddCell(ScrollerDataType.Header, i); // } // gridCtrl.Restart(); // } var index = 0; index = auctionHelpModel.FullServiceAuctionList.FindIndex((x) => { return x.Id == auctionHelpModel.SelectedGenreNow; }); if (index != -1) { var fullServiceAuction = auctionHelpModel.FullServiceAuctionList[index]; if (fullServiceAuction.ChooseItem1 != null && fullServiceAuction.ChooseItem1.Length!=0) { gridCtrl.Refresh(); for (int i = 0; i < fullServiceAuction.ChooseItem1.Length; i++) { gridCtrl.AddCell(ScrollerDataType.Header, i); } gridCtrl.Restart(); } //} } } private void OnRefreshGridCellJob(ScrollerDataType type, CellView cell) { @@ -178,11 +178,11 @@ textName.text = config.Config.ChooseItemName1[index]; button.SetListener(() => { m_JobTip.SetActive(false); if (index != config.JobEntry) { auctionHelpModel.FullServiceAuctionDic[selectedGenreNow].JobEntry = index; Reset(); m_JobTip.SetActive(false); Reset(); SetTipText(); } }); @@ -191,24 +191,24 @@ private void OnCreateGridLineCellType(ScrollerController gridCtrl) { //var index = 0; //index = auctionHelpModel.FullServiceAuctionList.FindIndex((x) => //{ // return x.Sort == auctionHelpModel.SelectedGenreNow; //}); //if (index != -1) //{ // var fullServiceAuction = auctionHelpModel.FullServiceAuctionList[index]; // if (fullServiceAuction.ChooseItemName2 != null) // { // gridCtrl.Refresh(); // for (int i = 0; i < fullServiceAuction.ChooseItemName2.Length; i++) // { // gridCtrl.AddCell(ScrollerDataType.Header, i); // } // gridCtrl.Restart(); // } //} var index = 0; index = auctionHelpModel.FullServiceAuctionList.FindIndex((x) => { return x.Id == auctionHelpModel.SelectedGenreNow; }); if (index != -1) { var fullServiceAuction = auctionHelpModel.FullServiceAuctionList[index]; if (fullServiceAuction.ChooseItem2 != null && fullServiceAuction.ChooseItem2.Length!=0) { gridCtrl.Refresh(); for (int i = 0; i < fullServiceAuction.ChooseItem2.Length; i++) { gridCtrl.AddCell(ScrollerDataType.Header, i); } gridCtrl.Restart(); } } } private void OnRefreshGridCellType(ScrollerDataType type, CellView cell) @@ -223,11 +223,11 @@ textName.text = config.Config.ChooseItemName2[index]; button.SetListener(() => { if (index != config.JobEntry) m_TypeTip.SetActive(false); if (index != config.TypeEntry) { auctionHelpModel.FullServiceAuctionDic[selectedGenreNow].TypeEntry = index; Reset(); m_TypeTip.SetActive(false); Reset(); SetTipText(); } }); @@ -251,15 +251,26 @@ private void Reset()//重置查询 { //model.FullServiceAuctionList.Clear(); //var index = auctionHelpModel.SelectedGenreNow; //if (!auctionHelpModel.FullServiceAuctionDic.ContainsKey(index)) //{ // DebugEx.LogError("数据请求包暂未发送成功"); // return; //} //var fullServiceAuction = auctionHelpModel.FullServiceAuctionDic[index]; //AuctionInquiry.Instance.SendQueryAuction(string.Empty,1); model.FullServiceAuctionList.Clear(); var index = auctionHelpModel.SelectedGenreNow; if (!auctionHelpModel.FullServiceAuctionDic.ContainsKey(index)) { DebugEx.LogError("数据请求包暂未发送成功"); return; } var fullServiceAuction = auctionHelpModel.FullServiceAuctionDic[index]; var sendNumber = 0; sendNumber += fullServiceAuction.Config.TypeId; if (fullServiceAuction.JobTipBool) { sendNumber += fullServiceAuction.Config.ChooseItem1[fullServiceAuction.JobEntry]; } if (fullServiceAuction.TypeTipBool) { sendNumber += fullServiceAuction.Config.ChooseItem2[fullServiceAuction.TypeEntry]; } DebugEx.Log(sendNumber+"查询类型"); AuctionInquiry.Instance.SendQueryAuction(string.Empty, sendNumber,1); } private void CloseTip() { System/Auction/FullServiceAuctioncell.cs
@@ -88,15 +88,47 @@ m_EquipmentScoreObj.SetActive(true); // m_Score.text } m_JadeNumber.text = fullServiceAuction.BidderPrice.ToString(); int needJade = 0; if (fullServiceAuction.BidderPrice == 0) { needJade = auctionItem.BasePrice; } else { needJade = fullServiceAuction.BidderPrice + auctionItem.BiddingAdd; } m_JadeNumber.text = needJade.ToString(); m_JadeNumber1.text = auctionItem.BuyoutPrice.ToString(); m_PriceButton.SetListener(()=> //一口价 { DebugEx.Log(auctionItem.BuyoutPrice+"一口价"); int jade = (int)PlayerDatas.Instance.baseData.diamond; string str = "是否花费" + auctionItem.BuyoutPrice + "立即拍下商品?"; ConfirmCancel.ShowPopConfirm(Language.Get("L1003"), str, (bool isOk) => { if (jade >= auctionItem.BuyoutPrice) { AuctionInquiry.Instance.SendSellAuctionItem(fullServiceAuction.ItemGUID, auctionItem.BuyoutPrice); } else { WindowCenter.Instance.Open<RechargeTipWin>(); } }); }); m_JadeNumber2.text = fullServiceAuction.BidderPrice.ToString(); m_JadeNumber2.text = needJade.ToString(); m_BiddingButton.SetListener(()=> //竞价 { int jade = (int)PlayerDatas.Instance.baseData.diamond; string str = "是否花费" + needJade + "参与竞价?"; ConfirmCancel.ShowPopConfirm(Language.Get("L1003"), str, (bool isOk) => { if (jade >= needJade) { AuctionInquiry.Instance.SendSellAuctionItem(fullServiceAuction.ItemGUID, needJade); } else { WindowCenter.Instance.Open<RechargeTipWin>(); } }); }); } private void LateUpdate() @@ -104,10 +136,8 @@ if (AuctionItem != null && FullServiceAuction != null) { var timeNow = TimeUtility.ServerNow; TimeSpan ts1 = new TimeSpan(timeNow.Ticks); TimeSpan ts2 = new TimeSpan(FullServiceAuction.Time.Ticks); TimeSpan ts3 = ts2.Subtract(ts1); int minute = int.Parse(ts3.TotalMinutes.ToString()); TimeSpan timeSpan = timeNow - FullServiceAuction.Time; int minute = (int)timeSpan.TotalMinutes; if (minute < AuctionItem.NoticeSaleMinutes)//预热中 { if (m_PriceButton.interactable) @@ -120,8 +150,10 @@ m_BiddingButton.interactable = false; m_BiddingImage.gray = true; } int seconds = AuctionItem.NoticeSaleMinutes * 60 - (int)timeSpan.TotalSeconds; m_TimeText.text = TimeUtility.SecondsToHMS(seconds) + "后开始"; } else if (minute >= AuctionItem.NoticeSaleMinutes && minute <= AuctionItem.WorldSaleMinutes)//拍卖中 else if (minute >= AuctionItem.NoticeSaleMinutes && minute <= AuctionItem.FamilySaleMinutes)//拍卖中 { if (!m_PriceButton.interactable || m_PriceImage.gray) { @@ -133,6 +165,8 @@ m_BiddingButton.interactable = true; m_BiddingImage.gray = false; } int seconds = AuctionItem.FamilySaleMinutes * 60 - ((int)timeSpan.TotalSeconds - AuctionItem.NoticeSaleMinutes * 60); m_TimeText.text = "剩余" + TimeUtility.SecondsToHMS(seconds); } } } Utility/ConfigInitiator.cs
@@ -279,7 +279,8 @@ normalTasks.Add(new ConfigInitTask("CrossRealmPKDanAwardConfig", () => { CrossRealmPKDanAwardConfig.Init(); }, () => { return CrossRealmPKDanAwardConfig.inited; })); normalTasks.Add(new ConfigInitTask("CrossServerOneVsOneRobotConfig", () => { CrossServerOneVsOneRobotConfig.Init(); }, () => { return CrossServerOneVsOneRobotConfig.inited; })); normalTasks.Add(new ConfigInitTask("AuctionConfig", () => { AuctionConfig.Init(); }, () => { return AuctionConfig.inited; })); normalTasks.Add(new ConfigInitTask("AuctionItemConfig", () => { AuctionItemConfig.Init(); }, () => { return AuctionItemConfig.inited; })); normalTasks.Add(new ConfigInitTask("AuctionItemConfig", () => { AuctionItemConfig.Init(); }, () => { return AuctionItemConfig.inited; })); normalTasks.Add(new ConfigInitTask("AuctionIndexConfig", () => { AuctionIndexConfig.Init(); }, () => { return AuctionIndexConfig.inited; })); } static List<ConfigInitTask> doingTasks = new List<ConfigInitTask>();