Browse Source

合成

develop
曹衍涛 4 years ago
parent
commit
2925fb5e43
  1. 2
      Assets/01ZhongSha.meta
  2. 2
      Assets/01ZhongSha/Texture.meta
  3. BIN
      Assets/01ZhongSha/Texture/XF_SP_Color.png
  4. 88
      Assets/01ZhongSha/Texture/XF_SP_Color.png.meta
  5. BIN
      Assets/01ZhongSha/Texture/XF_SP_Normal.png
  6. 88
      Assets/01ZhongSha/Texture/XF_SP_Normal.png.meta
  7. 3
      Assets/01ZhongSha/XFSS.meta
  8. 8
      Assets/01ZhongSha/XFSS/Materials.meta
  9. BIN
      Assets/01ZhongSha/XFSS/Materials/Material #5.mat
  10. 8
      Assets/01ZhongSha/XFSS/Materials/Material #5.mat.meta
  11. BIN
      Assets/01ZhongSha/XFSS/SP.FBX
  12. 121
      Assets/01ZhongSha/XFSS/SP.FBX.meta
  13. BIN
      Assets/02DaLianShiYou/DaLianShiHua.prefab
  14. 2
      Assets/Data/10/File/XmlData/1.1.xml
  15. 8
      Assets/Data/11.meta
  16. 0
      Assets/Data/11/11.xml
  17. 2
      Assets/Data/11/11.xml.meta
  18. 2
      Assets/Data/11/File.meta
  19. 0
      Assets/Data/11/File/NodeList.xml
  20. 2
      Assets/Data/11/File/NodeList.xml.meta
  21. 2
      Assets/Data/11/File/XmlData.meta
  22. 2
      Assets/Data/11/File/XmlData/1.1.xml
  23. 2
      Assets/Data/11/File/XmlData/1.1.xml.meta
  24. 18
      Assets/Editor/SceneToolNew.cs
  25. BIN
      Assets/Resources/SP.prefab
  26. 7
      Assets/Resources/SP.prefab.meta
  27. BIN
      Assets/Scene/MainScene_New.unity
  28. BIN
      Assets/Scene/MainScene_New/NavMesh-NavMeshSufaceCar.asset
  29. BIN
      Assets/Scene/MainScene_New/NavMesh-NavMeshSufaceMan.asset
  30. 6
      Assets/Scripts/CameraControl/CameraManager.cs
  31. 2
      Assets/Scripts/DisasterSetting/ZDSP/FCGSPControl.cs
  32. 153
      Assets/Scripts/SmartX1/SmartController.cs
  33. BIN
      Assets/Sky/Materials/azure[Sky].mat
  34. 4
      Assets/StreamingAssets/Data/DisasterInfos.xml
  35. 2
      Assets/StreamingAssets/xml/enSmartXProject.xml
  36. 2
      Assets/StreamingAssets/xml/enSmartXProject.xml.meta
  37. 2
      Assets/StreamingAssets/xml/enSmartXProject2.xml

2
Assets/Assets.meta → Assets/01ZhongSha.meta

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 4316ab4119809a341a581cffe1eefb4e guid: 0fa832f5eaf5a0849afd2227d7b6a6ef
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

2
Assets/Data/10.meta → Assets/01ZhongSha/Texture.meta

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: f5d722cdd05c7ad4fb72434b3958e0bd guid: 8b3c91bc703479c4f8e385dd36987759
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

BIN
Assets/01ZhongSha/Texture/XF_SP_Color.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

88
Assets/01ZhongSha/Texture/XF_SP_Color.png.meta

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 124a9d7611622954da1023a9a0cad7dd
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/01ZhongSha/Texture/XF_SP_Normal.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 565 KiB

88
Assets/01ZhongSha/Texture/XF_SP_Normal.png.meta

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 1c5f89f253350c940b855652469ffd8a
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 0
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 1
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

