105 lines
2.6 KiB
C#
105 lines
2.6 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using System.Collections;
|
|
using Games.Item;
|
|
using System.Collections.Generic;
|
|
using GCGame.Table;
|
|
using GCGame;
|
|
|
|
public class MarketPlayerSellLog : UIControllerBase<MarketPlayerSellLog>
|
|
{
|
|
// Use this for initialization
|
|
void OnEnable ()
|
|
{
|
|
SetInstance(this);
|
|
}
|
|
|
|
void OnDisable()
|
|
{
|
|
SetInstance(null);
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update ()
|
|
{
|
|
|
|
}
|
|
|
|
#region
|
|
|
|
public Text _TimeLabel;
|
|
public GameObject _DateSelectPanel;
|
|
public UIContainerBase _DateContainer;
|
|
public UIContainerBase _SellLogContainer;
|
|
|
|
private System.DateTime _SelectedDate;
|
|
|
|
public void InitSellLog()
|
|
{
|
|
_SelectedDate = System.DateTime.Today;
|
|
|
|
_TimeLabel.text = string.Format("{0:yyyy-MM-dd}", _SelectedDate);
|
|
|
|
OnHideDatePanel();
|
|
ShowLogByDate();
|
|
}
|
|
|
|
public void OnShowDatePanel()
|
|
{
|
|
_DateSelectPanel.SetActive(true);
|
|
|
|
List<System.DateTime> logDates = new List<System.DateTime>();
|
|
for (int i = 0; i < 5; ++i)
|
|
{
|
|
System.DateTime date = System.DateTime.Today;
|
|
System.TimeSpan timeSpan = new System.TimeSpan(i, 0, 0, 0);
|
|
date-= timeSpan;
|
|
logDates.Add(date);
|
|
}
|
|
_DateContainer.InitContentItem(logDates, OnSelectDate);
|
|
}
|
|
|
|
public void OnHideDatePanel()
|
|
{
|
|
_DateSelectPanel.SetActive(false);
|
|
}
|
|
|
|
public void OnSelectDate(object selectObj)
|
|
{
|
|
System.DateTime date = (System.DateTime)selectObj;
|
|
if (date == null)
|
|
return;
|
|
|
|
_SelectedDate = date;
|
|
_TimeLabel.text = string.Format("{0:yyyy-MM-dd}", _SelectedDate);
|
|
OnHideDatePanel();
|
|
ShowLogByDate();
|
|
}
|
|
|
|
public void ShowLogByDate()
|
|
{
|
|
CG_ASK_USER_SHOP_SELL_ITEM_INFO packet = (CG_ASK_USER_SHOP_SELL_ITEM_INFO)PacketDistributed.CreatePacket(MessageID.PACKET_CG_ASK_USER_SHOP_SELL_ITEM_INFO);
|
|
packet.Time = Utils.DateTimeToServerTime(_SelectedDate);
|
|
packet.SendPacket();
|
|
|
|
}
|
|
|
|
public void UpdateDateLog(GC_RET_USER_SHOP_SELL_ITEM_INFO packet)
|
|
{
|
|
List<MarketPlayerSellLogItemInfo> sellLogs = new List<MarketPlayerSellLogItemInfo>();
|
|
for (int i = 0; i < packet.sellItemCount; ++i)
|
|
{
|
|
MarketPlayerSellLogItemInfo logInfo = new MarketPlayerSellLogItemInfo();
|
|
logInfo.ItemDataID = packet.GetSellItem(i).DataId;
|
|
logInfo.ItemCnt = packet.GetSellItem(i).ItemNum;
|
|
logInfo.SellMoney = packet.GetSellItem(i).ItemMoney;
|
|
sellLogs.Add(logInfo);
|
|
}
|
|
|
|
_SellLogContainer.InitContentItem(sellLogs);
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|