You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
98 lines
2.9 KiB
98 lines
2.9 KiB
using System; |
|
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
using UnityEngine.UI; |
|
|
|
[Serializable] |
|
public class WeiXianPinData |
|
{ |
|
public string name; |
|
public int index; |
|
} |
|
public class WeiXianPinPanel : ResourceLoadPanel<WeiXianPinPanel> |
|
{ |
|
public Toggle ZJCSMH; |
|
public Toggle BBB; |
|
public Toggle XMHZSS; |
|
public Button CloseBtn; |
|
public Button SureBtn; |
|
private GameObject NowObj; |
|
private void Start() |
|
{ |
|
CloseBtn.onClick.AddListener(CloseBtn_Click); |
|
SureBtn.onClick.AddListener(SureBtn_Click); |
|
} |
|
public void AddRecordEventQingLi(GameObject obj, WeiXianPinData data) |
|
{ |
|
if (ReplaySetting.PlayStatus == PlayStatus.isEditor && RecordManager.Instance.recordStatus == RecordStatus.normal) |
|
{ |
|
var eventData = new EventData(); |
|
eventData.time = RecordManager.Instance.RecordTimer; |
|
eventData.cloneObjType = obj.GetComponent<CloneGameObjInfo>().gameObjType; |
|
eventData.eventType = RecordEventType.QingLi; |
|
eventData.json = JsonUtility.ToJson(data); |
|
|
|
RecordManager.Instance.jsonData.eventDataList.Add(eventData); |
|
} |
|
} |
|
public void SureBtn_Click() |
|
{ |
|
if (NowObj != null) |
|
{ |
|
if (!ZJCSMH.group.AnyTogglesOn()) |
|
{ |
|
ResourceLoadWindow.Instance.LoadTextHintWindow("请选择处理方式!", 0.5f); |
|
} |
|
else |
|
{ |
|
//TODO:错误记录 |
|
WeiXianPinData data = new WeiXianPinData(); |
|
data.name = NowObj.name; |
|
if (ZJCSMH.isOn) data.index = 1; |
|
else if (BBB.isOn) data.index = 2; |
|
else data.index = 3; |
|
AddRecordEventQingLi(NowObj, data); |
|
if (NowObj.GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.DangerousGoods) |
|
ResourceLoadWindow.Instance.LoadTextHintWindow("危险品已经被清理!", 1f); |
|
else |
|
ResourceLoadWindow.Instance.LoadTextHintWindow("杂物堆已经被清理!", 1f); |
|
EntitiesManager.Instance.DeleteObj(NowObj); |
|
CloseBtn_Click(); |
|
} |
|
} |
|
} |
|
|
|
private void CloseBtn_Click() |
|
{ |
|
gameObject.SetActive(false); |
|
} |
|
public void QingLi(GameObject obj, int index = 0) |
|
{ |
|
NowObj = obj; |
|
if (index == 0) |
|
{ |
|
if (ZJCSMH.isOn) |
|
ZJCSMH.isOn = false; |
|
if (BBB.isOn) |
|
BBB.isOn = false; |
|
if (XMHZSS.isOn) |
|
XMHZSS.isOn = false; |
|
} |
|
else if (index == 1) |
|
{ |
|
if (!ZJCSMH.isOn) |
|
ZJCSMH.isOn = true; |
|
} |
|
else if (index == 2) |
|
{ |
|
if (!BBB.isOn) |
|
BBB.isOn = true; |
|
} |
|
else if (index == 3) |
|
{ |
|
if (!XMHZSS.isOn) |
|
XMHZSS.isOn = true; |
|
} |
|
} |
|
}
|
|
|