3
Assets/StreamingAssets/xml/enSmartXProject2.xml.meta → Assets/01ZhongSha/XFSS.meta

@ -1,5 +1,6 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: d746ec1c4a0b5144ea4b78c9c69c69cf guid: 41e912811f5e89f42aac8390f923dc4e
folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

8
Assets/01ZhongSha/XFSS/Materials.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 82fae7c9d8ddcf74a8e5c47c07d696e1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/01ZhongSha/XFSS/Materials/Material #5.mat

Binary file not shown.

8
Assets/01ZhongSha/XFSS/Materials/Material #5.mat.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 721f586957d5fc248b0a102333fc8310
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/01ZhongSha/XFSS/SP.FBX

Binary file not shown.

121
Assets/01ZhongSha/XFSS/SP.FBX.meta

@ -0,0 +1,121 @@
fileFormatVersion: 2
guid: cff193040e330eb4c9dcd85dfa7fb35d
ModelImporter:
serializedVersion: 23
fileIDToRecycleName:
100000: //RootNode
100002: sp_bi
100004: SP_DI
100006: SP_Famen
100008: sp_tou
400000: //RootNode
400002: sp_bi
400004: SP_DI
400006: SP_Famen
400008: sp_tou
2100000: 'Material #4'
2300000: sp_bi
2300002: SP_DI
2300004: SP_Famen
2300006: sp_tou
3300000: sp_bi
3300002: SP_DI
3300004: SP_Famen
3300006: sp_tou
4300000: sp_bi
4300002: sp_tou
4300004: SP_DI
4300006: SP_Famen
7400000: Take 001
9500000: //RootNode
externalObjects:
- first:
type: UnityEngine:Material
assembly: UnityEngine.CoreModule
name: 'Material #4'
second: {fileID: 2100000, guid: 721f586957d5fc248b0a102333fc8310, type: 2}
materials:
importMaterials: 1
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
optimizeMeshForGPU: 1
keepQuads: 0
weldVertices: 1
preserveHierarchy: 0
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
previousCalculatedGlobalScale: 0.01
hasPreviousCalculatedGlobalScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
importAnimation: 1
copyAvatar: 0
humanDescription:
serializedVersion: 2
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
animationType: 2
humanoidOversampling: 1
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/02DaLianShiYou/DaLianShiHua.prefab

Binary file not shown.

2
Assets/Data/10/File/XmlData/1.1.xml

File diff suppressed because one or more lines are too long

8
Assets/Data/11.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b7cfe6339905b814987dbec31a6c183a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

0
Assets/Data/10/10.xml → Assets/Data/11/11.xml

2
Assets/Data/10/10.xml.meta → Assets/Data/11/11.xml.meta

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: f37e64278def8124fad7f0008ea829ad guid: a238a0f24d659504cbafe0d0f60ce470
TextScriptImporter: TextScriptImporter:
externalObjects: {} externalObjects: {}
userData: userData:

2
Assets/Data/10/File.meta → Assets/Data/11/File.meta

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 3eceb15f6a3de784cae4c8e93d0eebae guid: 444f52c1b8794af4e9d934f55de983e9
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

0
Assets/Data/10/File/NodeList.xml → Assets/Data/11/File/NodeList.xml

2
Assets/Data/10/File/NodeList.xml.meta → Assets/Data/11/File/NodeList.xml.meta

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: d0c47dc27ef5a7949952c883c51c570f guid: 7f9735cb1cf02654792b04695ea69f85
TextScriptImporter: TextScriptImporter:
externalObjects: {} externalObjects: {}
userData: userData:

2
Assets/Data/10/File/XmlData.meta → Assets/Data/11/File/XmlData.meta

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 334d42c824136e048bb1ccb3369cfa41 guid: ffaae7f4ace8daa4397117feeddd74f0
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

2
Assets/Data/11/File/XmlData/1.1.xml

File diff suppressed because one or more lines are too long

