怪物搞完
This commit is contained in:
@@ -39,10 +39,7 @@ public class UIMonsterItem : UIBaseItem
|
||||
void Awake()
|
||||
{
|
||||
groupId = -1;
|
||||
AddInputNameClickEvent(txtPos);
|
||||
//AddInputNameClickEvent(txtPath, true);
|
||||
btnDel.onClick.AddListener(RemoveSelf);
|
||||
//itemIdx = 0;
|
||||
paths = new List<string>();
|
||||
btnClickSelf.onClick.AddListener(OnClickSelf);
|
||||
btnCopy.onClick.AddListener(OnCopySelf);
|
||||
@@ -59,7 +56,8 @@ public class UIMonsterItem : UIBaseItem
|
||||
return;
|
||||
}
|
||||
monster.pos = UtilityClass.GetVector2Pos(arg0);
|
||||
MapManager.Instance.CreateSpecialPoint(monster.pos, this);
|
||||
sceneArea?.SetAreaPos(monster.pos);
|
||||
UIWindow.Instance.uiMonstersPanel.UpdateGroupInfo(this);
|
||||
}
|
||||
|
||||
//public void SetItem(int idx, MonstersConfig.MonsterConfig m)
|
||||
@@ -71,6 +69,7 @@ public class UIMonsterItem : UIBaseItem
|
||||
txtPos.text = m.pos.ToString();
|
||||
paths = m.paths;
|
||||
monster = m;
|
||||
txtPos.enabled = m.itemIdx != -1;
|
||||
txtID.gameObject.SetActive(m.itemIdx != -1);
|
||||
if (m.groupId > 0)
|
||||
return;
|
||||
@@ -82,6 +81,7 @@ public class UIMonsterItem : UIBaseItem
|
||||
base.SetSelectPosItem();
|
||||
btnClickSelf.Select();
|
||||
UIWindow.Instance.uiMonstersPanel.OnClickItem(this);
|
||||
|
||||
}
|
||||
public override void SetItemPos(Vector2Int pos)
|
||||
{
|
||||
@@ -89,6 +89,7 @@ public class UIMonsterItem : UIBaseItem
|
||||
monster.pos = pos;
|
||||
txtPos.text = pos.ToString();
|
||||
btnClickSelf.Select();
|
||||
UIWindow.Instance.uiMonstersPanel.UpdateGroupInfo(this);
|
||||
}
|
||||
public void RefreshItem()
|
||||
{
|
||||
@@ -97,8 +98,7 @@ public class UIMonsterItem : UIBaseItem
|
||||
paths = monster.paths;
|
||||
txtPos.text = monster.pos.ToString();
|
||||
//ˢ<>³<EFBFBD><C2B3><EFBFBD><EFBFBD>еĶ<D0B5><C4B6><EFBFBD>
|
||||
MapManager.Instance.SetMonsterPoint(monster.itemIdx, monster.radius, monster.id, monster.num);
|
||||
MapManager.Instance.CreateSpecialPoint(monster.pos, this);
|
||||
sceneArea?.RefSAreaInfo();
|
||||
}
|
||||
|
||||
public void SetGroup(int group)
|
||||
@@ -112,49 +112,6 @@ public class UIMonsterItem : UIBaseItem
|
||||
btnHide.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
private void AddInputNameClickEvent(InputField input, bool isPath = false) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Awake<6B>е<EFBFBD><D0B5><EFBFBD>
|
||||
{
|
||||
var eventTrigger = input.gameObject.AddComponent<EventTrigger>();
|
||||
UnityAction<BaseEventData> selectEvent = null;
|
||||
if (isPath)
|
||||
selectEvent = OnPathInputFieldClicked;
|
||||
else
|
||||
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(txtMonsterID.text))
|
||||
return;
|
||||
|
||||
if (OnClick == null)
|
||||
return;
|
||||
|
||||
OnClick(this);
|
||||
|
||||
UIWindow.Instance.uiMonstersPanel.curActiveInput = data.selectedObject.GetComponent<InputField>();
|
||||
int radius = Convert.ToInt32(UIWindow.Instance.uiMonstersPanel.txtRadius.text);
|
||||
int count = Convert.ToInt32(UIWindow.Instance.uiMonstersPanel.txtCount.text);
|
||||
MapManager.Instance.SetMonsterPoint(monster.itemIdx, radius, Convert.ToInt32(txtMonsterID.text), count);
|
||||
MapManager.Instance.SetEditCellType(MapManager.EditCellType.MonsterArea);
|
||||
}
|
||||
|
||||
|
||||
private void OnPathInputFieldClicked(BaseEventData data)
|
||||
{
|
||||
UIWindow.Instance.uiMonstersPanel.curActiveInput = data.selectedObject.GetComponent<InputField>();
|
||||
UIWindow.Instance.uiMonstersPanel.curActiveList = paths;
|
||||
MapManager.Instance.SetEditCellType(MapManager.EditCellType.MonsterPath);
|
||||
}
|
||||
|
||||
private void RemoveSelf()
|
||||
{
|
||||
DestroyImmediate(transform.parent.gameObject);
|
||||
@@ -188,66 +145,6 @@ public class UIMonsterItem : UIBaseItem
|
||||
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 (dropType.value == (int)CreateMonsterMode.Death)
|
||||
//{
|
||||
// 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;
|
||||
// }
|
||||
//}
|
||||
//else if(dropType.value == (int)CreateMonsterMode.FixedTime)
|
||||
//{
|
||||
// string[] tmp = txtTime.text.Split(',');
|
||||
// if (tmp.Length != 2)
|
||||
// {
|
||||
// UIWindow.Instance.ShowMessage("ˢ<><CBA2>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// if(!APIs.IsUInt(tmp[0]))
|
||||
// {
|
||||
// UIWindow.Instance.ShowMessage("ˢ<><CBA2>ʱ<EFBFBD><CAB1>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// string[] strTime = tmp[1].Split(':');
|
||||
// if (strTime.Length != 2)
|
||||
// {
|
||||
// UIWindow.Instance.ShowMessage("ˢ<><CBA2>ʱ<EFBFBD><CAB1>-ʱ<><CAB1><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
|
||||
// for (int i = 0; i < strTime.Length; i++)
|
||||
// {
|
||||
// if (!APIs.IsUInt(strTime[i]))
|
||||
// {
|
||||
// UIWindow.Instance.ShowMessage("ˢ<><CBA2>ʱ<EFBFBD><CAB1>-ʱ<><CAB1><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>");
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -255,8 +152,8 @@ public class UIMonsterItem : UIBaseItem
|
||||
{
|
||||
if (OnClick == null)
|
||||
return;
|
||||
|
||||
OnClick(this);
|
||||
OnClickItemSelf();
|
||||
}
|
||||
|
||||
private void OnCopySelf()
|
||||
|
||||
Reference in New Issue
Block a user