118 lines
3.9 KiB
C#
118 lines
3.9 KiB
C#
|
using UnityEngine;
|
|||
|
using System.Collections;
|
|||
|
using UnityEngine.UI;
|
|||
|
using System.Collections.Generic;
|
|||
|
using GCGame.Table;
|
|||
|
using System;
|
|||
|
using UnityEngine.Events;
|
|||
|
|
|||
|
// 进阶系统右侧菜单控制
|
|||
|
public class AdvanceMenuItemPanelCtr : MonoBehaviour {
|
|||
|
|
|||
|
public static AdvanceMenuItemPanelCtr Instance;
|
|||
|
private void Awake()
|
|||
|
{
|
|||
|
Instance = this;
|
|||
|
}
|
|||
|
|
|||
|
private void OnDestroy()
|
|||
|
{
|
|||
|
Instance = null;
|
|||
|
}
|
|||
|
|
|||
|
public enum MenuItemOptType
|
|||
|
{
|
|||
|
Invalid = -1,
|
|||
|
Show = 0, // 显示
|
|||
|
Advance, // 进阶
|
|||
|
Fashion // 幻化
|
|||
|
}
|
|||
|
|
|||
|
// 貌似没用 ???
|
|||
|
public enum AdvancePanelType
|
|||
|
{
|
|||
|
Show = 0, // 显示
|
|||
|
Advance, // 进阶
|
|||
|
Fashion // 幻化
|
|||
|
}
|
|||
|
|
|||
|
//public AdvanceBase.AdvanceType type;
|
|||
|
public List<AdvanceMenuItem> menuItemList;
|
|||
|
|
|||
|
// 初始化MenuItem描述
|
|||
|
public void IntMenuItemDesc()
|
|||
|
{
|
|||
|
switch (AdvanceMountPanelCtr.Instance.m_AdvanceType)
|
|||
|
{
|
|||
|
case AdvanceBase.AdvanceType.Ride:
|
|||
|
menuItemList[0].InitItem(StrDictionary.GetClientDictionaryString("#{42667}"), (int)AdvanceBase.AdvanceType.Ride);
|
|||
|
break;
|
|||
|
case AdvanceBase.AdvanceType.Piano:
|
|||
|
menuItemList[0].InitItem(StrDictionary.GetClientDictionaryString("#{42668}"), (int)AdvanceBase.AdvanceType.Piano);
|
|||
|
break;
|
|||
|
case AdvanceBase.AdvanceType.Wing:
|
|||
|
menuItemList[0].InitItem(StrDictionary.GetClientDictionaryString("#{42669}"), (int)AdvanceBase.AdvanceType.Wing);
|
|||
|
break;
|
|||
|
case AdvanceBase.AdvanceType.Qilinbi:
|
|||
|
menuItemList[0].InitItem(StrDictionary.GetClientDictionaryString("#{42670}"), (int)AdvanceBase.AdvanceType.Qilinbi);
|
|||
|
break;
|
|||
|
case AdvanceBase.AdvanceType.Soul:
|
|||
|
menuItemList[0].InitItem(StrDictionary.GetClientDictionaryString("#{42709}"), (int)AdvanceBase.AdvanceType.Soul);
|
|||
|
break;
|
|||
|
case AdvanceBase.AdvanceType.Mask:
|
|||
|
menuItemList[0].InitItem(StrDictionary.GetClientDictionaryString("#{42710}"), (int)AdvanceBase.AdvanceType.Mask);
|
|||
|
break;
|
|||
|
case AdvanceBase.AdvanceType.Huopao:
|
|||
|
menuItemList[0].InitItem(StrDictionary.GetClientDictionaryString("#{42711}"), (int)AdvanceBase.AdvanceType.Mask);
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public MenuItemOptType lastType = MenuItemOptType.Invalid;
|
|||
|
public void OnMenuItemClick(MenuItemOptType type)
|
|||
|
{
|
|||
|
if(lastType == type)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
if (_OnAdvanceMenuItemClickCallBack != null)
|
|||
|
{
|
|||
|
_OnAdvanceMenuItemClickCallBack.Invoke(type);
|
|||
|
}
|
|||
|
ShowMenuItemMaskBG(type);
|
|||
|
}
|
|||
|
|
|||
|
// 设置MneuItem的背景遮罩
|
|||
|
public void ShowMenuItemMaskBG(MenuItemOptType type)
|
|||
|
{
|
|||
|
for (int index = 0; index < menuItemList.Count; index++)
|
|||
|
{
|
|||
|
menuItemList[index].gameObject.GetComponent<AdvanceMenuItem>().maskBG.gameObject.SetActive(
|
|||
|
menuItemList[index].gameObject.GetComponent<AdvanceMenuItem>().type == type ? true : false);
|
|||
|
menuItemList[index].gameObject.GetComponent<AdvanceMenuItem>().originIcon.gameObject.SetActive(
|
|||
|
menuItemList[index].gameObject.GetComponent<AdvanceMenuItem>().type == type ? false : true);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void UpdateRedPoint(int t, bool isShow)
|
|||
|
{
|
|||
|
if (t >= (int)MenuItemOptType.Show && t <= (int)MenuItemOptType.Fashion)
|
|||
|
{
|
|||
|
if (menuItemList.Count > t && menuItemList[t] != null)
|
|||
|
{
|
|||
|
menuItemList[t].ShowOrHideIcon(isShow);
|
|||
|
}
|
|||
|
}
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
[Serializable]
|
|||
|
public class OnAdvanceMenuItemClick : UnityEvent<MenuItemOptType>
|
|||
|
{
|
|||
|
public OnAdvanceMenuItemClick() { }
|
|||
|
}
|
|||
|
|
|||
|
[SerializeField]
|
|||
|
public OnAdvanceMenuItemClick _OnAdvanceMenuItemClickCallBack;
|
|||
|
}
|