2
Assets/Data/10/File/XmlData/1.1.xml.meta → Assets/Data/11/File/XmlData/1.1.xml.meta

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 7667cd84527a85e458ddaf3e5252d925 guid: cc8b9ee291fbfcb4586ffefc2ebf015c
TextScriptImporter: TextScriptImporter:
externalObjects: {} externalObjects: {}
userData: userData:

18
Assets/Editor/SceneToolNew.cs

@ -408,4 +408,22 @@ public class SceneToolNew
} }
} }
} }
[MenuItem("SceneToolNew/ChangeXFSP")]
public static void ChangeXFSP()
{
Transform[] obj = Selection.GetTransforms(SelectionMode.Deep);
GameObject SP = Resources.Load("SP") as GameObject;
for (int i = 0; i < obj.Length; i++)
{
if (obj[i].name.Contains("SP") && !obj[i].name.Contains("ziti"))
{
GameObject sp = GameObject.Instantiate(SP);
sp.transform.parent = obj[i].transform;
sp.name = "sp";
sp.transform.localPosition = new Vector3(0, 0.6f, 0f);
obj[i].transform.gameObject.GetComponent<Renderer>().enabled = false;
}
}
}
} }

BIN
Assets/Resources/SP.prefab

Binary file not shown.

7
Assets/Resources/SP.prefab.meta

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 722570206ab6e15429e81c32e7bac1eb
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Scene/MainScene_New.unity

Binary file not shown.

BIN
Assets/Scene/MainScene_New/NavMesh-NavMeshSufaceCar.asset

Binary file not shown.

BIN
Assets/Scene/MainScene_New/NavMesh-NavMeshSufaceMan.asset

Binary file not shown.

6
Assets/Scripts/CameraControl/CameraManager.cs

@ -91,11 +91,11 @@ public class CameraManager : MonoBehaviour
//x = 180f, //x = 180f,
//y = 30f, //y = 30f,
//distance = 95f, //distance = 95f,
x = -45f, x = -91f,
y = 18f, y = 64f,
distance = 90f, distance = 90f,
// targetPos = new Vector3(-180.7f, 1.02f, -40f) // targetPos = new Vector3(-180.7f, 1.02f, -40f)
targetPos = new Vector3(118f, 10f, -64f) targetPos = new Vector3(-411f, 10f, -575f)
}; };
CameraSetting(cdata); CameraSetting(cdata);
} }

2
Assets/Scripts/DisasterSetting/ZDSP/FCGSPControl.cs

@ -29,7 +29,7 @@ public class FCGSPControl : ObjDoubleClick
private void Awake() private void Awake()
{ {
//sp/sp_bi/sp_tou //sp/sp_bi/sp_tou
int num = int.Parse(name.Substring(4,name.Length-4)); int num = int.Parse(name.Substring(2,name.Length-2));
////if (gameObject.name.Split('_').Length > 0) ////if (gameObject.name.Split('_').Length > 0)
//{ //{

153
Assets/Scripts/SmartX1/SmartController.cs

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

BIN
Assets/Sky/Materials/azure[Sky].mat

Binary file not shown.

4
Assets/StreamingAssets/Data/DisasterInfos.xml

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<DisasterInfoList> <DisasterInfoList>
<DisasterInfo> <DisasterInfo>
<Id>10</Id> <Id>11</Id>
<LastTime>2021/2/2 10:05:44</LastTime> <LastTime>2021/3/2 15:31:04</LastTime>
<Name>1</Name> <Name>1</Name>
</DisasterInfo> </DisasterInfo>
</DisasterInfoList> </DisasterInfoList>

2
Assets/StreamingAssets/xml/enSmartXProject.xml

File diff suppressed because one or more lines are too long

2
Assets/StreamingAssets/xml/enSmartXProject.xml.meta

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: dbdddd08b53d1314c8c32b10c1f0e305 guid: 944e36cc0105df7429f07908bc196bbc
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

2
Assets/StreamingAssets/xml/enSmartXProject2.xml

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save