Browse Source

修改安全区大小。esc取消高于本楼层的选中物体的显示

develop
曹衍涛 3 years ago
parent
commit
3aa8a4cad2
  1. 17
      Assets/MscPublic/Assets/Scripts/MainScene/FloorControlModule/UIFloor.cs
  2. 2
      Assets/Prefabs/DongYouLiQing/P_AllParent.prefab
  3. 200
      Assets/Resources/ClonePrefabs/Tool/SafeArea.prefab
  4. 24
      Assets/Scenes/DongYouLiQing.unity
  5. 92
      Assets/Scripts/Common/GameObjectSelect/ObjSelectCtrl.cs
  6. 4
      Assets/Scripts/Common/Tools/SafeAreaMessage.cs
  7. 159
      Assets/Scripts/SmartX1/SmartController.cs

17
Assets/MscPublic/Assets/Scripts/MainScene/FloorControlModule/UIFloor.cs

@ -196,7 +196,12 @@ public class UIFloor : BaseToggle
}
}
if (objs[i].GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.fireman ||
objs[i].GetComponent<TruckMessage>())
objs[i].GetComponent<TruckMessage>() ||
objs[i].GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.Trailer ||
objs[i].GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.OilSupplyTruck ||
objs[i].GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.LiquipSupplyTruck ||
objs[i].GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.RescueCarrierCar ||
objs[i].GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.LifeGuaranteeCar)
{
for (int j = 0; j < names.Length; j++)
{
@ -270,8 +275,14 @@ public class UIFloor : BaseToggle
texts[j].enabled = false;
}
}
if (objs[i].GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.fireman ||
objs[i].GetComponent<TruckMessage>())
if (objs[i].GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.fireman
|| objs[i].GetComponent<TruckMessage>()||
objs[i].GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.Trailer||
objs[i].GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.OilSupplyTruck||
objs[i].GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.LiquipSupplyTruck||
objs[i].GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.RescueCarrierCar||
objs[i].GetComponent<CloneGameObjInfo>().gameObjType == CloneObjType.LifeGuaranteeCar)
{
for (int j = 0; j < names.Length; j++)
{

2
Assets/Prefabs/DongYouLiQing/P_AllParent.prefab

@ -1197,7 +1197,7 @@ MonoBehaviour:
type: 3}
cloneObjType: 106
Height: 0.2
AreaPrefabSize: 20
AreaPrefabSize: 10
cloneAble: 0
--- !u!114 &114948936895584374
MonoBehaviour:

200
Assets/Resources/ClonePrefabs/Tool/SafeArea.prefab

@ -1,22 +1,12 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 1688105851940198}
m_IsPrefabParent: 1
--- !u!1 &1688105851940198
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4952618577022658}
- component: {fileID: 33578466602309864}
@ -43,29 +33,42 @@ GameObject:
m_IsActive: 1
--- !u!4 &4952618577022658
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1688105851940198}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -569.1, y: 0.3, z: -480.8}
m_LocalScale: {x: 2, y: 1, z: 2}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &33578466602309864
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1688105851940198}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &23016673593429082
MeshRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1688105851940198}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 55d730777ef997c4190acc083a4f89aa, type: 2}
m_StaticBatchInfo:
@ -78,6 +81,7 @@ MeshRenderer:
m_PreserveUVs: 1
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
@ -86,18 +90,12 @@ MeshRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &33578466602309864
MeshFilter:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1688105851940198}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!65 &65925066976696038
BoxCollider:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1688105851940198}
m_Material: {fileID: 0}
m_IsTrigger: 0
@ -105,33 +103,37 @@ BoxCollider:
serializedVersion: 2
m_Size: {x: 10, y: 2.220446e-16, z: 10}
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &114078635669860760
--- !u!114 &114908781700621646
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1688105851940198}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 036db8a5086732a48a18fd211e676195, type: 3}
m_Script: {fileID: 11500000, guid: 4b257af13b3263c40b41dd82e9ba852c, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &114163703889018502
--- !u!114 &114510145518594432
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1688105851940198}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2f3bdb2ded22b3545b36eff11986b64c, type: 3}
m_Script: {fileID: 11500000, guid: c6b7a1087f068b941ba4809689ab5633, type: 3}
m_Name:
m_EditorClassIdentifier:
prevTranformPos: {x: 0, y: 0, z: 0}
--- !u!114 &114185252073218594
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1688105851940198}
m_Enabled: 1
m_EditorHideFlags: 0
@ -139,11 +141,25 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
rotateSpeed: 60
--- !u!114 &114705891571254502
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1688105851940198}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 54153f038171b554a9142e99a94a0f98, type: 3}
m_Name:
m_EditorClassIdentifier:
selected: 0
--- !u!114 &114195044155060300
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1688105851940198}
m_Enabled: 1
m_EditorHideFlags: 0
@ -159,95 +175,89 @@ MonoBehaviour:
Layer: 0
ShoworHidden: 0
FullName:
--- !u!114 &114330804224454362
--- !u!114 &114895149839927340
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1688105851940198}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0a2ae739074b1f74a839051cde37ee81, type: 3}
m_Script: {fileID: 11500000, guid: a2cecff9aa0169343bb23ed89a955a6c, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &114409671852452932
sideLength: 10
hasWounderNum: 0
--- !u!114 &114330804224454362
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1688105851940198}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 74287b0169ae6574c88664a62454410b, type: 3}
m_Script: {fileID: 11500000, guid: 0a2ae739074b1f74a839051cde37ee81, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &114510145518594432
--- !u!114 &114163703889018502
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1688105851940198}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c6b7a1087f068b941ba4809689ab5633, type: 3}
m_Script: {fileID: 11500000, guid: 2f3bdb2ded22b3545b36eff11986b64c, type: 3}
m_Name:
m_EditorClassIdentifier:
prevTranformPos: {x: 0, y: 0, z: 0}
--- !u!114 &114705891571254502
--- !u!114 &114917945843515582
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1688105851940198}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 54153f038171b554a9142e99a94a0f98, type: 3}
m_Script: {fileID: 11500000, guid: 77d5c6526906a6541b532f8bbf83daa8, type: 3}
m_Name:
m_EditorClassIdentifier:
selected: 0
--- !u!114 &114720232315064228
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1688105851940198}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 73b6f886e1244434cbff8aa12f1c722a, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &114895149839927340
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1688105851940198}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a2cecff9aa0169343bb23ed89a955a6c, type: 3}
m_Name:
m_EditorClassIdentifier:
sideLength: 20
hasWounderNum: 0
--- !u!114 &114908781700621646
--- !u!114 &114409671852452932
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1688105851940198}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4b257af13b3263c40b41dd82e9ba852c, type: 3}
m_Script: {fileID: 11500000, guid: 74287b0169ae6574c88664a62454410b, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &114917945843515582
--- !u!114 &114078635669860760
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1688105851940198}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 77d5c6526906a6541b532f8bbf83daa8, type: 3}
m_Script: {fileID: 11500000, guid: 036db8a5086732a48a18fd211e676195, type: 3}
m_Name:
m_EditorClassIdentifier:

