2025-06-14 13:46:24 +08:00
|
|
|
|
using HxGame.Data;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.Events;
|
|
|
|
|
|
using UnityEngine.EventSystems;
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
2025-07-18 22:28:40 +08:00
|
|
|
|
public class UIFuBenItem : UIBaseItem
|
2025-06-14 13:46:24 +08:00
|
|
|
|
{
|
|
|
|
|
|
public InputField txtOrder; //<2F><><EFBFBD>ﲨ<EFBFBD><EFB2A8>
|
|
|
|
|
|
public InputField txtID; //<2F><><EFBFBD><EFBFBD>ID
|
|
|
|
|
|
public InputField txtPos; //<2F><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
public InputField txtRadius; //<2F>뾶
|
|
|
|
|
|
public InputField txtNum; //ˢ<><CBA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
public InputField txtTime; //ˢ<><CBA2>ʱ<EFBFBD>䣨<EFBFBD><E4A3A8><EFBFBD>룩
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Button btnDel; //ɾ<><C9BE>
|
|
|
|
|
|
public int itemIdx;
|
|
|
|
|
|
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
|
|
void Awake()
|
|
|
|
|
|
{
|
|
|
|
|
|
AddInputNameClickEvent(txtPos);
|
|
|
|
|
|
btnDel.onClick.AddListener(RemoveSelf);
|
|
|
|
|
|
itemIdx = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void AddInputNameClickEvent(InputField input) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Awake<6B>е<EFBFBD><D0B5><EFBFBD>
|
|
|
|
|
|
{
|
|
|
|
|
|
var eventTrigger = input.gameObject.AddComponent<EventTrigger>();
|
|
|
|
|
|
UnityAction<BaseEventData> selectEvent = null;
|
|
|
|
|
|
|
|
|
|
|
|
selectEvent = OnInputFieldClicked;
|
|
|
|
|
|
|
|
|
|
|
|
EventTrigger.Entry onClick = new EventTrigger.Entry()
|
|
|
|
|
|
{
|
|
|
|
|
|
eventID = EventTriggerType.PointerClick
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
onClick.callback.AddListener(selectEvent);
|
|
|
|
|
|
eventTrigger.triggers.Add(onClick);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnInputFieldClicked(BaseEventData data)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (string.IsNullOrEmpty(txtID.text))
|
|
|
|
|
|
return;
|
|
|
|
|
|
if (string.IsNullOrEmpty(txtRadius.text))
|
|
|
|
|
|
return;
|
|
|
|
|
|
if (string.IsNullOrEmpty(txtNum.text))
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
UIWindow.Instance.uiFuBensPanel.curActiveInput = data.selectedObject.GetComponent<InputField>();
|
|
|
|
|
|
MapManager.Instance.SetCurFuBenCenterPoint(itemIdx, Convert.ToInt32(txtRadius.text), Convert.ToInt32(txtID.text), Convert.ToInt32(txtNum.text));
|
|
|
|
|
|
MapManager.Instance.SetEditCellType(MapManager.EditCellType.FuBenArea);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void RemoveSelf()
|
|
|
|
|
|
{
|
|
|
|
|
|
DestroyImmediate(gameObject);
|
|
|
|
|
|
MapManager.Instance.RemoveMonsterPoint(itemIdx);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool CheckValid()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (string.IsNullOrEmpty(txtID.text))
|
|
|
|
|
|
{
|
|
|
|
|
|
UIWindow.Instance.ShowMessage("<22><><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD>ID");
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (string.IsNullOrEmpty(txtPos.text))
|
|
|
|
|
|
{
|
|
|
|
|
|
UIWindow.Instance.ShowMessage("<22><><EFBFBD><EFBFBD>дˢ<D0B4><CBA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (string.IsNullOrEmpty(txtRadius.text))
|
|
|
|
|
|
{
|
|
|
|
|
|
UIWindow.Instance.ShowMessage("<22><><EFBFBD><EFBFBD>дˢ<D0B4>ְ뾶");
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (string.IsNullOrEmpty(txtNum.text))
|
|
|
|
|
|
{
|
|
|
|
|
|
UIWindow.Instance.ShowMessage("<22><><EFBFBD><EFBFBD>дˢ<D0B4><CBA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(txtTime.text))
|
|
|
|
|
|
{
|
|
|
|
|
|
UIWindow.Instance.ShowMessage("<22><><EFBFBD><EFBFBD>дˢ<D0B4><CBA2>ʱ<EFBFBD><CAB1>");
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!APIs.IsUInt(txtTime.text))
|
|
|
|
|
|
{
|
|
|
|
|
|
UIWindow.Instance.ShowMessage("ˢ<><CBA2>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|