105 lines
2.3 KiB
C#
105 lines
2.3 KiB
C#
|
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using Games.GlobeDefine;
|
|||
|
using GCGame.Table;
|
|||
|
using GCGame;
|
|||
|
|
|||
|
public class AutoPickLogic : UIControllerBase<AutoPickLogic>
|
|||
|
{
|
|||
|
|
|||
|
public List<Toggle> _AutoPickToggles;
|
|||
|
public Text _AutoPickDesc;
|
|||
|
|
|||
|
void OnEnable()
|
|||
|
{
|
|||
|
SetInstance(this);
|
|||
|
}
|
|||
|
|
|||
|
void OnDisable()
|
|||
|
{
|
|||
|
SetInstance(null);
|
|||
|
}
|
|||
|
|
|||
|
#region static
|
|||
|
|
|||
|
public static void ShowAutoPick()
|
|||
|
{
|
|||
|
UIManager.ShowUI(UIInfo.AutoPickRoot, OnShowOk);
|
|||
|
CG_SET_AUTO_PICK_INFO packet = (CG_SET_AUTO_PICK_INFO)PacketDistributed.CreatePacket(MessageID.PACKET_CG_SET_AUTO_PICK_INFO);
|
|||
|
packet.IsGC = 1;
|
|||
|
packet.SendPacket();
|
|||
|
}
|
|||
|
|
|||
|
static void OnShowOk(bool bSuccess, object param)
|
|||
|
{
|
|||
|
if (!bSuccess)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
if (AutoPickLogic.Instance() != null)
|
|||
|
{
|
|||
|
AutoPickLogic.Instance()._AutoPickDesc.text = StrDictionary.GetClientDictionaryString("#{5011}");
|
|||
|
ShowInfo();
|
|||
|
AutoPickLogic.Instance()._IsInfoChange = false;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region show info
|
|||
|
|
|||
|
private static List<int> _ShowInfos = new List<int>();
|
|||
|
|
|||
|
public static void SetShowInfo(List<int> showInfos)
|
|||
|
{
|
|||
|
_ShowInfos = showInfos;
|
|||
|
ShowInfo();
|
|||
|
}
|
|||
|
|
|||
|
public static void ShowInfo()
|
|||
|
{
|
|||
|
if (AutoPickLogic.Instance() == null)
|
|||
|
return;
|
|||
|
|
|||
|
for (int i = 0; i < AutoPickLogic.Instance()._AutoPickToggles.Count; ++i)
|
|||
|
{
|
|||
|
if (_ShowInfos.Count > i)
|
|||
|
{
|
|||
|
AutoPickLogic.Instance()._AutoPickToggles[i].isOn = _ShowInfos[i] > 0;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region
|
|||
|
|
|||
|
private bool _IsInfoChange = false;
|
|||
|
|
|||
|
public void OnToggleOn()
|
|||
|
{
|
|||
|
_IsInfoChange = true;
|
|||
|
}
|
|||
|
|
|||
|
public void CloseWindow()
|
|||
|
{
|
|||
|
if (_IsInfoChange)
|
|||
|
{
|
|||
|
CG_SET_AUTO_PICK_INFO packet = (CG_SET_AUTO_PICK_INFO)PacketDistributed.CreatePacket(MessageID.PACKET_CG_SET_AUTO_PICK_INFO);
|
|||
|
for (int i = 0; i < _AutoPickToggles.Count; ++i)
|
|||
|
{
|
|||
|
packet.AddPickInfo(_AutoPickToggles[i].isOn ? 1 : 0);
|
|||
|
}
|
|||
|
packet.SetIsGC(0);
|
|||
|
packet.SendPacket();
|
|||
|
}
|
|||
|
UIManager.CloseUI(UIInfo.AutoPickRoot);
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
}
|