| | |
| | | {
|
| | |
|
| | | #region Built-in |
| | | [SerializeField] ScrollerController m_ScrollerController;
|
| | | [SerializeField] ScrollerController m_ScrollerControllerJob;
|
| | | [SerializeField] ScrollerController m_ScrollerControllerType;
|
| | | [SerializeField] ScrollerController m_ScrollerControllerItem;
|
| | | [SerializeField] GameObject m_JobTip;
|
| | | [SerializeField] GameObject m_TypeTip;
|
| | | [SerializeField] Button m_JobTipBtn;
|
| | | [SerializeField] Button m_TypeTipBtn;
|
| | | [SerializeField] Text m_JobTipText;
|
| | | [SerializeField] Text m_TypeTipText;
|
| | | [SerializeField] ScrollerController m_ClassifyController;
|
| | | [SerializeField] AuctionChildClassifyBehaviour[] m_ChildClassifys;
|
| | | [SerializeField] ScrollerController m_ChildClassifyController;
|
| | | [SerializeField] Transform m_ContainerChildClassify;
|
| | | [SerializeField] Transform[] m_ChildClassifyPositions;
|
| | | [SerializeField] ScrollerController m_AuctionController;
|
| | |
|
| | | List<string> itemGuids = new List<string>();//全服拍品列表
|
| | |
|
| | |
| | |
|
| | | protected override void BindController() |
| | | {
|
| | | m_ScrollerController.OnRefreshCell += OnRefreshGridCell; |
| | | m_ScrollerControllerJob.OnRefreshCell += OnRefreshGridCellJob;
|
| | | m_ScrollerControllerType.OnRefreshCell += OnRefreshGridCellType; |
| | | m_ScrollerControllerItem.OnRefreshCell += OnRefreshGridCellItem;
|
| | | m_ScrollerControllerItem.lockType = EnhanceLockType.KeepVertical;
|
| | | m_ClassifyController.OnRefreshCell += OnRefreshClassifyCell; |
| | | |
| | | m_ChildClassifyController.OnRefreshCell += OnRefreshChildClassifyCell;
|
| | | m_AuctionController.OnRefreshCell += OnRefreshGridCellItem;
|
| | | m_AuctionController.lockType = EnhanceLockType.KeepVertical;
|
| | | } |
| | | |
| | | protected override void AddListeners() |
| | | { |
| | | m_JobTipBtn.AddListener(OnClickJobTipBtn); |
| | | m_TypeTipBtn.AddListener(OnClickTypeTipBtn); |
| | | } |
| | | |
| | | protected override void OnPreOpen() |
| | | {
|
| | | model.isAuctionWindowOpen = false;
|
| | |
|
| | | model.selectClassifyId = 0;
|
| | | model.childClassifyIndex = Int2.zero;
|
| | | queryDirty = false;
|
| | |
|
| | | GlobalTimeEvent.Instance.secondEvent += PerSecond; |
| | | model.serverAuctionRefresh += FullServiceAuctionUpdate;//数据请求刷新 |
| | | model.auctionItemRefresh += RefreshAuctionItemUpdate;//刷新 |
| | | model.onAuctionRemove += ClearAuctionUpdate;//清除 |
| | | model.myBiddingAuctionRefresh += BiddingItemInfoUpdate;//竞价物品信息刷新 |
| | | m_ScrollerControllerItem.onValueChange += OnValueChange;
|
| | | model.myBiddingAuctionRefresh += BiddingItemInfoUpdate;//竞价物品信息刷新 |
| | | model.selectClassifyRefresh += SelectClassifyRefresh; |
| | | m_AuctionController.onValueChange += OnValueChange;
|
| | |
|
| | | CloseChildClassify();
|
| | | |
| | | ResetServerAuctionInquiry(); |
| | | ResetServerAuctionInquiry();
|
| | |
|
| | | OnCreateGridLineCell(m_ScrollerController); |
| | | OnCreateGridLineCellJob(m_ScrollerControllerJob); |
| | | OnCreateGridLineCellType(m_ScrollerControllerType);
|
| | | OnCreateGridLineCellItem(m_ScrollerControllerItem);
|
| | | Display();
|
| | |
|
| | | var index = itemGuids.IndexOf(model.locationGuid);
|
| | | if (index != -1)
|
| | | {
|
| | | m_ScrollerControllerItem.JumpIndex(index);
|
| | | m_AuctionController.JumpIndex(index);
|
| | | }
|
| | |
|
| | | model.isLocationQuery = false;
|
| | | model.locationGuid = string.Empty;
|
| | | |
| | | SetTipText(); |
| | | } |
| | | |
| | | RefreshChildClassify(); |
| | | }
|
| | |
|
| | | protected override void OnActived()
|
| | | {
|
| | | base.OnActived();
|
| | |
| | | model.onAuctionRemove -= ClearAuctionUpdate;
|
| | | model.myBiddingAuctionRefresh -= BiddingItemInfoUpdate;//竞价物品信息刷新
|
| | | GlobalTimeEvent.Instance.secondEvent -= PerSecond;
|
| | | m_ScrollerControllerItem.onValueChange -= OnValueChange; |
| | | m_AuctionController.onValueChange -= OnValueChange;
|
| | | model.selectClassifyRefresh -= SelectClassifyRefresh; |
| | | |
| | | StopAllCoroutines(); |
| | | }
|
| | |
|
| | | protected override void OnAfterClose() |
| | | { |
| | | }
|
| | | #endregion |
| | | |
| | | void Display()
|
| | | {
|
| | | DisplayClassifies();
|
| | | DisplayAuctionItems();
|
| | | } |
| | | |
| | | void DisplayClassifies()
|
| | | {
|
| | | var configs = AuctionConfig.GetValues();
|
| | | m_ClassifyController.Refresh();
|
| | | foreach (var config in configs)
|
| | | {
|
| | | m_ClassifyController.AddCell(ScrollerDataType.Header, config.Id);
|
| | | }
|
| | | m_ClassifyController.Restart();
|
| | | } |
| | | |
| | | private void SelectClassifyRefresh()
|
| | | {
|
| | | model.childClassifyIndex = Int2.zero;
|
| | |
|
| | | CloseChildClassify();
|
| | | RefreshChildClassify();
|
| | |
|
| | | m_ClassifyController.m_Scorller.RefreshActiveCellViews();
|
| | | queryDirty = true;
|
| | | }
|
| | |
|
| | | IEnumerator Co_Open()
|
| | |
| | | {
|
| | | if (model.SatisfyQueryAuction(2))
|
| | | {
|
| | | var inquiryIndex = AuctionInquiry.Instance.GetInquiryIndex();
|
| | | var inquiryIndex = model.GetQueryIndex();
|
| | | if (itemGuids.Count > 0)
|
| | | {
|
| | | model.SendInquiryServerAcution(inquiryIndex, itemGuids[0], 2);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose() |
| | | { |
| | | }
|
| | | #endregion |
| | | } |
| | | |
| | | private void PerSecond()
|
| | | {
|
| | |
| | | |
| | | private void FullServiceAuctionUpdate()
|
| | | {
|
| | | OnCreateGridLineCellItem(m_ScrollerControllerItem);
|
| | | DisplayAuctionItems();
|
| | | } |
| | | |
| | | private void RefreshAuctionItemUpdate()
|
| | | {
|
| | | m_ScrollerControllerItem.m_Scorller.RefreshActiveCellViews();//刷新可见
|
| | | m_AuctionController.m_Scorller.RefreshActiveCellViews();//刷新可见
|
| | | }
|
| | |
|
| | | private void ClearAuctionUpdate()
|
| | | {
|
| | | OnCreateGridLineCellItem(m_ScrollerControllerItem);
|
| | | DisplayAuctionItems();
|
| | | } |
| | | |
| | | private void BiddingItemInfoUpdate()
|
| | | {
|
| | | OnCreateGridLineCellItem(m_ScrollerControllerItem);
|
| | | DisplayAuctionItems();
|
| | | } |
| | | |
| | | private void OnClickJobTipBtn()
|
| | | private void OnRefreshClassifyCell(ScrollerDataType type, CellView cell)
|
| | | {
|
| | | m_JobTip.SetActive(true);
|
| | | var classifyCell = cell as ServerAuctionClassifyCell;
|
| | | classifyCell.Display(cell.index);
|
| | | } |
| | | |
| | | private void OnClickTypeTipBtn()
|
| | | {
|
| | | m_TypeTip.SetActive(true);
|
| | | } |
| | | private void OnCreateGridLineCell(ScrollerController gridCtrl)
|
| | | {
|
| | |
|
| | | gridCtrl.Refresh();
|
| | | for (int i = 0; i < auctionHelpModel.FullServiceAuctionList.Count; i++)
|
| | | {
|
| | | gridCtrl.AddCell(ScrollerDataType.Header, i);
|
| | | }
|
| | | gridCtrl.Restart();
|
| | | } |
| | | private void OnRefreshGridCell(ScrollerDataType type, CellView cell)
|
| | | private void OnRefreshChildClassifyCell(ScrollerDataType type, CellView cell)
|
| | | {
|
| | | var index = cell.index;
|
| | | if (index >= auctionHelpModel.FullServiceAuctionList.Count)
|
| | | var classifyId = model.selectClassifyId;
|
| | | var config = AuctionConfig.Get(classifyId);
|
| | |
|
| | | var index = cell.index / 100;
|
| | | var classifyIndex = cell.index % 100;
|
| | |
|
| | | if (config != null)
|
| | | {
|
| | | 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)
|
| | | var classifyNameArray = index == 0 ? config.ChooseItemName1 : config.ChooseItemName2;
|
| | |
|
| | | Text textName = cell.transform.Find("Text").GetComponent<Text>();
|
| | | Button button = cell.GetComponent<Button>();
|
| | |
|
| | | textName.text = classifyNameArray[classifyIndex];
|
| | |
|
| | | button.SetListener(() =>
|
| | | {
|
| | | CloseChildClassify();
|
| | | auctionHelpModel.SelectedGenreNow = fullServiceAuction.Id;
|
| | | queryDirty = true;
|
| | | 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.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();
|
| | | }
|
| | | var currentClassifyIndex = index == 0 ? model.childClassifyIndex.x : model.childClassifyIndex.y;
|
| | |
|
| | | }
|
| | | }
|
| | | private void OnRefreshGridCellJob(ScrollerDataType type, CellView cell)
|
| | | {
|
| | | var index = cell.index;
|
| | | var selectedGenreNow = auctionHelpModel.SelectedGenreNow;
|
| | | if (auctionHelpModel.FullServiceAuctionDic.ContainsKey(selectedGenreNow))
|
| | | {
|
| | | var config = auctionHelpModel.FullServiceAuctionDic[selectedGenreNow];
|
| | | Text textName = cell.transform.Find("Text").GetComponent<Text>();
|
| | | Button button = cell.GetComponent<Button>();
|
| | | textName.text = config.Config.ChooseItemName1[index];
|
| | | button.SetListener(() =>
|
| | | {
|
| | | m_JobTip.SetActive(false);
|
| | | if (index != config.JobEntry)
|
| | | if (classifyIndex != currentClassifyIndex)
|
| | | {
|
| | | auctionHelpModel.FullServiceAuctionDic[selectedGenreNow].JobEntry = index;
|
| | | if (index == 0)
|
| | | {
|
| | | model.childClassifyIndex.x = classifyIndex;
|
| | | }
|
| | | else
|
| | | {
|
| | | model.childClassifyIndex.y = classifyIndex;
|
| | | }
|
| | |
|
| | | queryDirty = true;
|
| | | SetTipText();
|
| | | RefreshChildClassify();
|
| | | }
|
| | | });
|
| | | }
|
| | | } |
| | | |
| | | private void OnCreateGridLineCellType(ScrollerController gridCtrl)
|
| | | public void DisplayChildClassify(int index)
|
| | | {
|
| | | var index = 0;
|
| | | index = auctionHelpModel.FullServiceAuctionList.FindIndex((x) =>
|
| | | var config = AuctionConfig.Get(model.selectClassifyId);
|
| | |
|
| | | var position = m_ChildClassifyPositions[0].localPosition;
|
| | |
|
| | | if (index == 1)
|
| | | {
|
| | | 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();
|
| | | }
|
| | | position = config.ChooseItem1 == null || config.ChooseItem1.Length == 0 ?
|
| | | m_ChildClassifyPositions[0].localPosition : m_ChildClassifyPositions[1].localPosition;
|
| | | }
|
| | |
|
| | | var classifyArray = index == 0 ? config.ChooseItem1 : config.ChooseItem2;
|
| | | m_ChildClassifyController.Refresh();
|
| | | for (int i = 0; i < classifyArray.Length; i++)
|
| | | {
|
| | | m_ChildClassifyController.AddCell(ScrollerDataType.Header, index * 100 + i);
|
| | | }
|
| | | m_ChildClassifyController.Restart();
|
| | |
|
| | | m_ContainerChildClassify.localPosition = position;
|
| | | m_ContainerChildClassify.gameObject.SetActive(true);
|
| | | } |
| | | |
| | | private void OnRefreshGridCellType(ScrollerDataType type, CellView cell)
|
| | | {
|
| | | var index = cell.index;
|
| | | var selectedGenreNow = auctionHelpModel.SelectedGenreNow;
|
| | | if (auctionHelpModel.FullServiceAuctionDic.ContainsKey(selectedGenreNow))
|
| | | {
|
| | | var config = auctionHelpModel.FullServiceAuctionDic[selectedGenreNow];
|
| | | Text textName = cell.transform.Find("Text").GetComponent<Text>();
|
| | | Button button = cell.GetComponent<Button>();
|
| | | textName.text = config.Config.ChooseItemName2[index];
|
| | | button.SetListener(() =>
|
| | | {
|
| | | m_TypeTip.SetActive(false);
|
| | | if (index != config.TypeEntry)
|
| | | {
|
| | | auctionHelpModel.FullServiceAuctionDic[selectedGenreNow].TypeEntry = index;
|
| | | queryDirty = true;
|
| | | SetTipText();
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | private void OnCreateGridLineCellItem(ScrollerController gridCtrl)
|
| | | private void DisplayAuctionItems()
|
| | | {
|
| | | var firstGuid = itemGuids.Count > 0 ? itemGuids[0] : string.Empty;
|
| | |
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | gridCtrl.Refresh();
|
| | | m_AuctionController.Refresh();
|
| | | for (int i = 0; i < itemGuids.Count; i++)
|
| | | {
|
| | | gridCtrl.AddCell(ScrollerDataType.Header, i);
|
| | | m_AuctionController.AddCell(ScrollerDataType.Header, i);
|
| | | }
|
| | | gridCtrl.Restart();
|
| | | m_AuctionController.Restart();
|
| | |
|
| | | if (jumpIndex != -1)
|
| | | {
|
| | | gridCtrl.JumpIndex(jumpIndex);
|
| | | m_AuctionController.JumpIndex(jumpIndex);
|
| | | }
|
| | |
|
| | |
|
| | |
| | | model.ResetServerAuctionInquiry();
|
| | | if (!model.isLocationQuery)
|
| | | {
|
| | | var inquiryIndex = AuctionInquiry.Instance.GetInquiryIndex();
|
| | | var inquiryIndex = model.GetQueryIndex();
|
| | | model.SendInquiryServerAcution(inquiryIndex, string.Empty, 1);
|
| | | }
|
| | | } |
| | | |
| | | private void CloseChildClassify()
|
| | | {
|
| | | m_JobTip.SetActive(false);
|
| | | m_TypeTip.SetActive(false);
|
| | | m_ContainerChildClassify.gameObject.SetActive(false);
|
| | | } |
| | | |
| | | private void SetTipText()
|
| | | private void RefreshChildClassify()
|
| | | {
|
| | | var selectedGenreNow = auctionHelpModel.SelectedGenreNow;
|
| | | if (auctionHelpModel.FullServiceAuctionDic.ContainsKey(selectedGenreNow))
|
| | | var classifyId = model.selectClassifyId;
|
| | | var config = AuctionConfig.Get(classifyId);
|
| | | for (int i = 0; i < m_ChildClassifys.Length; i++)
|
| | | {
|
| | | var config = auctionHelpModel.FullServiceAuctionDic[selectedGenreNow];
|
| | | m_JobTipBtn.gameObject.SetActive(config.JobTipBool);
|
| | | if (config.JobTipBool)
|
| | | var classifyIds = i == 0 ? config.ChooseItem1 : config.ChooseItem2;
|
| | | if (classifyIds == null || classifyIds.Length == 0)
|
| | | {
|
| | | m_JobTipText.text = config.Config.ChooseItemName1[config.JobEntry];
|
| | | m_ChildClassifys[i].gameObject.SetActive(false);
|
| | | }
|
| | | m_TypeTipBtn.gameObject.SetActive(config.TypeTipBool);
|
| | | if (config.TypeTipBool)
|
| | | else
|
| | | {
|
| | | m_TypeTipText.text = config.Config.ChooseItemName2[config.TypeEntry];
|
| | | m_ChildClassifys[i].gameObject.SetActive(true);
|
| | | m_ChildClassifys[i].Display(this, i);
|
| | | }
|
| | | }
|
| | | } |
| | | |
| | | private void PushMyBiddingItems()
|
| | | {
|
| | | var index = AuctionInquiry.Instance.GetInquiryIndex();
|
| | | var index = model.GetQueryIndex();
|
| | |
|
| | | var myBiddingItems = model.GetMyBiddingAuctionItems();
|
| | | foreach (var guid in myBiddingItems)
|