24
Assets/Scenes/DongYouLiQing.unity

@ -224883,7 +224883,7 @@ PrefabInstance:
- target: {fileID: 224001330236392204, guid: 863dfe406d9716349adc35fb55cd722c,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -0.000027035712
value: 0.000018335479
objectReference: {fileID: 0}
- target: {fileID: 224123732978855200, guid: 863dfe406d9716349adc35fb55cd722c,
type: 3}
@ -224923,7 +224923,7 @@ PrefabInstance:
- target: {fileID: 224171116340244144, guid: 863dfe406d9716349adc35fb55cd722c,
type: 3}
propertyPath: m_AnchoredPosition.x
value: -0.00006567375
value: -0.000025681959
objectReference: {fileID: 0}
- target: {fileID: 224180419744436474, guid: 863dfe406d9716349adc35fb55cd722c,
type: 3}
@ -224948,7 +224948,7 @@ PrefabInstance:
- target: {fileID: 224181501778157638, guid: 863dfe406d9716349adc35fb55cd722c,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0.000072888026
value: 0.000025032346
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.000035791792
value: 0.000021518692
objectReference: {fileID: 0}
- target: {fileID: 224796681591186844, guid: 863dfe406d9716349adc35fb55cd722c,
type: 3}
@ -360336,6 +360336,14 @@ PrefabInstance:
propertyPath: interlayerNum
value: 1
objectReference: {fileID: 0}
- target: {fileID: 647154048, guid: 0eae1400396ce7543ada43bfc5909274, type: 3}
propertyPath: buildNum
value: 2HANCC
objectReference: {fileID: 0}
- target: {fileID: 647154048, guid: 0eae1400396ce7543ada43bfc5909274, type: 3}
propertyPath: floorNum
value: 9
objectReference: {fileID: 0}
- target: {fileID: 695135977, guid: 0eae1400396ce7543ada43bfc5909274, type: 3}
propertyPath: buildNum
value: 2HANCC
@ -360356,6 +360364,14 @@ PrefabInstance:
propertyPath: buildNum
value: 2HANCC
objectReference: {fileID: 0}
- target: {fileID: 1324293085, guid: 0eae1400396ce7543ada43bfc5909274, type: 3}
propertyPath: buildNum
value: 2HANCC
objectReference: {fileID: 0}
- target: {fileID: 1324293085, guid: 0eae1400396ce7543ada43bfc5909274, type: 3}
propertyPath: floorNum
value: 8
objectReference: {fileID: 0}
- target: {fileID: 1580302840, guid: 0eae1400396ce7543ada43bfc5909274, type: 3}
propertyPath: buildNum
value: 2HANCC

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

@ -4,6 +4,7 @@ using UnityEngine;
using AX.MessageSystem;
using System;
using AX.InputSystem;
using UnityEngine.UI;
[RequireComponent(typeof(BaseGameObjInfo))]
public class ObjSelectCtrl : MonoBehaviour
@ -209,6 +210,94 @@ public class ObjSelectCtrl : MonoBehaviour
TagSearchRoomSkillPanel.Instance.Hide();
InputManager.tagSearchRoomPoint = Vector3.zero;
}
{
if (SelectedObjs.selectedObj != null )
{
CloneGameObjInfo info = SelectedObjs.selectedObj.GetComponent<CloneGameObjInfo>();
FloorsPanelManager data = GameObject.Find("Canvas").transform.GetComponentInChildren<FloorsPanelManager>(false);
if (info && data)
{
if (info.buildNum == data.CurrentFloor.buildNum)
{
if (info.floorNum > data.CurrentFloor.floorNum ||
(info.floorNum == data.CurrentFloor.floorNum && info.interlayerNum > data.CurrentFloor.interlayerNum))
{
Renderer[] renderers = SelectedObjs.selectedObj.GetComponentsInChildren<Renderer>();
for (int i = 0; i < renderers.Length; i++)
{
renderers[i].enabled = false;
}
if (SelectedObjs.selectedObj.GetComponent<CreatHaemalUI>()) //如果是被困人员/伤员,绑定了UI
{
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 (names[j].Target == SelectedObjs.selectedObj.gameObject)
{
names[j].gameObject.SetActive(false);
}
}
}
}
}
}
}
if (SelectedObjs.selectedCharacters.Count > 0 )
{
FloorsPanelManager data = GameObject.Find("Canvas").transform.GetComponentInChildren<FloorsPanelManager>(false);
UINameItem[] names = GameObject.Find("Canvas").transform.Find("TheHeadName").GetComponentsInChildren<UINameItem>(true);
for (int i = 0; i < SelectedObjs.selectedCharacters.Count; i++)
{
CloneGameObjInfo info = SelectedObjs.selectedCharacters[i].GetComponent<CloneGameObjInfo>();
if (info && data)
{
if (info.buildNum == data.CurrentFloor.buildNum)
{
if (info.floorNum > data.CurrentFloor.floorNum ||
(info.floorNum == data.CurrentFloor.floorNum && info.interlayerNum > data.CurrentFloor.interlayerNum))
{
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++)
{
if (names[j].Target == SelectedObjs.selectedCharacters[i])
{
names[j].gameObject.SetActive(false);
}
}
}
}
}
}
}
}
clearSelection();
if (SkillTollPanel.Instance)
{
@ -222,8 +311,11 @@ public class ObjSelectCtrl : MonoBehaviour
SelectedObjs.selectedRolePlay = GameObject.Find("Character");
}
}
}
private void CancelObjSelected(IMessage obj)
{
//如果框选之前有不能框选的物体被单选选中,框选时,需要取消它的选中

4
Assets/Scripts/Common/Tools/SafeAreaMessage.cs

@ -7,7 +7,7 @@ using AX.NetworkSystem;
public class SafeAreaMessage : MonoBehaviour {
public float sideLength = 20;//安全区边长
public float sideLength = 10;//安全区边长
private bool flag;
public int hasWounderNum=0;
@ -68,7 +68,7 @@ public class SafeAreaMessage : MonoBehaviour {
//z与行数线性相关
float z = 2 * tens - 4f;
float x = (-1) * units + 4.5f;
pos = new Vector3(2*x,0.25f,2*z);
pos = new Vector3(1*x,0.25f,1*z);
}
return pos;
}

159
Assets/Scripts/SmartX1/SmartController.cs

@ -3,28 +3,27 @@ using System;
using System.Xml;
using System.IO;
using System.Text;
using System.Security.Cryptography;
using System.Security.Cryptography.Xml;
using System.Collections;
using SmartX1Demo;
public class SmartController : MonoBehaviour
public class SmartController : MonoBehaviour
{
int[] keyHandles = new int[8];
int[] keyNumber = new int[8];
private int Rtn = 0;
SmartApp smart = new SmartApp();
private bool IsQuit = false;
private DateTime t1, t2, t11;
void Start()
{
string appid = "";
string appid2 = "AXKC";//通用秘钥,内置的
// Use this for initialization
void Start () {
t2 = DateTime.Now;
t1 = DateTime.Now;
DontDestroyOnLoad(GameObject.Find("SmartX1"));
tipStyle = new GUIStyle();
tipStyle.fontSize = 40;
tipStyle.normal.textColor = Color.red;
@ -32,22 +31,15 @@ public class SmartController : MonoBehaviour
original_filepath = Application.streamingAssetsPath + @"/xml/SmartXProject.xml";
encode_filepath = Application.streamingAssetsPath + @"/xml/enSmartXProject.xml";
decode_filepath = Application.streamingAssetsPath + @"/xml/deSmartXProject.xml";
original_filepath2 = Application.streamingAssetsPath + @"/xml/SmartXProject2.xml";
encode_filepath2 = Application.streamingAssetsPath + @"/xml/enSmartXProject2.xml";
decode_filepath2 = Application.streamingAssetsPath + @"/xml/deSmartXProject2.xml";
appid = ControlXML(original_filepath, encode_filepath, decode_filepath);
appid2 = ControlXML(original_filepath2, encode_filepath2, decode_filepath2);
//appid = GetAppID(original_filepath);
ControlXML();
//检测加密狗是否存在
FindSmartX1();
}
string appid = "AXKC";
string appid2 = "YuAnguanli";
}
public string GetAppID(string filepath)
{
//filepath = Application.dataPath + @"/xml/SmartXProject.xml";
if (File.Exists(filepath))
{
XmlDocument xmlDoc = new XmlDocument();
@ -71,56 +63,65 @@ public class SmartController : MonoBehaviour
}
return "";
}
void FindSmartX1()
bool FindSmartX1()
{
try
{
Rtn = smart.SmartX1Find(appid, keyHandles, keyNumber);
if (Rtn == 0)
{
return;
}
Rtn = smart.SmartX1Find(appid2, keyHandles, keyNumber);
if (Rtn == 0)
{
return;
Rtn = smart.SmartX1Find(appid, keyHandles, keyNumber);
if (Rtn != 0)
{
Rtn = smart.SmartX1Find(appid2, keyHandles, keyNumber);
if (Rtn != 0)
{
IsQuit = true;
t1 = DateTime.Now;
t2 = DateTime.Now;
t11 = DateTime.Now;
return false;
}
}
IsQuit = true;
t1 = DateTime.Now;
t2 = DateTime.Now;
t11 = DateTime.Now;
Debug.Log("SmartX1Find Successfully");
return true;
}
catch (Exception ex)
{
Debug.Log(keyHandles[0]);
Debug.Log("异常" + ex.Message);
//GameObject.Find("Application").GetComponent<ApplicationClose>().isSmartX1Exit = true;
Application.Quit();
return false;
}
}
void CheckExist()
bool CheckExist()
{
try
{
Rtn = smart.SmartX1CheckExist(keyHandles[0]);
if (Rtn != 0)
{
//Debug.Log("SmartX1 not exist!" + Rtn.ToString());
IsQuit = true;
}
if (IsQuit)
{
t1 = DateTime.Now;
t2 = DateTime.Now;
t11 = DateTime.Now;
return false;
}
//Debug.Log("SmartX1Exist!");
return true;
}
catch (Exception ex)
{
Debug.Log("异常" + ex.Message);
//Debug.Log(keyHandles[0]);
//Debug.Log("异常" + ex.Message);
// GameObject.Find("Application").GetComponent<ApplicationClose>().isSmartX1Exit = true;
Application.Quit();
return false;
}
}
private GUIStyle tipStyle;
private int timer = 5;
void OnGUI()
@ -128,24 +129,25 @@ public class SmartController : MonoBehaviour
if (IsQuit)
{
t2 = DateTime.Now;
if (t2 - t11 > new TimeSpan(0, 0, 1))
if(t2-t11>new TimeSpan(0,0,1))
{
if (timer > 0)
if(timer>0)
timer--;
t11 = t2;
}
GUI.Label(new Rect(Screen.width / 2 - 150, Screen.height / 2 - 75, 300, 150), "密钥验证失败,程序将在" + timer + "秒后退出!", tipStyle);
GUI.Label(new Rect(Screen.width / 2 - 150, Screen.height / 2 - 75, 300, 150), "密钥验证失败,程序将在"+timer+"秒后退出!", tipStyle);
if (t2 - t1 > new TimeSpan(0, 0, 5))
{
Debug.Log("程序退出!");
//Debug.Log("程序退出!");
//GameObject.Find("Application").GetComponent<ApplicationClose>().isSmartX1Exit = true;
Application.Quit();
}
}
}
// Update is called once per frame
void Update()
{
// Update is called once per frame
void Update () {
if (IsQuit)
return;
t2 = DateTime.Now;
@ -154,37 +156,48 @@ public class SmartController : MonoBehaviour
t1 = t2;
CheckExist();
}
}
}
//xml文件加密解密
string ControlXML(string originalFile, string encodeFile, string decodeFile)
void ControlXML()
{
var id = "";
if (File.Exists(originalFile))//证明这次是第一次运行该程序,获取当前配置文件
if (File.Exists(original_filepath))//证明这次是第一次运行该程序,获取当前配置文件
{
id = GetAppID(originalFile);
fileEncryption(originalFile, encodeFile);
if (File.Exists(encodeFile))
{
File.Delete(originalFile);
}
appid = GetAppID(original_filepath);
//StartCoroutine(GenerateEncodeXML());
GenerateEncodeXML1();
}
else
{
if (File.Exists(encodeFile))
if (File.Exists(encode_filepath))
{
fileDcryption(encodeFile, decodeFile);
if (File.Exists(decodeFile))
fileDcryption(encode_filepath);
if (File.Exists(decode_filepath))
{
id = GetAppID(decodeFile);
File.Delete(decodeFile);
appid = GetAppID(decode_filepath);
File.Delete(decode_filepath);
}
}
}
//Debug.Log("--------->" + id);
return id;
}
IEnumerator GenerateEncodeXML()
{
yield return new WaitForSeconds(1.0f);
fileEncryption(original_filepath);
if (File.Exists(encode_filepath))
{
File.Delete(original_filepath);
}
}
void GenerateEncodeXML1()
{
fileEncryption(original_filepath);
if (File.Exists(encode_filepath))
{
File.Delete(original_filepath);
}
}
//加密xml文件
@ -241,11 +254,8 @@ public class SmartController : MonoBehaviour
string encode_filepath = "";
string decode_filepath = "";
string original_filepath2 = "";
string encode_filepath2 = "";
string decode_filepath2 = "";
//举例,对某个XML文件加密
private void fileEncryption(string originalFile, string encodeFile)
private void fileEncryption(string filename)
{
RijndaelManaged key = new RijndaelManaged();
//设置密钥:key为32位=数字或字母16个=汉子8个
@ -253,28 +263,29 @@ public class SmartController : MonoBehaviour
key.Key = byteKey;
XmlDocument xmldoc = new XmlDocument();
xmldoc.PreserveWhitespace = true;
xmldoc.Load(originalFile);//想要加密的xml文件
xmldoc.Load(original_filepath);//想要加密的xml文件
Encrypt(xmldoc, "SmartX1", key);//需要加密的节点
if (key != null)
{
key.Clear();
}
xmldoc.Save(encodeFile);//生成加密后的xml文件
xmldoc.Save(encode_filepath);//生成加密后的xml文件
}
//举例,对某个xml文件解密
private void fileDcryption(string encodeFile, string decodeFile)
private void fileDcryption(string filename)
{
RijndaelManaged key = new RijndaelManaged();
byte[] byteKey = Encoding.Unicode.GetBytes("1111111111111111");
key.Key = byteKey;
XmlDocument xmldoc = new XmlDocument();
xmldoc.PreserveWhitespace = true;
xmldoc.Load(encodeFile);//加载要解密的xml文件
xmldoc.Load(encode_filepath);//加载要解密的xml文件
Decrypt(xmldoc, key);
if (key != null)
{
key.Clear();
}
xmldoc.Save(decodeFile);//生成解密后的文件
xmldoc.Save(decode_filepath);//生成解密后的文件
}
}

Loading…
Cancel
Save