Browse Source

修改esc取消选中,当前没有切楼层,物体隐藏的问题

develop
曹衍涛 3 years ago
parent
commit
60bd251af0
  1. 10
      Assets/Scenes/DongYouLiQing.unity
  2. 85
      Assets/Scripts/Common/GameObjectSelect/ObjSelectCtrl.cs

10
Assets/Scenes/DongYouLiQing.unity

@ -224883,7 +224883,7 @@ PrefabInstance:
- target: {fileID: 224001330236392204, guid: 863dfe406d9716349adc35fb55cd722c,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0.000018335479
value: 0.0000049613104
objectReference: {fileID: 0}
- target: {fileID: 224123732978855200, guid: 863dfe406d9716349adc35fb55cd722c,
type: 3}
@ -224948,7 +224948,7 @@ PrefabInstance:
- target: {fileID: 224181501778157638, guid: 863dfe406d9716349adc35fb55cd722c,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0.000025032346
value: 0.000007912276
objectReference: {fileID: 0}
- target: {fileID: 224373752534357086, guid: 863dfe406d9716349adc35fb55cd722c,
type: 3}
@ -225028,7 +225028,7 @@ PrefabInstance:
- target: {fileID: 224756375583235730, guid: 863dfe406d9716349adc35fb55cd722c,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0.000021518692
value: 0.000004973162
objectReference: {fileID: 0}
- target: {fileID: 224796681591186844, guid: 863dfe406d9716349adc35fb55cd722c,
type: 3}
@ -360336,6 +360336,10 @@ PrefabInstance:
propertyPath: interlayerNum
value: 1
objectReference: {fileID: 0}
- target: {fileID: 493175234, guid: 0eae1400396ce7543ada43bfc5909274, type: 3}
propertyPath: floorNum
value: 1
objectReference: {fileID: 0}
- target: {fileID: 647154048, guid: 0eae1400396ce7543ada43bfc5909274, type: 3}
propertyPath: buildNum
value: 2HANCC

85
Assets/Scripts/Common/GameObjectSelect/ObjSelectCtrl.cs

@ -220,43 +220,46 @@ public class ObjSelectCtrl : MonoBehaviour
{
if (info.buildNum == data.CurrentFloor.buildNum)
{
if (info.floorNum > data.CurrentFloor.floorNum ||
(info.floorNum == data.CurrentFloor.floorNum && info.interlayerNum > data.CurrentFloor.interlayerNum))
if (data.CurrentFloor.floorNum!=0)
{
Renderer[] renderers = SelectedObjs.selectedObj.GetComponentsInChildren<Renderer>();
for (int i = 0; i < renderers.Length; i++)
{
renderers[i].enabled = false;
}
if (SelectedObjs.selectedObj.GetComponent<CreatHaemalUI>()) //如果是被困人员/伤员,绑定了UI
if (info.floorNum > data.CurrentFloor.floorNum ||
(info.floorNum == data.CurrentFloor.floorNum && info.interlayerNum > data.CurrentFloor.interlayerNum))
{
Transform ui = SelectedObjs.selectedObj.GetComponent<CreatHaemalUI>().haemal.transform;
Image[] images = ui.GetComponentsInChildren<Image>(true);
for (int j = 0; j < images.Length; j++)
Renderer[] renderers = SelectedObjs.selectedObj.GetComponentsInChildren<Renderer>();
for (int i = 0; i < renderers.Length; i++)
{
images[j].enabled = false;
renderers[i].enabled = false;
}
Text[] texts = ui.GetComponentsInChildren<Text>(true);
for (int j = 0; j < texts.Length; j++)
if (SelectedObjs.selectedObj.GetComponent<CreatHaemalUI>()) //如果是被困人员/伤员,绑定了UI
{
texts[j].enabled = false;
Transform ui = SelectedObjs.selectedObj.GetComponent<CreatHaemalUI>().haemal.transform;
Image[] images = ui.GetComponentsInChildren<Image>(true);
for (int j = 0; j < images.Length; j++)
{
images[j].enabled = false;
}
Text[] texts = ui.GetComponentsInChildren<Text>(true);
for (int j = 0; j < texts.Length; j++)
{
texts[j].enabled = false;
}
}
}
if (SelectedObjs.selectedObj.GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.fireman ||
SelectedObjs.selectedObj.GetComponent<TruckMessage>()||
SelectedObjs.selectedObj.GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.Trailer ||
SelectedObjs.selectedObj.GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.OilSupplyTruck ||
SelectedObjs.selectedObj.GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.LiquipSupplyTruck ||
SelectedObjs.selectedObj.GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.RescueCarrierCar ||
SelectedObjs.selectedObj.GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.LifeGuaranteeCar)
{
UINameItem[] names = GameObject.Find("Canvas").transform.Find("TheHeadName").GetComponentsInChildren<UINameItem>(true);
for (int j = 0; j < names.Length; j++)
if (SelectedObjs.selectedObj.GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.fireman ||
SelectedObjs.selectedObj.GetComponent<TruckMessage>() ||
SelectedObjs.selectedObj.GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.Trailer ||
SelectedObjs.selectedObj.GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.OilSupplyTruck ||
SelectedObjs.selectedObj.GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.LiquipSupplyTruck ||
SelectedObjs.selectedObj.GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.RescueCarrierCar ||
SelectedObjs.selectedObj.GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.LifeGuaranteeCar)
{
if (names[j].Target == SelectedObjs.selectedObj.gameObject)
UINameItem[] names = GameObject.Find("Canvas").transform.Find("TheHeadName").GetComponentsInChildren<UINameItem>(true);
for (int j = 0; j < names.Length; j++)
{
names[j].gameObject.SetActive(false);
if (names[j].Target == SelectedObjs.selectedObj.gameObject)
{
names[j].gameObject.SetActive(false);
}
}
}
}
@ -276,22 +279,26 @@ public class ObjSelectCtrl : MonoBehaviour
{
if (info.buildNum == data.CurrentFloor.buildNum)
{
if (info.floorNum > data.CurrentFloor.floorNum ||
(info.floorNum == data.CurrentFloor.floorNum && info.interlayerNum > data.CurrentFloor.interlayerNum))
if (data.CurrentFloor.floorNum!=0)
{
Renderer[] renderers = SelectedObjs.selectedCharacters[i].GetComponentsInChildren<Renderer>();
for (int j = 0; j < renderers.Length; j++)
if (info.floorNum > data.CurrentFloor.floorNum ||
(info.floorNum == data.CurrentFloor.floorNum && info.interlayerNum > data.CurrentFloor.interlayerNum))
{
renderers[j].enabled = false;
}
for (int j = 0; j < names.Length; j++)
{
if (names[j].Target == SelectedObjs.selectedCharacters[i])
Renderer[] renderers = SelectedObjs.selectedCharacters[i].GetComponentsInChildren<Renderer>();
for (int j = 0; j < renderers.Length; j++)
{
renderers[j].enabled = false;
}
for (int j = 0; j < names.Length; j++)
{
names[j].gameObject.SetActive(false);
if (names[j].Target == SelectedObjs.selectedCharacters[i])
{
names[j].gameObject.SetActive(false);
}
}
}
}
}
}
}

Loading…
Cancel
Save