This commit is contained in:
YangHua 2024-01-26 10:30:33 +08:00
parent e02267c5ae
commit 342410607f
2 changed files with 17 additions and 1608 deletions

File diff suppressed because it is too large Load Diff

View File

@ -51,26 +51,36 @@ public class PostureController : MonoBehaviour
}
for (int i = 0; i < redObjs.Count; i++)
{
CreatDeviceItem(redContanier, redObjs[i].name, redObjs[i].deviceID);
CreatDeviceItem(redContanier, redObjs[i].name, redObjs[i].deviceID, 0);
}
for (int i = 0; i < blueObjs.Count; i++)
{
CreatDeviceItem(blueContanier, blueObjs[i].name, redObjs[i].deviceID);
CreatDeviceItem(blueContanier, blueObjs[i].name, redObjs[i].deviceID, 1);
}
}
private void CreatDeviceItem(Transform contanier, string objName, string id)
private void CreatDeviceItem(Transform contanier, string objName, string id, int redOrBlue)
{
DeviceBtnItem obj = Instantiate(deviceBtnItem, contanier);
obj.SetInfo(id, objName);
obj.selfBtn.onClick.AddListener(() =>
{
OnDeviceBtn(id);
OnDeviceBtn(id, redOrBlue);
});
}
private void OnDeviceBtn(string id)
private void OnDeviceBtn(string id, int redOrBlue)
{
if (string.IsNullOrEmpty(id)) return;
if (redOrBlue == 0)
{
redShowImage.texture = DroneViewDisplay.Instance.renderTextureTo(id);
}
else
{
blueShowImage.texture = DroneViewDisplay.Instance.renderTextureTo(id);
}
Debug.Log(id);
}
}