//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Friday, March 08, 2019
|
//--------------------------------------------------------
|
using UnityEngine;
|
using System.Collections;
|
using UnityEngine.UI;
|
using System.Collections.Generic;
|
using System;
|
|
namespace Snxxz.UI
|
{
|
|
public class MyFocusBehavior : MonoBehaviour
|
{
|
[SerializeField] GameObject m_MyFocusBehavior;
|
[SerializeField] Button m_CloseButton;
|
[SerializeField] Button m_GoButton;
|
[SerializeField] ItemCell m_ItemCell;
|
[SerializeField] Text m_ItemNameTxt;
|
AuctionInquiryModel model { get { return ModelCenter.Instance.GetModel<AuctionInquiryModel>(); } }
|
AuctionHelpModel auctionHelpModel { get { return ModelCenter.Instance.GetModel<AuctionHelpModel>(); } }
|
private List<AddAuctionItemInfoClass> MyFocusItemList = new List<AddAuctionItemInfoClass>();
|
private int ItemID = 0;
|
private string ItemGUID = string.Empty;
|
public void Init()
|
{
|
model.AddAuctionItemInfoUpdate += AddAuctionItemInfoUpdate;
|
if (!this.gameObject.activeSelf)
|
{
|
this.gameObject.SetActive(true);
|
}
|
GetMyFocusItemList();
|
}
|
public void Unit()
|
{
|
model.AddAuctionItemInfoUpdate -= AddAuctionItemInfoUpdate;
|
}
|
|
private void Start()
|
{
|
|
}
|
|
private void OnEnable()
|
{
|
|
}
|
private void AddAuctionItemInfoUpdate()
|
{
|
GetMyFocusItemList();
|
}
|
private void LateUpdate()
|
{
|
|
if (MyFocusItemList.Count <= 0 && m_MyFocusBehavior.activeSelf)
|
{
|
ItemID = 0;
|
ItemGUID = string.Empty; ;
|
m_MyFocusBehavior.SetActive(false);
|
}
|
else if (!m_MyFocusBehavior.activeSelf && MyFocusItemList.Count > 0)
|
{
|
m_MyFocusBehavior.SetActive(true);
|
var myFocusItem = MyFocusItemList[0];
|
ItemID = myFocusItem.ItemID;
|
ItemGUID = myFocusItem.ItemGUID;
|
var itemConfig = ItemConfig.Get(ItemID);
|
if (itemConfig != null)
|
{
|
ItemCellModel cellModel = new ItemCellModel(itemConfig.ID, true, (ulong)1);
|
m_ItemCell.Init(cellModel);
|
m_ItemNameTxt.text = itemConfig.ItemName;
|
}
|
}
|
}
|
private void CloseButton()
|
{
|
if (model.AddAuctionItemInfoDic.ContainsKey(ItemID))
|
{
|
model.AddAuctionItemInfoDic.Remove(ItemID);
|
GetMyFocusItemList();
|
}
|
}
|
|
private void GoButton()
|
{
|
//model.AddAuctionItemInfoDic.Clear();
|
//GetMyFocusItemList();
|
DebugEx.LogError("跳转表没加跳不过去的。。。。。。");
|
}
|
|
private void GetMyFocusItemList()
|
{
|
MyFocusItemList.Clear();
|
foreach (var value in model.AddAuctionItemInfoDic.Values)
|
{
|
if (value.Bool)
|
{
|
MyFocusItemList.Add(value);
|
}
|
}
|
}
|
}
|
|
}
|