Compare commits

..

No commits in common. "778032b3db970f8e6715c4d2fad603da6544947f" and "c34d20750f4bb0de49dc3dbb6b1b368126f8a8ae" have entirely different histories.

51 changed files with 133 additions and 4580 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 8ae12c898f4042949bc5cc317c63d77d
PrefabImporter:
externalObjects: {}
userData:
assetBundleName: uiimageselectmap_prefab
assetBundleVariant:

View File

@ -423,34 +423,4 @@ public class Utility
list[j] = temp;
}
}
// 该方法用于打乱当前脚本所挂载物体的子物体顺序
public static void ShuffleChildObjects(Transform parent)
{
List<Transform> children = new List<Transform>();
for (int i = 0; i < parent.childCount; i++)
{
children.Add(parent.GetChild(i));
}
// 打乱子物体数组的顺序
for (int i = 0; i < children.Count; i++)
{
int randomIndex = UnityEngine.Random.Range(i, children.Count);
Transform temp = children[randomIndex];
children[randomIndex] = children[i];
children[i] = temp;
}
// 按照打乱后的顺序重新设置子物体的顺序
for (int i = 0; i < children.Count; i++)
{
children[i].SetSiblingIndex(i);
}
}
}

View File

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

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: fa05fa85bd33f6c4ca626c1e0317d53d
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,975 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.37311953, g: 0.38074014, b: 0.3587274, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 256
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 1
m_PVRDenoiserTypeDirect: 1
m_PVRDenoiserTypeIndirect: 1
m_PVRDenoiserTypeAO: 1
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_LightingSettings: {fileID: 0}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 3
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
buildHeightMesh: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &377343312
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 377343313}
m_Layer: 5
m_Name: CanvasPanel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &377343313
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 377343312}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2114871786}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &801682693
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 801682694}
- component: {fileID: 801682696}
- component: {fileID: 801682695}
m_Layer: 5
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &801682694
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 801682693}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2114871786}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &801682695
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 801682693}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name:
m_EditorClassIdentifier:
m_SendPointerHoverToParent: 1
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 1
--- !u!114 &801682696
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 801682693}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 5
--- !u!1 &995027251
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 995027252}
m_Layer: 5
m_Name: Bg
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &995027252
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 995027251}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2114871786}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1084276686
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1084276689}
- component: {fileID: 1084276687}
- component: {fileID: 1084276688}
m_Layer: 5
m_Name: UICamera
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!20 &1084276687
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1084276686}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 3
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_Iso: 200
m_ShutterSpeed: 0.005
m_Aperture: 16
m_FocusDistance: 10
m_FocalLength: 50
m_BladeCount: 5
m_Curvature: {x: 2, y: 11}
m_BarrelClipping: 0.25
m_Anamorphism: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 1
orthographic size: 5
m_Depth: 99
m_CullingMask:
serializedVersion: 2
m_Bits: 32
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 0
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!124 &1084276688
Behaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1084276686}
m_Enabled: 1
--- !u!4 &1084276689
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1084276686}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -100}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2114871786}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1126280010
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1126280011}
m_Layer: 5
m_Name: Common
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1126280011
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1126280010}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2114871786}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1161286720
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1161286721}
- component: {fileID: 1161286724}
- component: {fileID: 1161286723}
- component: {fileID: 1161286722}
m_Layer: 5
m_Name: RightBottom
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1161286721
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1161286720}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2114871786}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 1828.92, y: 0}
m_Pivot: {x: 1, y: -0.000000461936}
--- !u!222 &1161286722
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1161286720}
m_CullTransparentMesh: 1
--- !u!114 &1161286723
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1161286720}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalFit: 0
m_VerticalFit: 2
--- !u!114 &1161286724
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1161286720}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 0
m_Right: 0
m_Top: 10
m_Bottom: 10
m_ChildAlignment: 8
m_Spacing: 10
m_ChildForceExpandWidth: 0
m_ChildForceExpandHeight: 0
m_ChildControlWidth: 1
m_ChildControlHeight: 1
m_ChildScaleWidth: 0
m_ChildScaleHeight: 1
m_ReverseArrangement: 1
--- !u!1 &1320020531
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1320020532}
m_Layer: 5
m_Name: PopUI
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1320020532
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1320020531}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1.0000799, y: 1.0000799, z: 1.0000799}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2114871786}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1349401529
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1349401531}
- component: {fileID: 1349401530}
m_Layer: 0
m_Name: TestUIImageSelectMap
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1349401530
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1349401529}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b6b7a3e7dc894eaca1053ef166cdad33, type: 3}
m_Name:
m_EditorClassIdentifier:
PanelName: UIImageSelectMap
Level: 0
mOtherPanels: []
--- !u!4 &1349401531
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1349401529}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1635592603
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1635592604}
- component: {fileID: 1635592605}
m_Layer: 5
m_Name: Manager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1635592604
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1635592603}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2114871786}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1635592605
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1635592603}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5dc84f25d84334e168bf64050b91e1fb, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1661191870
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1661191871}
- component: {fileID: 1661191872}
m_Layer: 5
m_Name: Design
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1661191871
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1661191870}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 8931408189093656909}
m_Father: {fileID: 2114871786}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1661191872
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1661191870}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6eba024ea32574239b57b098f1dc6282, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &2114871781
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2114871786}
- component: {fileID: 2114871785}
- component: {fileID: 2114871784}
- component: {fileID: 2114871783}
- component: {fileID: 2114871782}
m_Layer: 5
m_Name: UIRoot
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &2114871782
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2114871781}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d2db7fffd623c478eba3d2cb84034d2f, type: 3}
m_Name:
m_EditorClassIdentifier:
UICamera: {fileID: 1084276687}
Canvas: {fileID: 2114871785}
CanvasScaler: {fileID: 2114871784}
GraphicRaycaster: {fileID: 2114871783}
Bg: {fileID: 995027252}
Common: {fileID: 1126280011}
PopUI: {fileID: 1320020532}
RightBottom: {fileID: 1161286721}
CanvasPanel: {fileID: 377343313}
--- !u!114 &2114871783
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2114871781}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 0
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &2114871784
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2114871781}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 1
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 1920, y: 1080}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0.5
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 0
--- !u!223 &2114871785
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2114871781}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 1084276687}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 1
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 100
m_TargetDisplay: 0
--- !u!224 &2114871786
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2114871781}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 995027252}
- {fileID: 1126280011}
- {fileID: 1161286721}
- {fileID: 1320020532}
- {fileID: 377343313}
- {fileID: 1661191871}
- {fileID: 801682694}
- {fileID: 1084276689}
- {fileID: 1635592604}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!1001 &8931408189093656908
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 1661191871}
m_Modifications:
- target: {fileID: 1318390635077869678, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1318390635077869678, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1318390635077869678, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2525946039026654729, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2525946039026654729, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5249969822239494612, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5249969822239494612, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5249969822239494612, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5249969822239494612, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5702230170007598446, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_HorizontalScrollbar
value:
objectReference: {fileID: 0}
- target: {fileID: 6336473892143704609, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0.0009040238
objectReference: {fileID: 0}
- target: {fileID: 6608813160943937009, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6608813160943937009, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6690386520824484871, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0.0009040238
objectReference: {fileID: 0}
- target: {fileID: 7471371802902961118, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7471371802902961118, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8048533352694695708, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8048533352694695708, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8636616114181872079, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_Name
value: UIImageSelectMap
objectReference: {fileID: 0}
- target: {fileID: 8684970269249796938, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8684970269249796938, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
--- !u!224 &8931408189093656909 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 3838833872239473580, guid: 8ae12c898f4042949bc5cc317c63d77d, type: 3}
m_PrefabInstance: {fileID: 8931408189093656908}
m_PrefabAsset: {fileID: 0}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 2114871786}
- {fileID: 1349401531}

View File

@ -23,19 +23,6 @@ namespace XMLTool
public Dictionary<string, string> args = new Dictionary<string, string>();
}
public class ImageSelectMapAction : Action
{
public class Item
{
public string pic;
public string pos;
public string size;
}
public Dictionary<string, string> args = new Dictionary<string, string>();
public List<Item> items = new List<Item>();
}
public class DictionaryCondition : Condition
{

View File

@ -284,11 +284,6 @@ public class ActionHelper
var dictAction = (XMLTool.DictionaryAction)act;
return QFramework.ShowScoreAction.Allocate(dictAction.args);
}
case "ImageSelectMap":
{
var dictAction = (XMLTool.ImageSelectMapAction)act;
return QFramework.ImageSelectMapAction.Allocate(dictAction.args,dictAction.items);
}
default:
Debug.LogError($"没有找到此Action的类型{act.Type}");
break;

View File

@ -1,115 +0,0 @@
using QFramework.Example;
using System;
using System.Collections.Generic;
using UnityEngine;
using XMLTool;
namespace QFramework
{
internal class ImageSelectMapAction : IAction
{
public string txt;
public System.Action OnFinished { get; set; }
private ImageSelectMapAction()
{
}
private static readonly SimpleObjectPool<ImageSelectMapAction> mPool =
new SimpleObjectPool<ImageSelectMapAction>(() => new ImageSelectMapAction(), null, 10);
Dictionary<string, string> datas;
List<XMLTool.ImageSelectMapAction.Item> items;
public static ImageSelectMapAction Allocate(Dictionary<string, string> datas, List<XMLTool.ImageSelectMapAction.Item> items, System.Action OnFinished = null)
{
var retNode = mPool.Allocate();
retNode.ActionID = ActionKit.ID_GENERATOR++;
retNode.Deinited = false;
retNode.datas = datas;
retNode.items = items;
retNode.Reset();
retNode.OnFinished = OnFinished;
return retNode;
}
public ulong ActionID { get; set; }
public ActionStatus Status { get; set; }
public void OnStart()
{
UIImageSelectMapData data = new UIImageSelectMapData();
data.totalScore = 0;
if (datas.ContainsKey("totalScore"))
{
float.TryParse(datas["totalScore"], out data.totalScore);
}
data.rightScore = 0;
if (datas.ContainsKey("rightScore"))
{
float.TryParse(datas["rightScore"], out data.rightScore);
}
data.wrongScore = 0;
if (datas.ContainsKey("wrongScore"))
{
float.TryParse(datas["wrongScore"], out data.wrongScore);
}
data.scoreName = datas.ContainsKey("scoreName") ? datas["scoreName"] : "";
data.rightLabel = datas.ContainsKey("rightLabel") ? datas["rightLabel"] : "";
data.wrongLabel = datas.ContainsKey("wrongLabel") ? datas["wrongLabel"] : "";
data.finishedEvent = datas.ContainsKey("finishedEvent") ? datas["finishedEvent"] : "";
data.rightBg = datas.ContainsKey("rightBg") ? datas["rightBg"] : "";
foreach (var item in items)
{
data.items.Add(new UIImageSelectMapData.OptionItem()
{
pic = item.pic,
pos = Utility.GetVector2FromStrArray(item.pos),
size = Utility.GetVector2FromStrArray(item.size)
});
}
UIKit.OpenPanelAsync<UIImageSelectMap>(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() =>
{
this.Finish();
OnFinished?.Invoke();
});
}
public void OnExecute(float dt)
{
}
public void OnFinish()
{
}
public void Reset()
{
Status = ActionStatus.NotStart;
Paused = false;
}
public bool Paused { get; set; }
public void Deinit()
{
if (!Deinited)
{
OnFinished = null;
Deinited = true;
mPool.Recycle(this);
}
}
public bool Deinited { get; set; }
}
}

View File

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 93d6ed89dd2e1974f8712dde5a2c6c31
timeCreated: 1647655796

View File

@ -1,45 +0,0 @@
using QFramework;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using XMLTool;
public class PlayerController : MonoSingleton<PlayerController>
{
private PlayerController() { }
public class HasDevice
{
public Device device;
public int count;
}
Dictionary<string, HasDevice> hasDevices = new Dictionary<string, HasDevice>();
public void DropDevice(string key, int count = 1)
{
if (hasDevices.ContainsKey(key))
{
hasDevices[key].count -= count;
if (hasDevices[key].count <= 0)
{
hasDevices.Remove(key);
}
}
}
public void PickDevice(string key, int count = 1)
{
if (hasDevices.ContainsKey(key))
{
hasDevices[(string)key].count += count;
}
else
{
hasDevices.Add(key, new HasDevice() { count = count, device = DeviceController.Instance.GetDevice(key) });
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: d963e03aaa61c0241a2a7b3a8e7bf611
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,9 +1,10 @@
using Newtonsoft.Json;
using QFramework;
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.SocialPlatforms.Impl;
using XMLTool;
public class ScoreController : MonoSingleton<ScoreController>
@ -47,40 +48,6 @@ public class ScoreController : MonoSingleton<ScoreController>
}
public string GetModuleDictJson(string name = "", string id = "", string sum = "")
{
var resultDict = new Dictionary<string, object>();
DateTime curTime = DateTime.Now;
resultDict.Add("name", name);
resultDict.Add("id", id);
resultDict.Add("sum", sum);
resultDict.Add("time", curTime.ToString("yyyy.MM.dd"));
resultDict.Add("year", curTime.Year);
resultDict.Add("month", curTime.Month);
foreach (var dataPair in moduleDict)
{
var data = dataPair.Value;
if (data.scoreDict != null)
{
foreach (var scoreStepPair in data.scoreDict)
{
var scoreStep = scoreStepPair.Value;
string key = $"{scoreStep.step}{scoreStep.name}";
resultDict[key] = scoreStep.value;
string value = "\u00A0";
if (string.IsNullOrEmpty(scoreStep.time) == false)
{
value = scoreStep.time;
}
resultDict.Add(key + "Time", value);
}
}
}
return JsonConvert.SerializeObject(resultDict);
}
private void OnStart(OnModuleStart start)
{
@ -117,8 +84,6 @@ public class ScoreController : MonoSingleton<ScoreController>
{
scoreDict[key].value = 0;
}
DateTime currentTime = DateTime.Now;
scoreDict[key].time = currentTime.ToString(scoreDict[key].timeFormat);
}
else
{

View File

@ -1,6 +1,3 @@
using QFramework;
using System;
using System.IO;
using UnityEditor;
using UnityEngine;
@ -34,49 +31,5 @@ public class FixedMainEditor
Menu.SetChecked("Tools/强制Main场景启动", isFixedMain);
return true;
}
[MenuItem("Tools/创建时间锁")]
private static void TimerLock()
{
//创建数据资源文件
//泛型是继承自ScriptableObject的类
TimerLock asset = ScriptableObject.CreateInstance<TimerLock>();
//前一步创建的资源只是存在内存中,现在要把它保存到本地
//通过编辑器API创建一个数据资源文件第二个参数为资源文件在Assets目录下的路径
AssetDatabase.CreateAsset(asset, "Assets/TimerLock.asset");
//保存创建的资源
AssetDatabase.SaveAssets();
//刷新界面
AssetDatabase.Refresh();
}
[MenuItem("Tools/生成Timer文件")]
private static void GeneratorTimer()
{
if (File.Exists(Application.dataPath + "/TimerLock.asset"))
{
string path = "Assets/TimerLock.asset";
var asset = AssetDatabase.LoadAssetAtPath<TimerLock>(path);
if (asset != null)
{
if (string.IsNullOrEmpty(asset.time) == false)
{
//第一次获取获取系统时间
DateTime currentDateTime = DateTime.Now;
string RecordData = currentDateTime.ToString("yyyy-MM-dd HH:mm:ss");
string strMerge = asset.time + "|" + RecordData;
EncryptFileCreator.EncryptAndSaveData(strMerge, "Timer.txt");
}
}
}
//刷新界面
AssetDatabase.Refresh();
}
}
#endif

View File

@ -1,11 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "时间锁", menuName = "创建时间锁/配置文件")]
public class TimerLock : ScriptableObject
{
[Header("软件有效期")]
public string time;
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 3fa014c2238b5a942b96b9f55a3f9841
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -7,20 +7,10 @@ using UnityEditor.Build;
using UnityEditor.Build.Reporting;
using UnityEngine;
public class VirtualFPostProcess : IPostprocessBuildWithReport, IPreprocessBuildWithReport
public class VirtualFPostProcess : IPostprocessBuildWithReport
{
public int callbackOrder => 0;
/// <summary>
/// 构建前生成时间锁
/// </summary>
/// <param name="report"></param>
public void OnPreprocessBuild(BuildReport report)
{
// 生成时间锁
GneratorTimerLock();
}
public void OnPostprocessBuild(BuildReport report)
{
string projectPath = Application.dataPath;
@ -39,32 +29,6 @@ public class VirtualFPostProcess : IPostprocessBuildWithReport, IPreprocessBuild
Debug.LogWarning("δÕÒµ½Êý¾ÝĿ¼: " + dataFolderPath);
}
DeletAssetBundle(buildOutputPath);
AssetDatabase.Refresh();
}
/// <summary>
/// 生成时间锁文件
/// </summary>
public void GneratorTimerLock()
{
if (File.Exists(Application.dataPath + "/TimerLock.asset"))
{
string path = "Assets/TimerLock.asset";
var asset = AssetDatabase.LoadAssetAtPath<TimerLock>(path);
if (asset != null)
{
if (string.IsNullOrEmpty(asset.time) == false)
{
//第一次获取获取系统时间
DateTime currentDateTime = DateTime.Now;
string RecordData = currentDateTime.ToString("yyyy-MM-dd HH:mm:ss");
string strMerge = asset.time + "|" + RecordData;
EncryptFileCreator.EncryptAndSaveData(strMerge, "Timer.txt");
}
}
}
}
/// <summary>
@ -100,7 +64,7 @@ public class VirtualFPostProcess : IPostprocessBuildWithReport, IPreprocessBuild
Debug.LogError($"Directory not found: {path}");
}
}
else if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows || EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows64)
else if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows|| EditorUserBuildSettings.activeBuildTarget == BuildTarget.StandaloneWindows64)
{
string path = Path.Combine(buildOutPutPath, "VirtualFramwork_Data", "StreamingAssets", "AssetBundles");
if (Directory.Exists(path))
@ -128,7 +92,7 @@ public class VirtualFPostProcess : IPostprocessBuildWithReport, IPreprocessBuild
Debug.LogError($"Directory not found: {path}");
}
}
}
@ -181,6 +145,4 @@ public class VirtualFPostProcess : IPostprocessBuildWithReport, IPreprocessBuild
}
return new string(chars);
}
}

