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.
81 lines
2.4 KiB
81 lines
2.4 KiB
using AX.MessageSystem; |
|
using System; |
|
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
using UnityEngine.UI; |
|
|
|
[Serializable] |
|
public class SmokeSettingData |
|
{ |
|
public string name; |
|
public int value; |
|
} |
|
public class SmokePanel : ResourceLoadPanel<SmokePanel> |
|
{ |
|
public Slider NongDu_Slider; |
|
public Button CloseBtn; |
|
private GameObject nowObj; |
|
private SmokeSettingData nowData; |
|
// Use this for initialization |
|
void Start() |
|
{ |
|
CloseBtn.onClick.AddListener(CloseBtn_Click); |
|
NongDu_Slider.onValueChanged.AddListener(NongDu_SliderValueChanged); |
|
nowData = new SmokeSettingData(); |
|
MessageDispatcher.AddListener("SelectChange", selectchange); |
|
} |
|
private void OnDestroy() |
|
{ |
|
MessageDispatcher.RemoveListener("SelectChange", selectchange); |
|
} |
|
|
|
private void selectchange(IMessage obj) |
|
{ |
|
gameObject.SetActive(false); |
|
} |
|
|
|
|
|
private void NongDu_SliderValueChanged(float value) |
|
{ |
|
if (nowObj != null) |
|
{ |
|
nowData.name = nowObj.name; |
|
nowData.value = (int)value; |
|
AddRecordEventSmoke(nowObj, nowData); |
|
var main = nowObj.GetComponent<SmokeControl>().MySmokeMain; |
|
main.maxParticles = (int)(value * 10); |
|
} |
|
} |
|
public void AddRecordEventSmoke(GameObject obj, SmokeSettingData 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; |
|
if (eventData.cloneObjType == CloneObjType.SmokeNormal) |
|
{ |
|
eventData.eventType = RecordEventType.SmokeNormal; |
|
} |
|
else if (eventData.cloneObjType == CloneObjType.SmokeInside) |
|
{ |
|
eventData.eventType = RecordEventType.SmokeInside; |
|
} |
|
eventData.json = JsonUtility.ToJson(data); |
|
|
|
RecordManager.Instance.jsonData.eventDataList.Add(eventData); |
|
} |
|
} |
|
private void CloseBtn_Click() |
|
{ |
|
gameObject.SetActive(false); |
|
nowObj = null; |
|
} |
|
|
|
public void SetNongDu(GameObject obj, int value) |
|
{ |
|
nowObj = obj; |
|
NongDu_Slider.value = value; |
|
} |
|
}
|
|
|