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, - target: {fileID: 224001330236392204, guid: 863dfe406d9716349adc35fb55cd722c,
type: 3} type: 3}
propertyPath: m_AnchoredPosition.y propertyPath: m_AnchoredPosition.y
value: 0.000018335479 value: 0.0000049613104
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 224123732978855200, guid: 863dfe406d9716349adc35fb55cd722c, - target: {fileID: 224123732978855200, guid: 863dfe406d9716349adc35fb55cd722c,
type: 3} type: 3}
@ -224948,7 +224948,7 @@ PrefabInstance:
- target: {fileID: 224181501778157638, guid: 863dfe406d9716349adc35fb55cd722c, - target: {fileID: 224181501778157638, guid: 863dfe406d9716349adc35fb55cd722c,
type: 3} type: 3}
propertyPath: m_AnchoredPosition.y propertyPath: m_AnchoredPosition.y
value: 0.000025032346 value: 0.000007912276
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 224373752534357086, guid: 863dfe406d9716349adc35fb55cd722c, - target: {fileID: 224373752534357086, guid: 863dfe406d9716349adc35fb55cd722c,
type: 3} type: 3}
@ -225028,7 +225028,7 @@ PrefabInstance:
- target: {fileID: 224756375583235730, guid: 863dfe406d9716349adc35fb55cd722c, - target: {fileID: 224756375583235730, guid: 863dfe406d9716349adc35fb55cd722c,
type: 3} type: 3}
propertyPath: m_AnchoredPosition.y propertyPath: m_AnchoredPosition.y
value: 0.000021518692 value: 0.000004973162
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 224796681591186844, guid: 863dfe406d9716349adc35fb55cd722c, - target: {fileID: 224796681591186844, guid: 863dfe406d9716349adc35fb55cd722c,
type: 3} type: 3}
@ -360336,6 +360336,10 @@ PrefabInstance:
propertyPath: interlayerNum propertyPath: interlayerNum
value: 1 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 493175234, guid: 0eae1400396ce7543ada43bfc5909274, type: 3}
propertyPath: floorNum
value: 1
objectReference: {fileID: 0}
- target: {fileID: 647154048, guid: 0eae1400396ce7543ada43bfc5909274, type: 3} - target: {fileID: 647154048, guid: 0eae1400396ce7543ada43bfc5909274, type: 3}
propertyPath: buildNum propertyPath: buildNum
value: 2HANCC 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.buildNum == data.CurrentFloor.buildNum)
{ {
if (info.floorNum > data.CurrentFloor.floorNum || if (data.CurrentFloor.floorNum!=0)
(info.floorNum == data.CurrentFloor.floorNum && info.interlayerNum > data.CurrentFloor.interlayerNum))
{ {
Renderer[] renderers = SelectedObjs.selectedObj.GetComponentsInChildren<Renderer>(); if (info.floorNum > data.CurrentFloor.floorNum ||
for (int i = 0; i < renderers.Length; i++) (info.floorNum == data.CurrentFloor.floorNum && info.interlayerNum > data.CurrentFloor.interlayerNum))
{
renderers[i].enabled = false;
}
if (SelectedObjs.selectedObj.GetComponent<CreatHaemalUI>()) //如果是被困人员/伤员,绑定了UI
{ {
Transform ui = SelectedObjs.selectedObj.GetComponent<CreatHaemalUI>().haemal.transform; Renderer[] renderers = SelectedObjs.selectedObj.GetComponentsInChildren<Renderer>();
Image[] images = ui.GetComponentsInChildren<Image>(true); for (int i = 0; i < renderers.Length; i++)
for (int j = 0; j < images.Length; j++)
{ {
images[j].enabled = false; renderers[i].enabled = false;
} }
Text[] texts = ui.GetComponentsInChildren<Text>(true); if (SelectedObjs.selectedObj.GetComponent<CreatHaemalUI>()) //如果是被困人员/伤员,绑定了UI
for (int j = 0; j < texts.Length; j++)
{ {
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 ||
if (SelectedObjs.selectedObj.GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.fireman || SelectedObjs.selectedObj.GetComponent<TruckMessage>() ||
SelectedObjs.selectedObj.GetComponent<TruckMessage>()||
SelectedObjs.selectedObj.GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.Trailer ||
SelectedObjs.selectedObj.GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.Trailer || SelectedObjs.selectedObj.GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.OilSupplyTruck ||
SelectedObjs.selectedObj.GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.OilSupplyTruck || SelectedObjs.selectedObj.GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.LiquipSupplyTruck ||
SelectedObjs.selectedObj.GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.LiquipSupplyTruck || SelectedObjs.selectedObj.GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.RescueCarrierCar ||
SelectedObjs.selectedObj.GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.RescueCarrierCar || SelectedObjs.selectedObj.GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.LifeGuaranteeCar)
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 (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.buildNum == data.CurrentFloor.buildNum)
{ {
if (info.floorNum > data.CurrentFloor.floorNum || if (data.CurrentFloor.floorNum!=0)
(info.floorNum == data.CurrentFloor.floorNum && info.interlayerNum > data.CurrentFloor.interlayerNum))
{ {
Renderer[] renderers = SelectedObjs.selectedCharacters[i].GetComponentsInChildren<Renderer>(); if (info.floorNum > data.CurrentFloor.floorNum ||
for (int j = 0; j < renderers.Length; j++) (info.floorNum == data.CurrentFloor.floorNum && info.interlayerNum > data.CurrentFloor.interlayerNum))
{ {
renderers[j].enabled = false; Renderer[] renderers = SelectedObjs.selectedCharacters[i].GetComponentsInChildren<Renderer>();
} for (int j = 0; j < renderers.Length; j++)
for (int j = 0; j < names.Length; j++) {
{ renderers[j].enabled = false;
if (names[j].Target == SelectedObjs.selectedCharacters[i]) }
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