View File

@ -9,77 +9,34 @@ public class AsposeHelper : MonoBehaviour
{
//public static void Writer(string json, Action callback = null)
//{
// // 加载Word文档
// Document doc = new Document(Global.reportDemoPath);
// JObject jObject = JObject.Parse(json);
// foreach (JProperty property in jObject.Properties())
// {
// string key = property.Name;
// string value = property.Value.ToString();
// doc.Range.Replace($"{{{key}}}", $"{value}", new FindReplaceOptions());
// }
// string filePath = ChinarFileController.SaveProject(Path.GetFileName(Global.reportDemoPath).Split('.')[1]);
// if (string.IsNullOrEmpty(filePath) == false)
// {
// doc.Save(filePath);
// }
// callback?.Invoke();
// // 替换文本
// //SaveWithDialog(doc, callback);
// //Debug.Log("文档处理完成,新文档已保存到: " + outputFilePath);
//}
public static void Writer(string json, Action callback = null)
{
// ¼ÓÔØWordÎĵµ
Document doc = new Document(Global.reportDemoPath);
JToken jToken = JToken.Parse(json);
TraverseAndReplace(jToken, doc);
JObject jObject = JObject.Parse(json);
foreach (JProperty property in jObject.Properties())
{
string key = property.Name;
string value = property.Value.ToString();
doc.Range.Replace($"{{{key}}}", $"{value}", new FindReplaceOptions());
}
string filePath = ChinarFileController.SaveProject(Path.GetFileName(Global.reportDemoPath).Split('.')[1]);
if (!string.IsNullOrEmpty(filePath))
if (string.IsNullOrEmpty(filePath) == false)
{
doc.Save(filePath);
}
callback?.Invoke();
// 替换文本
//SaveWithDialog(doc, callback);
//Debug.Log("文档处理完成,新文档已保存到: " + outputFilePath);
}
private static void TraverseAndReplace(JToken jToken, Document doc)
{
if (jToken.Type == JTokenType.Object)
{
foreach (JProperty property in ((JObject)jToken).Properties())
{
if (property.Value.Type == JTokenType.Object || property.Value.Type == JTokenType.Array)
{
TraverseAndReplace(property.Value, doc);
}
else
{
string key = property.Name;
string value = property.Value.ToString();
doc.Range.Replace($"{{{key}}}", $"{value}", new FindReplaceOptions());
}
}
}
else if (jToken.Type == JTokenType.Array)
{
foreach (JToken item in jToken)
{
TraverseAndReplace(item, doc);
}
}
}
//private static void SaveWithDialog(Document doc, Action<DialogResult> callback)
//{
// SaveFileDialog dialog = new SaveFileDialog();

View File

@ -1,361 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class WaterfallScrollView : MonoBehaviour
{
[Header("组件引用")]
[SerializeField] private ScrollRect scrollRect;
[SerializeField] private RectTransform viewport;
[SerializeField] private RectTransform content;
[SerializeField] private RectTransform itemPrefab;
[SerializeField] private Image itemImageComponent; // 预制体中的Image组件引用
[Header("瀑布流设置")]
[SerializeField] private int columnCount = 3;
[SerializeField] private float spacingX = 10f;
[SerializeField] private float spacingY = 10f;
[SerializeField] private float paddingLeft = 10f;
[SerializeField] private float paddingRight = 10f;
[SerializeField] private float paddingTop = 10f;
[SerializeField] private float paddingBottom = 10f;
private List<float> columnHeights;
private List<RectTransform> activeItems = new List<RectTransform>();
private Dictionary<int, RectTransform> pooledItems = new Dictionary<int, RectTransform>();
private float itemWidth;
private float viewportHeight;
private float contentHeight;
private int totalItemCount = 0;
private int visibleStartIndex = 0;
private int visibleEndIndex = 0;
public List<Sprite> sprites = new List<Sprite>(); // 存储所有精灵
private List<float> itemHeights = new List<float>(); // 存储每项的计算高度
private void Start()
{
Initialize();
scrollRect.onValueChanged.AddListener(OnScroll);
// 初始检查sprites是否有内容
if (sprites.Count > 0)
{
SetContent(sprites);
}
else
{
ClearContent();
}
}
private void Initialize()
{
// 计算列宽和间距
float availableWidth = viewport.rect.width - paddingLeft - paddingRight - (columnCount - 1) * spacingX;
itemWidth = availableWidth / columnCount;
// 初始化列高度数组
columnHeights = new List<float>(new float[columnCount]);
// 记录视口高度用于计算可见项
viewportHeight = viewport.rect.height;
}
// 使用提供的精灵列表设置内容
public void SetContent(List<Sprite> sprites)
{
this.sprites = sprites ?? new List<Sprite>();
totalItemCount = this.sprites.Count;
// 如果没有精灵,清空内容
if (totalItemCount == 0)
{
ClearContent();
return;
}
// 计算每项的高度
CalculateItemHeights();
// 计算内容高度
contentHeight = CalculateContentHeight();
content.sizeDelta = new Vector2(content.sizeDelta.x, contentHeight);
// 更新可见项
UpdateVisibleItems();
}
// 清空所有内容
public void ClearContent()
{
// 回收所有活动项
foreach (var item in activeItems)
{
item.gameObject.SetActive(false);
}
activeItems.Clear();
// 重置内容大小
content.sizeDelta = new Vector2(content.sizeDelta.x, 0);
totalItemCount = 0;
itemHeights.Clear();
}
private void CalculateItemHeights()
{
itemHeights.Clear();
foreach (Sprite sprite in sprites)
{
if (sprite != null)
{
// 计算保持宽高比的高度
float aspectRatio = sprite.rect.width / sprite.rect.height;
float height = itemWidth / aspectRatio;
itemHeights.Add(height);
}
else
{
// 如果精灵为空,使用默认高度
itemHeights.Add(150f);
}
}
}
private float CalculateContentHeight()
{
// 重置列高度
for (int i = 0; i < columnCount; i++)
{
columnHeights[i] = paddingTop;
}
// 模拟布局计算内容高度
for (int i = 0; i < totalItemCount; i++)
{
float height = itemHeights[i];
int shortestColumnIndex = GetShortestColumn();
columnHeights[shortestColumnIndex] += height + spacingY;
}
// 找出最高的列作为内容高度
float maxHeight = 0;
foreach (float height in columnHeights)
{
if (height > maxHeight)
{
maxHeight = height;
}
}
return maxHeight + paddingBottom - spacingY;
}
private int GetShortestColumn()
{
int shortestIndex = 0;
float minHeight = columnHeights[0];
for (int i = 1; i < columnCount; i++)
{
if (columnHeights[i] < minHeight)
{
minHeight = columnHeights[i];
shortestIndex = i;
}
}
return shortestIndex;
}
private void UpdateVisibleItems()
{
// 如果没有项目,不执行任何操作
if (totalItemCount == 0)
return;
// 计算当前可视区域的上下边界
float viewportTop = -content.anchoredPosition.y;
float viewportBottom = viewportTop + viewportHeight;
// 重置列高度用于布局计算
for (int i = 0; i < columnCount; i++)
{
columnHeights[i] = paddingTop;
}
// 计算可见项的起始和结束索引
int newVisibleStartIndex = 0;
int newVisibleEndIndex = totalItemCount - 1;
float currentYPosition = 0;
// 找到第一个可见项的索引
for (int i = 0; i < totalItemCount; i++)
{
float height = itemHeights[i];
int columnIndex = GetShortestColumn();
float xPosition = paddingLeft + columnIndex * (itemWidth + spacingX);
float yPosition = -columnHeights[columnIndex]; // 注意UI坐标是向下为正
columnHeights[columnIndex] += height + spacingY;
float itemTop = yPosition;
float itemBottom = yPosition - height;
// 如果项在可视区域内或者与可视区域有交集
if (itemBottom <= viewportBottom && itemTop >= viewportTop - viewportHeight) // 多加载一个屏幕高度的内容
{
newVisibleStartIndex = i;
break;
}
}
// 重置列高度再次计算
for (int i = 0; i < columnCount; i++)
{
columnHeights[i] = paddingTop;
}
// 找到最后一个可见项的索引
for (int i = 0; i < totalItemCount; i++)
{
float height = itemHeights[i];
int columnIndex = GetShortestColumn();
float xPosition = paddingLeft + columnIndex * (itemWidth + spacingX);
float yPosition = -columnHeights[columnIndex]; // 注意UI坐标是向下为正
columnHeights[columnIndex] += height + spacingY;
float itemTop = yPosition;
float itemBottom = yPosition - height;
// 如果项在可视区域内或者与可视区域有交集
if (itemBottom <= viewportBottom + viewportHeight && itemTop >= viewportTop) // 多加载一个屏幕高度的内容
{
newVisibleEndIndex = i;
}
else if (i > newVisibleStartIndex) // 已经找到起始索引后才开始判断结束
{
break;
}
}
// 如果可见项范围没有变化则不更新
if (newVisibleStartIndex == visibleStartIndex && newVisibleEndIndex == visibleEndIndex)
{
return;
}
visibleStartIndex = newVisibleStartIndex;
visibleEndIndex = newVisibleEndIndex;
// 回收不再可见的项
RecycleInvisibleItems();
// 重置列高度再次计算,这次用于实际布局
for (int i = 0; i < columnCount; i++)
{
columnHeights[i] = paddingTop;
}
// 创建或更新可见项
for (int i = 0; i < totalItemCount; i++)
{
float height = itemHeights[i];
int columnIndex = GetShortestColumn();
float xPosition = paddingLeft + columnIndex * (itemWidth + spacingX);
float yPosition = -columnHeights[columnIndex]; // 注意UI坐标是向下为正
columnHeights[columnIndex] += height + spacingY;
// 只处理可见范围内的项
if (i >= visibleStartIndex && i <= visibleEndIndex)
{
CreateOrUpdateItem(i, xPosition, yPosition, itemWidth, height);
}
}
}
private void CreateOrUpdateItem(int index, float x, float y, float width, float height)
{
RectTransform item;
if (!pooledItems.TryGetValue(index, out item))
{
// 创建新项
item = Instantiate(itemPrefab, content);
item.name = "Item_" + index;
pooledItems[index] = item;
activeItems.Add(item);
}
else if (!activeItems.Contains(item))
{
// 从池中取出
item.gameObject.SetActive(true);
activeItems.Add(item);
}
// 设置位置和大小
item.anchorMin = new Vector2(0, 1);
item.anchorMax = new Vector2(0, 1);
item.pivot = new Vector2(0, 1);
item.anchoredPosition = new Vector2(x, y);
item.sizeDelta = new Vector2(width, height);
// 更新项内容
UpdateItemContent(item, index);
}
private void UpdateItemContent(RectTransform item, int index)
{
// 获取Image组件
Image image = item.GetComponentInChildren<Image>();
if (image == null && itemImageComponent != null)
{
// 如果没有找到Image组件使用预制体中的引用
image = Instantiate(itemImageComponent, item);
image.rectTransform.anchorMin = Vector2.zero;
image.rectTransform.anchorMax = Vector2.one;
image.rectTransform.sizeDelta = Vector2.zero;
}
if (image && index < sprites.Count && sprites[index] != null)
{
// 设置精灵
image.sprite = sprites[index];
image.SetNativeSize();
// 设置Image组件为保持宽高比
image.preserveAspect = true;
}
}
private void RecycleInvisibleItems()
{
// 找出需要回收的项
List<RectTransform> itemsToRecycle = new List<RectTransform>();
foreach (RectTransform item in activeItems)
{
string[] nameParts = item.name.Split('_');
if (nameParts.Length >= 2 && int.TryParse(nameParts[1], out int itemIndex))
{
if (itemIndex < visibleStartIndex || itemIndex > visibleEndIndex)
{
itemsToRecycle.Add(item);
}
}
}
// 回收项
foreach (RectTransform item in itemsToRecycle)
{
item.gameObject.SetActive(false);
activeItems.Remove(item);
}
}
private void OnScroll(Vector2 scrollPosition)
{
UpdateVisibleItems();
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 2a86eb889d0df8142b20f98a27e5deb4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

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

View File

@ -1,139 +0,0 @@
using System;
using System.Collections;
using System.IO;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.UI;
public class DateManager : MonoBehaviour
{
private string EndTimer;//结束时间
private string RecordData;
public GameObject ui;
public TextMeshProUGUI text;
public Button btn;
private void Awake()
{
ui.gameObject.SetActive(false);
btn.onClick.AddListener(() =>
{
Application.Quit();
});
#if UNITY_WEBGL
StartCoroutine(WebUpdateTime());
#else
UpdateTime(DecryptFileReader.ReadAndDecryptData("Timer.txt"), ShowTip, ShowTip, () =>
{
gameObject.SetActive(false);
});
#endif
}
public void ShowTip(string str)
{
gameObject.SetActive(true);
ui.SetActive(true);
text.text = str;
}
public IEnumerator WebUpdateTime()
{
string path = Path.Combine(Application.streamingAssetsPath, "Timer.txt");
using (UnityWebRequest request = new UnityWebRequest(path))
{
request.downloadHandler = new DownloadHandlerBuffer();
yield return request.SendWebRequest();
if (string.IsNullOrEmpty(request.error))
{
string datas = DecryptFileReader.ReadAndDecryptData(request.downloadHandler.data);
UpdateTime(datas, ShowTip, ShowTip, () =>
{
gameObject.SetActive(false);
});
}
else
{
Debug.LogError(request.error);
}
}
}
/// <summary>
/// 更新系统时间
/// </summary>
public void UpdateTime(string datas, UnityAction<string> error = null, UnityAction<string> timeOut = null, UnityAction updateTimer = null)
{
try
{
EndTimer = datas.Split('|')[0];
RecordData = datas.Split('|')[1];
//第一次获取获取系统时间
DateTime currentDateTime = DateTime.Now;
string Data = currentDateTime.ToString("yyyy-MM-dd HH:mm:ss");
if (DateTime.TryParse(RecordData, out DateTime recordDateTime) && DateTime.TryParse(Data, out DateTime nowDateTime))
{
if (recordDateTime > nowDateTime)
{
Debug.Log("仿真文件被损坏,请联系管理员进行修复");
error?.Invoke("仿真文件被损坏,请联系管理员进行修复");
}
else
{
#if !UNITY_WEBGL
//把上一次存储得系统时间更新到最新
string timer = "Timer.txt";
RecordData = Data;
string strMerge = EndTimer + "|" + RecordData;
EncryptFileCreator.EncryptAndSaveData(strMerge, timer);
#endif
updateTimer?.Invoke();
}
}
}
catch (Exception e)
{
Debug.LogError($"数据出错: {e.Message}");
error?.Invoke($"数据出错: {e.Message}");
return;
}
if (JudgeExpire())
{
Debug.Log("请联系管理员进行升级");
timeOut?.Invoke("请联系管理员进行升级");
return;
}
}
/// <summary>
/// 判断是否到期
/// </summary>
/// <returns></returns>
public bool JudgeExpire()
{
if (DateTime.TryParse(EndTimer, out DateTime endDataTime) && DateTime.TryParse(RecordData, out DateTime recordDateTime))
{
//结束日期小于目前日期代表到期
if (endDataTime < recordDateTime)
{
return true;
}
}
return false;
}
/// <summary>
/// 给客户打包的时候,需要设置EndTimer,然后运行一次生成文件并注释掉
/// </summary>
public void CreatTimer()
{
//第一次获取获取系统时间
DateTime currentDateTime = DateTime.Now;
RecordData = currentDateTime.ToString("yyyy-MM-dd HH:mm:ss");
string strMerge = EndTimer + "|" + RecordData;
EncryptFileCreator.EncryptAndSaveData(strMerge, "Timer.txt");
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 718cf7f3f1b16f141ab751a37af8cae1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,47 +0,0 @@
using System.IO;
using System.Security.Cryptography;
using System.Text;
using UnityEngine;
public class DecryptFileReader
{
private static byte[] key = Encoding.UTF8.GetBytes("Sixteen byte key"); // 加密密钥,需与加密时一致
private static byte[] iv = Encoding.UTF8.GetBytes("InitializationVe"); // 确保IV长度为16字节
public static string ReadAndDecryptData(string filePath)
{
string fullPath = Path.Combine(Application.streamingAssetsPath, filePath);
if (File.Exists(filePath)) return "";
// 读取加密文件
byte[] encryptedData = File.ReadAllBytes(fullPath);
return ReadAndDecryptData(encryptedData);
}
public static string ReadAndDecryptData(byte[] encryptedData)
{
// 创建AES解密器
using (Aes aesAlg = Aes.Create())
{
aesAlg.Key = key;
aesAlg.IV = iv;
ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);
// 创建内存流和加密流
using (MemoryStream msDecrypt = new MemoryStream(encryptedData))
{
using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read))
{
byte[] decryptedBytes = new byte[encryptedData.Length];
int decryptedByteCount = csDecrypt.Read(decryptedBytes, 0, decryptedBytes.Length);
// 将解密后的数据转换为字符串
string decryptedData = Encoding.UTF8.GetString(decryptedBytes, 0, decryptedByteCount);
return decryptedData;
}
}
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 354bc54210a77764ebad2d49b5e927ba
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,56 +0,0 @@
using System.IO;
using System.Security.Cryptography;
using System.Text;
using UnityEngine;
public class EncryptFileCreator
{
private static byte[] key = Encoding.UTF8.GetBytes("Sixteen byte key"); // 加密密钥需16字节
private static byte[] iv = Encoding.UTF8.GetBytes("InitializationVe"); // 确保IV长度为16字节
public static void EncryptAndSaveData(string data,string path)
{
string filePath = Path.Combine(Application.streamingAssetsPath, path);
if (!File.Exists(filePath))
{
try
{
// 创建文件
File.WriteAllText(filePath, "");
Debug.Log("文件已创建");
}
catch (IOException e)
{
Debug.LogError($"创建文件时出错: {e.Message}");
}
}
// 将数据转换为字节数组
byte[] plainText = Encoding.UTF8.GetBytes(data);
// 创建AES加密器
using (Aes aesAlg = Aes.Create())
{
aesAlg.Key = key;
aesAlg.IV = iv;
ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);
// 创建内存流和加密流
using (MemoryStream msEncrypt = new MemoryStream())
{
using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))
{
csEncrypt.Write(plainText, 0, plainText.Length);
csEncrypt.FlushFinalBlock();
// 获取加密后的数据
byte[] encryptedData = msEncrypt.ToArray();
// 保存加密文件到StreamingAssets文件夹
string fullPath = Path.Combine(Application.streamingAssetsPath, filePath);
File.WriteAllBytes(fullPath, encryptedData);
}
}
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 22f7660ba2e708d4eb33622fe324499b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,73 +0,0 @@
using QFramework;
using System;
using System.Collections;
using UnityEngine;
using UnityEngine.Networking;
public class HttpRestful : MonoSingleton<HttpRestful>
{
public void Get(string url, Action<bool, string> actionResult = null)
{
StartCoroutine(_Get(url, actionResult));
}
private IEnumerator _Get(string url, Action<bool, string> action)
{
using (UnityWebRequest request = UnityWebRequest.Get(url))
{
yield return request.SendWebRequest();
string resstr = "";
if (request.isNetworkError || request.isHttpError)
{
resstr = request.error;
}
else
{
resstr = request.downloadHandler.text;
}
if (action != null)
{
action(request.isHttpError, resstr);
}
}
}
public void Post(string url, string form, Action<bool, DownloadHandler> callBack, string Header = null, string HeaderValue = null, int timeOut = 3)
{
StartCoroutine(_Post(url, form, callBack, Header, HeaderValue, timeOut));
}
public IEnumerator _Post(string url, string form, Action<bool, DownloadHandler> callBack, string Header = null, string HeaderValue = null, int timeOut = 3)
{
//请求链接并将form对象发送到远程服务器
using (UnityWebRequest webRequest = UnityWebRequest.Post(url, form, "application/json"))//;charset=utf-8
{
if (!string.IsNullOrEmpty(Header) && !string.IsNullOrEmpty(HeaderValue))
{
webRequest.SetRequestHeader(Header, HeaderValue);
}
webRequest.timeout = timeOut * 1000;
yield return webRequest.SendWebRequest();
if (webRequest.result!= UnityWebRequest.Result.Success)
{
Debug.Log(webRequest.error);
callBack?.Invoke(false, webRequest.downloadHandler);
}
else
{
callBack?.Invoke(true, webRequest.downloadHandler);
}
//if (webRequest.isHttpError || webRequest.isNetworkError)
//{
// //Debug.LogError("===========");
// callBack?.Invoke(false, null);
//}
//else
//{
// callBack?.Invoke(true, webRequest.downloadHandler);
//}
};
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: cca16177d7a134a43a4fb3320d5b8fc7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,46 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LicenceData
{
public string project_id;
public string user_name;
public string license_code;
public string host_id;
public string duration; //使用时长
public string sign;
}
public class Datas
{
public static string Project_id = "7";
public static string secretKey = "pZNwkYoMRp7MG_O7aGtmA";
public static string UserName;
public static string Licensecode;
public static string Hostid;
public static int Duration;//持续时间
}
[Serializable]
public class License
{
public int id;
public string user_name;
public string license_code;
public int is_authorized;
public string host_id;
public string authorization_at;
public string authorization_end_at;
public string created_at;
public int login_count;
public int duration;
public string last_login;
}
[Serializable]
public class LicenseValidationResponse
{
public string status;
public string message;
public License license;
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 8f40d10c2dcbad941ac179b38fde96bd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,180 +0,0 @@
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Security.Cryptography;
using System.Text;
using UnityEngine;
public class LicenseManager : MonoBehaviour
{
private Dictionary<string, string> Data = new();
private LicenseValidationResponse LicenseRes = new LicenseValidationResponse();
private string Hostid = "";
public void Init()
{
Hostid = GetPhysicalAddress();
Datas.Hostid = Hostid;
}
public LicenceData GetLicenceData(string projectid, string userName, string licensecode, string hostid, int duration)
{
Data.Clear();
LicenceData licence = new LicenceData();
licence.project_id = projectid;
licence.user_name = userName;
licence.license_code = licensecode;
licence.host_id = hostid;
licence.duration = duration.ToString();
if (!Data.ContainsKey("project_id"))
{
Data.Add("project_id", licence.project_id);
}
if (!Data.ContainsKey("user_name"))
{
Data.Add("user_name", licence.user_name);
}
if (!Data.ContainsKey("license_code"))
{
Data.Add("license_code", licence.license_code);
}
if (!Data.ContainsKey("host_id"))
{
Data.Add("host_id", licence.host_id);
}
if (!Data.ContainsKey("duration"))
{
Data.Add("duration", licence.duration);
}
licence.sign = GenerateSignature(Datas.secretKey, Data);
return licence;
}
/// <summary>
/// 请求
/// </summary>
/// <param name="licence"></param>
/// <param name="callBack"></param>
public void LicensePost(Action<bool> callBack = null)
{
LicenceData licence = GetLicenceData(Datas.Project_id, Datas.UserName, Datas.Licensecode, Datas.Hostid, Datas.Duration);
string json = JsonConvert.SerializeObject(licence);
HttpRestful.Instance.Post("https://locallicense.zxkedu.com/api/license/validate/", json, (m, n) =>
{
JsonConvert.DeserializeObject(n.text);
if (LicenseRes.status == "success")
{
EncryptedFile();
}
callBack.Invoke(m);
});
}
/// <summary>
/// 生成密匙
/// </summary>
/// <param name="secretKey"></param>
/// <param name="data"></param>
/// <returns></returns>
public string GenerateSignature(string secretKey, Dictionary<string, string> data)
{
// 添加当前时间戳
//string timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString();
//获取当前时间戳并四舍五入到最近的分钟
long timestamp = (long)(DateTimeOffset.UtcNow.ToUnixTimeSeconds() / 60) * 60;
//long timestamp = (long)(GetTimestamp() / 60) * 60;
if (!data.ContainsKey("timestamp"))
{
data.Add("timestamp", timestamp.ToString());
}
else
{
data["timestamp"] = timestamp.ToString();
}
// 对键值对进行排序
var sortedData = data.OrderBy(kvp => kvp.Key);
Debug.Log("sortedData对键值对进行排序:" + sortedData);
// 构建查询字符串
string queryString = string.Join("&", sortedData.Select(kvp => $"{kvp.Key}={kvp.Value}"));
Debug.Log("queryString构建查询字符串:" + queryString);
// 使用HMAC-SHA256生成签名
using (var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(secretKey)))
{
byte[] hash = hmac.ComputeHash(Encoding.UTF8.GetBytes(queryString));
Debug.Log("生成签名:" + BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant());
return BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant();
}
}
public void StartSetDuration()
{
if (gameObject.activeSelf)
{
StartCoroutine(SetDuration(60f));
}
}
IEnumerator SetDuration(float times)
{
while (true)
{
yield return new WaitForSeconds(times);
Datas.Duration++;
LicensePost();
Datas.Duration = 0;
}
}
public string GetMachineGuid()
{
if (string.IsNullOrEmpty(Hostid))
{
NetworkInterface[] nis = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface ni in nis)
{
if (ni.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 ||
ni.NetworkInterfaceType == NetworkInterfaceType.Ethernet)
{
Hostid = ni.GetPhysicalAddress().ToString();
break;
}
}
}
return Hostid;
}
string GetPhysicalAddress()
{
//string physicalAddress = "";
//NetworkInterface[] nis = NetworkInterface.GetAllNetworkInterfaces();
//foreach (NetworkInterface ni in nis)
//{
// if (ni.NetworkInterfaceType == NetworkInterfaceType.Ethernet && ni.OperationalStatus == OperationalStatus.Up)
// {
// physicalAddress = ni.GetPhysicalAddress().ToString();
// break;
// }
//}
return SystemInfo.deviceUniqueIdentifier;
}
/// <summary>
/// 本地存储Hostid
/// </summary>
public void EncryptedFile()
{
string dataToEncrypt = Datas.UserName + "|" + Datas.Licensecode + "|";
EncryptFileCreator.EncryptAndSaveData(dataToEncrypt, "encryptedData.txt");
}
/// <summary>
/// 读取Hostid
/// </summary>
/// <returns></returns>
public string ReadDecryptedFile()
{
string decryptedData = DecryptFileReader.ReadAndDecryptData("encryptedData.txt");
return decryptedData;
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 13a2f840c2d90a44b8473ca7cf9adef1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,55 +0,0 @@
using System;
using UnityEngine;
using UnityEngine.UI;
using QFramework;
namespace QFramework.Example
{
// Generate Id:b499f0f9-a71b-40ff-a499-a5e4defad39f
public partial class UIImageSelectMap
{
public const string Name = "UIImageSelectMap";
[SerializeField]
public RectTransform LeftContent;
[SerializeField]
public UnityEngine.UI.Image LeftItem;
[SerializeField]
public UnityEngine.UI.Image RightItem;
[SerializeField]
public RectTransform RightContent;
private UIImageSelectMapData mPrivateData = null;
protected override void ClearUIComponents()
{
LeftContent = null;
LeftItem = null;
RightItem = null;
RightContent = null;
mData = null;
}
public UIImageSelectMapData Data
{
get
{
return mData;
}
}
UIImageSelectMapData mData
{
get
{
return mPrivateData ?? (mPrivateData = new UIImageSelectMapData());
}
set
{
mUIData = value;
mPrivateData = value;
}
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 30b3cad2e23c39b43befa7ffb3bae172
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,188 +0,0 @@
using UnityEngine;
using UnityEngine.UI;
using QFramework;
using System.Collections.Generic;
using UnityEngine.EventSystems;
using System;
namespace QFramework.Example
{
public class UIImageSelectMapData : UIPanelData
{
public class OptionItem
{
public string pic;
public Vector2 pos;
public Vector2 size;
}
public string scoreName;
public float totalScore;
public float rightScore;
public float wrongScore;
public string rightLabel;
public string wrongLabel;
public string finishedEvent;
public string rightBg;
public List<OptionItem> items = new List<OptionItem>();
}
public partial class UIImageSelectMap : UIPanel
{
ResLoader loader;
GameObject moveObj;
GameObject enterRight;
GameObject leftDragObj;
Dictionary<GameObject, UIImageSelectMapData.OptionItem> itemDatas = new Dictionary<GameObject, UIImageSelectMapData.OptionItem>();
Dictionary<GameObject, GameObject> leftObjAndRightObj = new Dictionary<GameObject, GameObject>();
protected override void OnInit(IUIData uiData = null)
{
mData = uiData as UIImageSelectMapData ?? new UIImageSelectMapData();
// please add init code here
loader = ResLoader.Allocate();
}
protected override void OnOpen(IUIData uiData = null)
{
mData = uiData as UIImageSelectMapData ?? new UIImageSelectMapData();
LeftContent.RemoveAllChildren();
RightContent.RemoveAllChildren();
itemDatas.Clear();
leftObjAndRightObj.Clear();
foreach (var item in mData.items)
{
var leftObj = GameObject.Instantiate(LeftItem, LeftContent);
leftObj.name = item.pic;
var path = Global.imagePath + item.pic;
loader.Add2Load(path.ToNetImageResName(), (success, res) =>
{
if (success)
{
leftObj.transform.Find("Pic").GetComponent<Image>().sprite = Utility.GetSprite(res.Asset as Texture2D);
}
});
leftObj.OnBeginDragEvent(LeftOnBeginDrag);
leftObj.OnDragEvent(LeftOnDrag);
leftObj.OnEndDragEvent(LeftOnEndDrag);
itemDatas.Add(leftObj.gameObject, item);
var rightObj = GameObject.Instantiate(RightItem, RightContent);
rightObj.name = item.pic;
rightObj.rectTransform.anchoredPosition = item.pos;
rightObj.rectTransform.sizeDelta = item.size;
rightObj.OnPointerEnterEvent(RightOnEnter);
rightObj.OnPointerExitEvent(RightOnExit);
rightObj.OnPointerClickEvent(RightOnClick);
}
var rightBgPath = Global.imagePath + mData.rightBg;
loader.Add2Load(rightBgPath.ToNetImageResName(), (success, res) =>
{
if (success)
{
RightContent.GetComponent<Image>().sprite = Utility.GetSprite(res.Asset as Texture2D);
RightContent.GetComponent<Image>().SetNativeSize();
}
});
loader.LoadAsync();
}
private void RightOnClick(PointerEventData data)
{
Transform trans = data.pointerClick.transform;
if (trans.childCount > 0)
{
var child = trans.GetChild(0).gameObject;
if (leftObjAndRightObj.ContainsKey(child))
{
leftObjAndRightObj[child].SetActive(true);
leftObjAndRightObj.Remove(child);
GameObject.Destroy(child);
trans.GetComponent<Image>().color = new Color(1, 1, 1, 0);
}
else
{
Debug.LogError("没有找到对应的左边物体");
}
}
}
private void RightOnExit(PointerEventData data)
{
enterRight = null;
}
private void RightOnEnter(PointerEventData data)
{
enterRight = data.pointerEnter.gameObject;
}
private void LeftOnBeginDrag(PointerEventData data)
{
leftDragObj = data.pointerDrag;
moveObj = GameObject.Instantiate(leftDragObj, gameObject.transform);
moveObj.name = moveObj.name.Replace("(Clone)", "");
moveObj.GetComponent<RectTransform>().sizeDelta = LeftContent.GetComponent<GridLayoutGroup>().cellSize;
moveObj.GetComponent<Image>().raycastTarget = false;
}
private void LeftOnEndDrag(PointerEventData data)
{
if (enterRight)
{
if (enterRight.name == itemDatas[leftDragObj].pic)
{
Debug.LogError("正确");
enterRight.GetComponent<Image>().color = Color.green;
}
else
{
Debug.LogError("错误");
enterRight.GetComponent<Image>().color = Color.red;
}
moveObj.transform.parent = enterRight.transform;
moveObj.transform.localPosition = Vector3.zero;
leftObjAndRightObj.Add(moveObj, leftDragObj);
leftDragObj.SetActive(false);
}
else
{
GameObject.Destroy(moveObj);
moveObj = null;
}
leftDragObj = null;
}
private void LeftOnDrag(PointerEventData data)
{
//data.pointerDrag.transform.position = Input.mousePosition;
if (moveObj)
{
moveObj.transform.position = Input.mousePosition;
}
}
protected override void OnShow()
{
}
protected override void OnHide()
{
}
protected override void OnClose()
{
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 8fa5d149f86eeb54d89208e36562e2d8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -53,17 +53,13 @@ namespace QFramework.Example
foreach (var item in mData.inputs)
{
GameObject input = GameObject.Instantiate(InputItem.gameObject, InputContent);
input.name = item.name;
input.transform.Find("Name").GetComponent<TextMeshProUGUI>().text = item.name;
var inputField = input.transform.Find("Input").GetComponent<TMP_InputField>();
inputField.onEndEdit.AddListener(value =>
{
if (string.IsNullOrEmpty(item.var) == false)
{
float v = 0;
float.TryParse(value, out v);
VarController.Instance.Set(item.var, v);
}
float v = 0;
float.TryParse(value, out v);
VarController.Instance.Set(item.var, v);
});
}
@ -129,24 +125,12 @@ namespace QFramework.Example
foreach (var item in mData.inputs)
{
var list = item.answer.Split('|').ToList();
if (string.IsNullOrEmpty(item.var))
if (list.Contains(VarController.Instance.Get(item.var).ToString())==false)
{
Transform trans = InputContent.transform.Find(item.name);
string inputStr = trans.Find("Input").GetComponent<TMP_InputField>().text;
if (list.Contains(inputStr))
{
return true;
}
}
else
{
if (list.Contains(VarController.Instance.Get(item.var).ToString()))
{
return true;
}
return false;
}
}
return false;
return true;
}
protected override void OnShow()

View File

@ -1,9 +1,6 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using static LYTWebGLHelper;
namespace QFramework.Example
{
@ -33,7 +30,7 @@ namespace QFramework.Example
#if UNITY_WEBGL&&!UNITY_EDITOR
#if UNITY_WEBGL
ResLoader loader = ResLoader.Allocate();
loader.Add2Load(Global.reportDemoPath.ToLocalBytesResName(), (success, res) =>
{
@ -45,7 +42,7 @@ namespace QFramework.Example
}
});
loader.LoadAsync();
#elif UNITY_STANDALONE_WIN||UNITY_EDITOR
#elif UNITY_STANDALONE_WIN
DownLoad.interactable = false;
AsposeHelper.Writer(GetScoreDataJson(), () =>
{
@ -60,7 +57,11 @@ namespace QFramework.Example
public string GetScoreDataJson()
{
return ScoreController.Instance.GetModuleDictJson(InputName.text, InputId.text, this.Score.text);
var data = new LabReprotData();
data.realname = InputName.text;
data.biaobencaiji_1_buzhou_1 = "[1111]";
string json = JsonConvert.SerializeObject(data);
return json;
}
@ -87,8 +88,6 @@ namespace QFramework.Example
}
List<Expstepvtwolist> datas = new List<Expstepvtwolist>();
int seq = 1;
if (onlyCur)
{
foreach (var item in ScoreController.Instance.GetCurScoreData())
@ -100,17 +99,6 @@ namespace QFramework.Example
obj.transform.Find("Score").GetComponent<TextMeshProUGUI>().text = item.Value.value.ToString();
sum += float.Parse(item.Value.sum);
score += item.Value.value;
datas.Add(new Expstepvtwolist()
{
ExpStepName = item.Value.step + item.Value.name,
maxScore = int.Parse(item.Value.sum),
score = (int)item.Value.value,
startTime = item.Value.time,
endTime = item.Value.time,
seq = seq,
StepState = (int)item.Value.value == float.Parse(item.Value.sum) ? "È«²¿ÕýÈ·" : "ÓдíÎó"
});
seq++;
}
}
else
@ -126,16 +114,6 @@ namespace QFramework.Example
obj.transform.Find("Score").GetComponent<TextMeshProUGUI>().text = item.Value.value.ToString();
sum += float.Parse(item.Value.sum);
score += item.Value.value;
datas.Add(new Expstepvtwolist()
{
ExpStepName = item.Value.step + item.Value.name,
maxScore = int.Parse(item.Value.sum),
score = (int)item.Value.value,
startTime = item.Value.time,
endTime = item.Value.time,
seq = seq
});
seq++;
}
}
}
@ -144,10 +122,6 @@ namespace QFramework.Example
this.Score.text = score.ToString();
this.Sum.text = sum.ToString();
#if UNITY_WEBGL
LYTWebGLHelper.Instance.UpLoadData((int)score, datas.ToArray());
#endif
}
protected override void OnShow()

View File

@ -1,6 +1,5 @@
using QFramework;
using QFramework.Example;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@ -66,8 +65,6 @@ namespace XMLTool
public string BoxColliderCenter { get; set; }
public bool MeshCollider { get; set; }
public int Count = -1;
}
@ -84,8 +81,6 @@ namespace XMLTool
public string sum;
public string bind;
public float value;
public string time;
public string timeFormat = "yyyy-MM-dd HH:mm:ss";
}
@ -444,7 +439,6 @@ namespace XMLTool
name = item.Attribute("name")?.Value,
sum = item.Attribute("sum")?.Value,
bind = item.Attribute("bind")?.Value,
timeFormat = item.Attribute("timeFormat")?.Value,
});
}
}
@ -1680,61 +1674,6 @@ namespace XMLTool
newAction = act;
}
break;
case "ImageSelectMap":
{
var act = new ImageSelectMapAction();
XAttribute scoreName = action.Attribute("scoreName");
if (scoreName != null)
{
act.args.Add("scoreName", scoreName.Value);
}
XAttribute totalScore = action.Attribute("totalScore");
if (totalScore != null)
{
act.args.Add("totalScore", totalScore.Value);
}
XAttribute rightScore = action.Attribute("rightScore");
if (rightScore != null)
{
act.args.Add("rightScore", rightScore.Value);
}
XAttribute wrongScore = action.Attribute("wrongScore");
if (wrongScore != null)
{
act.args.Add("wrongScore", wrongScore.Value);
}
XAttribute rightLabel = action.Attribute("rightLabel");
if (rightLabel != null)
{
act.args.Add("rightLabel", rightLabel.Value);
}
XAttribute wrongLabel = action.Attribute("wrongLabel");
if (wrongLabel != null)
{
act.args.Add("wrongLabel", wrongLabel.Value);
}
XAttribute finishedEvent = action.Attribute("finishedEvent");
if (finishedEvent != null)
{
act.args.Add("finishedEvent", finishedEvent.Value);
}
XAttribute rightBg = action.Attribute("rightBg");
if (rightBg != null)
{
act.args.Add("rightBg", rightBg.Value);
}
foreach (var itemData in action.Elements("Item"))
{
act.items.Add(new ImageSelectMapAction.Item()
{
pic = itemData.Attribute("pic")?.Value,
size = itemData.Attribute("rightSize")?.Value,
pos = itemData.Attribute("rightPos")?.Value
});
}
newAction = act;
}
break;
default:
newAction = new Action();
break;

View File

@ -1 +0,0 @@
ILBJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>05<EFBFBD> <0A><>l<EFBFBD><6C>F<03>)<29>#<1E><><42><17>Uv<55>}]<5D>u.<2E><>\G<>

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 9b4029b9b6235264f8d2594721eb300a
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 6aebd18275784904b8bee1a5e43e817a
guid: 72fe0ae24cde45946914fa10b54896b0
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,17 +1,9 @@
// 名为 "URLParameters.jslib" 的插件文件
mergeInto(LibraryManager.library, {
GetURLParameter: function (name) {
const paramName = UTF8ToString(name);
const search = window.location.search.substring(1);
const params = new URLSearchParams(search);
const value = params.get(paramName);
console.log('GetURLParameter:', value);
if (value) {
var buffer = _malloc((value.length + 1) * 2);
stringToUTF8(value, buffer, (value.length + 1) * 2);
return buffer;
} else {
return 0;
}
var search = window.location.search.substring(1);
var params = new URLSearchParams(search);
var value = params.get(name);
return value ? Pointer_stringify(value) : null;
}
});

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 32677377141e60248a7a2484825ce1d4
guid: b8dbba4c57255fc4495c422b41445cbe
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@ -11,22 +11,21 @@ using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Networking;
public class LYTWebGLHelper : MonoSingleton<LYTWebGLHelper>
public class WebGLHelper : Singleton<WebGLHelper>
{
private LYTWebGLHelper() { }
private WebGLHelper() { }
public class LabData
{
public string GUID;
public string ExpID;
public string HOST = string.Empty;
public string HOST;
public string PARA1;
public string PARA;
public string PARA2;
}
#if UNITY_WEBGL
[DllImport("__Internal")]
private static extern IntPtr GetURLParameter(string name);
#endif
private static extern string GetURLParameter(string name);
string token = string.Empty;
LabData labData = new LabData();
@ -36,40 +35,20 @@ public class LYTWebGLHelper : MonoSingleton<LYTWebGLHelper>
public string uploadUrl;
private void Awake()
{
Init();
}
public void Init()
{
#if UNITY_WEBGL && !UNITY_EDITOR
token = GetURLParameter("token").Replace("%2B", "+");
RSA = Resources.Load<TextAsset>("RSA");
string urlData = Decrypt(token);
var datas = urlData.Split("&");
labData.GUID = datas[0];
labData.ExpID = datas[1];
labData.HOST = datas[2];
labData.PARA1 = datas[3];
labData.PARA = datas[4];
labData.PARA2 = datas[5];
var paramPtr = GetURLParameter("token");
if (paramPtr != IntPtr.Zero)
{
string value = Marshal.PtrToStringUTF8(paramPtr);
//token = value.Replace("%2B", "+");
token = value.Replace(" ", "+");
Marshal.FreeHGlobal(paramPtr); // 释放分配的内存
}
Debug.LogError("获取的:" + token);
#endif
RSA = Resources.Load<TextAsset>("LYTWebGL/RSA");
if (string.IsNullOrEmpty(token) == false)
{
string urlData = Decrypt(token);
var datas = urlData.Split("&");
labData.GUID = datas[0];
labData.ExpID = datas[1];
labData.HOST = datas[2];
labData.PARA1 = datas[3];
labData.PARA = datas[4];
labData.PARA2 = datas[5];
}
uploadUrl = Path.Combine(labData.HOST, "public/Exp/AddScore/");
uploadUrl = Path.Combine(labData.HOST, "host/public/Exp/AddScore/");
}
/// <summary>
/// Decrypts encrypted text given a RSA private key file path.给定路径的 RSA 私钥文件解
@ -104,42 +83,35 @@ public class LYTWebGLHelper : MonoSingleton<LYTWebGLHelper>
public void UpLoadData(int totalScore, Expstepvtwolist[] datas)
public void UpLoadData(int totalScore, List<string> stepNames, List<int> maxScore, List<int> score)
{
if (string.IsNullOrEmpty(labData.GUID))
{
return;
}
var data = new UploadData();
data.GUID = labData.GUID;
int expId = 0;
int.TryParse(labData.ExpID, out expId);
data.ExpID = expId;
data.ExpID = int.Parse(labData.ExpID);
data.score = totalScore;
data.flag = true;
//var list = new List<Expstepvtwolist>();
//for (int i = 0; i < stepNames.Count; i++)
//{
// var step = new Expstepvtwolist();
// step.ExpStepName = stepNames[i];
// step.maxScore = maxScore[i];
// step.score = score[i];
// step.seq = i + 1;
// list.Add(step);
//}
data.ExpStepVTwoList = datas;
StartCoroutine(SendScore(JsonConvert.SerializeObject(data)));
var list = new List<Expstepvtwolist>();
for (int i = 0; i < stepNames.Count; i++)
{
var step = new Expstepvtwolist();
step.ExpStepName = stepNames[i];
step.maxScore = maxScore[i];
step.score = score[i];
}
data.ExpStepVTwoList = list.ToArray();
}
IEnumerator SendScore(string json, UnityAction<string> action = null)
IEnumerator SendScore(string json, UnityAction<string> action)
{
if (string.IsNullOrEmpty(uploadUrl))
{
Debug.LogError("上传接口地址错误:" + uploadUrl);
yield break;
}
Debug.LogError("上传的数据:" + json);
using (UnityWebRequest request = new UnityWebRequest(uploadUrl, "POST"))
{
request.SetRequestHeader("Content-Type", "application/json");
@ -150,7 +122,6 @@ public class LYTWebGLHelper : MonoSingleton<LYTWebGLHelper>
if (request.result == UnityWebRequest.Result.ConnectionError ||
request.result == UnityWebRequest.Result.ProtocolError)
{
Debug.LogError($"Upload failed: {request.uri}");
Debug.LogError($"Upload failed: {request.error}");
Debug.LogError($"Response Code: {request.responseCode}");
}
@ -161,60 +132,58 @@ public class LYTWebGLHelper : MonoSingleton<LYTWebGLHelper>
Debug.Log($"Server Response: {request.downloadHandler.text}");
Response response = JsonConvert.DeserializeObject<Response>(request.downloadHandler.text);
Debug.LogError(response.msg);
action?.Invoke(response.msg);
}
}
}
public class UploadData
{
public string GUID { get; set; }
// 实验 ID
public int ExpID { get; set; }
// 成绩
public int score { get; set; }
// 标志位:默认值 true
public bool flag { get; set; }
// 实验步骤列表
public Expstepvtwolist[] ExpStepVTwoList { get; set; }
}
public class Expstepvtwolist
{
// 实验步骤序号
public int seq { get; set; }
// 实验步骤名称
public string ExpStepName = "";
// 实验步骤状态
public string StepState = "";
// 实验步骤开始时间
public string startTime;
// 实验步骤结束时间
public string endTime;
// 实验步骤合理用时:单位秒
public int expectTime = 0;
// 实验步骤满分0 ~100百分制
public int maxScore = 100;
// 实验步骤得分0 ~100百分制
public int score = 0;
// 实验步骤操作次数
public int repeatCount = 1;
// 步骤评价200 字以内
public string evaluation = "";
// 赋分模型200 字以内
public string scoringModel = "";
// 备注
public string remarks { get; set; }
}
public class Response
{
public string msg;
public bool success;
}
}
public class UploadData
{
public string GUID { get; set; }
// 实验 ID
public int ExpID { get; set; }
// 成绩
public int score { get; set; }
// 标志位:默认值 true
public bool flag { get; set; }
// 实验步骤列表
public Expstepvtwolist[] ExpStepVTwoList { get; set; }
}
public class Expstepvtwolist
{
// 实验步骤序号
public int seq { get; set; }
// 实验步骤名称
public string ExpStepName = "";
// 实验步骤状态
public string StepState = "";
// 实验步骤开始时间
public DateTime startTime = default;
// 实验步骤结束时间
public DateTime endTime = default;
// 实验步骤合理用时:单位秒
public int expectTime = 0;
// 实验步骤满分0 ~100百分制
public int maxScore = 100;
// 实验步骤得分0 ~100百分制
public int score = 0;
// 实验步骤操作次数
public int repeatCount = 1;
// 步骤评价200 字以内
public string evaluation = "";
// 赋分模型200 字以内
public string scoringModel = "";
// 备注
public string remarks { get; set; }
}
public class Response
{
public string msg;
public bool success;
}

