84 lines
2.2 KiB
C#
84 lines
2.2 KiB
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using GCGame.Table;
|
|||
|
using System.Text;
|
|||
|
|
|||
|
public class WCBookMenuItem : UIItemBase {
|
|||
|
|
|||
|
public GameObject _CanBook;
|
|||
|
public GameObject _OverTimeBook;
|
|||
|
public GameObject _HasBooked;
|
|||
|
public GameObject _HaveWorked;
|
|||
|
public GameObject _SelfBooked;
|
|||
|
|
|||
|
public List<Text> _TimeDesc;
|
|||
|
public GameObject _Mark;
|
|||
|
public int _MenuItemId = -1;
|
|||
|
public override void Show(Hashtable hash)
|
|||
|
{
|
|||
|
base.Show(hash);
|
|||
|
|
|||
|
_MenuItemId = (int)hash["InitObj"];
|
|||
|
var tab = TableManager.GetWeddingCarBookByID(_MenuItemId, 0);
|
|||
|
if (tab == null)
|
|||
|
{
|
|||
|
Debug.LogError("GetWeddingCarBookByID is null : " + _MenuItemId);
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
StringBuilder str = new StringBuilder();
|
|||
|
str.Append(tab.BookTimeStart.Substring(0, 2));
|
|||
|
str.Append(":");
|
|||
|
str.Append(tab.BookTimeStart.Substring(2, 2));
|
|||
|
str.Append("--");
|
|||
|
str.Append(tab.BookTimeEnd.Substring(0, 2));
|
|||
|
str.Append(":");
|
|||
|
str.Append(tab.BookTimeEnd.Substring(2, 2));
|
|||
|
|
|||
|
for (int index = 0; index < _TimeDesc.Count; index++)
|
|||
|
_TimeDesc[index].text = str.ToString();
|
|||
|
}
|
|||
|
|
|||
|
private int _CurItemState = -1;
|
|||
|
public void RefreshState(int state)
|
|||
|
{
|
|||
|
_CurItemState = state;
|
|||
|
|
|||
|
if (_MenuItemId == WCBookPanel.Instance._SelfBookNodeId)
|
|||
|
{
|
|||
|
_SelfBooked.SetActive(true);
|
|||
|
|
|||
|
_CanBook.SetActive(false);
|
|||
|
_HasBooked.SetActive(false);
|
|||
|
_OverTimeBook.SetActive(false);
|
|||
|
_HaveWorked.SetActive(false);
|
|||
|
return;
|
|||
|
} else
|
|||
|
{
|
|||
|
_SelfBooked.SetActive(false);
|
|||
|
|
|||
|
_CanBook.SetActive(state == 0);
|
|||
|
_HasBooked.SetActive(state == 1);
|
|||
|
_OverTimeBook.SetActive(state == 2);
|
|||
|
_HaveWorked.SetActive(state == 3);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public override void OnItemClick()
|
|||
|
{
|
|||
|
if (_CurItemState == 2 || _CurItemState == 3)
|
|||
|
return;
|
|||
|
|
|||
|
base.OnItemClick();
|
|||
|
if (WCBookPanel.Instance)
|
|||
|
WCBookPanel.Instance.OnMenuItemClick(_MenuItemId);
|
|||
|
}
|
|||
|
|
|||
|
public void ShowMark(bool isShow)
|
|||
|
{
|
|||
|
_Mark.gameObject.SetActive(isShow);
|
|||
|
}
|
|||
|
}
|