View File

@ -294,24 +294,22 @@
</Device>
<!--timeFormat用于控制输出到实验报告的操作时间格式
不需要年月日的时候 HH:mm:ss 即可
-->
<Score>
<Item step="术前准备" name="器械准备" sum="6.5" bind="" timeFormat="yyyy-MM-dd HH:mm:ss"/>
<Item step="术前准备" name="药品准备" sum="5.5" bind="" timeFormat="yyyy-MM-dd HH:mm:ss"/>
<Item step="术前准备" name="耗材准备" sum="15.5" bind="" timeFormat="yyyy-MM-dd HH:mm:ss"/>
<Item step="术前准备" name="主刀人员准备" sum="10" bind="" timeFormat="yyyy-MM-dd HH:mm:ss"/>
<Item step="术前准备" name="手术动物准备" sum="10" bind="" timeFormat="yyyy-MM-dd HH:mm:ss"/>
<Item step="术前准备" name="术部剃毛准备" sum="10" bind="" timeFormat="yyyy-MM-dd HH:mm:ss"/>
<Item step="术前准备" name="术部消毒准备" sum="10" bind="" timeFormat="yyyy-MM-dd HH:mm:ss"/>
<Item step="手术过程" name="测试麻醉程度" sum="10" bind="" timeFormat="yyyy-MM-dd HH:mm:ss"/>
<Item step="手术过程" name="术部开刀" sum="10" bind="" timeFormat="yyyy-MM-dd HH:mm:ss"/>
<Item step="手术过程" name="找出病变小肠" sum="10" bind="" timeFormat="yyyy-MM-dd HH:mm:ss"/>
<Item step="手术过程" name="去除病变小肠" sum="10" bind="" timeFormat="yyyy-MM-dd HH:mm:ss"/>
<Item step="手术过程" name="肠端吻合" sum="10" bind="" timeFormat="yyyy-MM-dd HH:mm:ss"/>
<Item step="手术过程" name="缝合切口" sum="10" bind="" timeFormat="yyyy-MM-dd HH:mm:ss"/>
<Item step="手术过程" name="缝合后处理" sum="10" bind="" timeFormat="yyyy-MM-dd HH:mm:ss"/>
<Item step="术前准备" name="器械准备" sum="6.5" bind=""/>
<Item step="术前准备" name="药品准备" sum="5.5" bind=""/>
<Item step="术前准备" name="耗材准备" sum="15.5" bind=""/>
<Item step="术前准备" name="主刀人员准备" sum="10" bind=""/>
<Item step="术前准备" name="手术动物准备" sum="10" bind=""/>
<Item step="术前准备" name="术部剃毛准备" sum="10" bind=""/>
<Item step="术前准备" name="术部消毒准备" sum="10" bind=""/>
<Item step="手术过程" name="测试麻醉程度" sum="10" bind=""/>
<Item step="手术过程" name="术部开刀" sum="10" bind=""/>
<Item step="手术过程" name="找出病变小肠" sum="10" bind=""/>
<Item step="手术过程" name="去除病变小肠" sum="10" bind=""/>
<Item step="手术过程" name="肠端吻合" sum="10" bind=""/>
<Item step="手术过程" name="缝合切口" sum="10" bind=""/>
<Item step="手术过程" name="缝合后处理" sum="10" bind=""/>
</Score>

View File

@ -970,4 +970,4 @@ PlayerSettings:
hmiLoadingImage: {fileID: 0}
platformRequiresReadableAssets: 0
virtualTexturingSupportEnabled: 0
insecureHttpOption: 2
insecureHttpOption: 0