1
0
mirror of synced 2024-11-24 06:40:11 +01:00

add IPC touch support and fix some issue

This commit is contained in:
xpeng 2022-10-03 22:48:09 +02:00
parent a01f6c9152
commit 99deee5ab6
28 changed files with 523 additions and 87 deletions

View File

@ -84,7 +84,7 @@ Material:
m_Floats:
- _AlphaClip: 0
- _Blend: 0
- _BumpScale: 1
- _BumpScale: 2
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
@ -102,7 +102,7 @@ Material:
- _Parallax: 0.02
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.102
- _Smoothness: 0.247
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1

View File

@ -164,7 +164,8 @@ GameObject:
- component: {fileID: 4545477537435998766}
- component: {fileID: 4914134492775180718}
- component: {fileID: 840120427923841567}
m_Layer: 5
- component: {fileID: 879543074018993664}
m_Layer: 7
m_Name: CheckBoxText
m_TagString: Untagged
m_Icon: {fileID: 0}
@ -284,12 +285,24 @@ MonoBehaviour:
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 18.424858}
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!225 &879543074018993664
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5644598695143456032}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 0
m_BlocksRaycasts: 0
m_IgnoreParentGroups: 0
--- !u!1 &5797589906357710865
GameObject:
m_ObjectHideFlags: 0
@ -300,6 +313,7 @@ GameObject:
m_Component:
- component: {fileID: 6752826324813969372}
- component: {fileID: 5266744100940582161}
- component: {fileID: 907000828593675063}
m_Layer: 5
m_Name: Toggle
m_TagString: Untagged
@ -376,3 +390,15 @@ MonoBehaviour:
m_PersistentCalls:
m_Calls: []
m_IsOn: 1
--- !u!225 &907000828593675063
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5797589906357710865}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 1
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 1

View File

@ -11,7 +11,8 @@ GameObject:
- component: {fileID: 4545477537435998766}
- component: {fileID: 4914134492775180718}
- component: {fileID: 840120427923841567}
m_Layer: 5
- component: {fileID: 997211777649122344}
m_Layer: 7
m_Name: DropdownText
m_TagString: Untagged
m_Icon: {fileID: 0}
@ -131,12 +132,24 @@ MonoBehaviour:
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 18.424858}
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!225 &997211777649122344
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5644598695143456032}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 0
m_BlocksRaycasts: 0
m_IgnoreParentGroups: 0
--- !u!1 &6563380805594740093
GameObject:
m_ObjectHideFlags: 0
@ -1063,6 +1076,7 @@ GameObject:
- component: {fileID: 6563380807134184745}
- component: {fileID: 6563380807134184742}
- component: {fileID: 6563380807134184743}
- component: {fileID: 6673326241402848025}
m_Layer: 5
m_Name: Dropdown
m_TagString: Untagged
@ -1195,6 +1209,18 @@ MonoBehaviour:
m_PersistentCalls:
m_Calls: []
m_AlphaFadeSpeed: 0.15
--- !u!225 &6673326241402848025
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6563380807134184741}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 1
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 1
--- !u!1 &6563380807346052300
GameObject:
m_ObjectHideFlags: 0

View File

@ -47,6 +47,7 @@ GameObject:
m_Component:
- component: {fileID: 4821294829281819036}
- component: {fileID: 4034806853489518429}
- component: {fileID: 485274077402689608}
m_Layer: 5
m_Name: Slider
m_TagString: Untagged
@ -128,6 +129,18 @@ MonoBehaviour:
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
--- !u!225 &485274077402689608
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 953721974989367623}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 1
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 1
--- !u!1 &3499886009287098783
GameObject:
m_ObjectHideFlags: 0
@ -328,7 +341,8 @@ GameObject:
- component: {fileID: 4545477537435998766}
- component: {fileID: 4914134492775180718}
- component: {fileID: 840120427923841567}
m_Layer: 5
- component: {fileID: 8939025946289994825}
m_Layer: 7
m_Name: SliderText
m_TagString: Untagged
m_Icon: {fileID: 0}
@ -448,12 +462,24 @@ MonoBehaviour:
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 18.424858}
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!225 &8939025946289994825
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5644598695143456032}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 0
m_BlocksRaycasts: 0
m_IgnoreParentGroups: 0
--- !u!1 &7399021800224349206
GameObject:
m_ObjectHideFlags: 0

View File

@ -11,7 +11,8 @@ GameObject:
- component: {fileID: 1934694025795579377}
- component: {fileID: 714536851426110238}
- component: {fileID: 961628899725507573}
m_Layer: 5
- component: {fileID: 5570847698151040595}
m_Layer: 7
m_Name: ValueText
m_TagString: Untagged
m_Icon: {fileID: 0}
@ -140,6 +141,18 @@ MonoBehaviour:
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!225 &5570847698151040595
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 685421208154548134}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 0
m_BlocksRaycasts: 0
m_IgnoreParentGroups: 0
--- !u!1 &4618003684357954260
GameObject:
m_ObjectHideFlags: 0
@ -561,6 +574,7 @@ GameObject:
- component: {fileID: 7295078377801303286}
- component: {fileID: 7295078377801303287}
- component: {fileID: 7295078377801303284}
- component: {fileID: 6344396055313976660}
m_Layer: 5
m_Name: Add
m_TagString: Untagged
@ -716,6 +730,18 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 1
--- !u!225 &6344396055313976660
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7295078377801303281}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 1
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 1
--- !u!1 &7295078378124140422
GameObject:
m_ObjectHideFlags: 0
@ -864,7 +890,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 2741c97e96d043044b88f783f1f16738, type: 3}
m_Name:
m_EditorClassIdentifier:
value: 0
Value: 0
isPointerDown: 0
onValueChanged:
m_PersistentCalls:
@ -882,6 +908,7 @@ GameObject:
- component: {fileID: 7295078378630584600}
- component: {fileID: 7295078378630584601}
- component: {fileID: 7295078378630584606}
- component: {fileID: 2853135804545143049}
m_Layer: 5
m_Name: Sub
m_TagString: Untagged
@ -1037,6 +1064,18 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 1
--- !u!225 &2853135804545143049
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7295078378630584603}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 1
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 1
--- !u!1 &7632137574064115561
GameObject:
m_ObjectHideFlags: 0
@ -1050,6 +1089,7 @@ GameObject:
- component: {fileID: 3545593516434423571}
- component: {fileID: 1094262001776545265}
- component: {fileID: 2408283735335238293}
- component: {fileID: 5459784629053661872}
m_Layer: 5
m_Name: Rst
m_TagString: Untagged
@ -1189,3 +1229,15 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 1
--- !u!225 &5459784629053661872
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7632137574064115561}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 1
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 1

View File

@ -709,7 +709,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 11
m_RootOrder: 12
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &90706075 stripped
GameObject:
@ -1213,7 +1213,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1688695918}
m_RootOrder: 1
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
--- !u!136 &182119968
CapsuleCollider:
@ -3812,6 +3812,50 @@ BoxCollider:
serializedVersion: 2
m_Size: {x: 0.00038862746, y: 0.0006574615, z: 0.0028851903}
m_Center: {x: 0.0000000010461952, y: -0.0000064460583, z: -0.0014039748}
--- !u!1 &728980769
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 728980771}
- component: {fileID: 728980770}
m_Layer: 0
m_Name: IPCManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &728980770
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 728980769}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ddced15d8eef61f4d8c51a05cff9f958, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &728980771
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 728980769}
m_LocalRotation: {x: -0, y: 1, z: -0, w: 0}
m_LocalPosition: {x: 0.0421, y: 1.0341, z: -0.055}
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 11
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &733961431
MonoBehaviour:
m_ObjectHideFlags: 0
@ -4419,12 +4463,6 @@ GameObject:
type: 3}
m_PrefabInstance: {fileID: 1774209490}
m_PrefabAsset: {fileID: 0}
--- !u!224 &862273498 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 6563380806834325902, guid: 5da4516f609052242915c455fc208ca2,
type: 3}
m_PrefabInstance: {fileID: 8225331326148453084}
m_PrefabAsset: {fileID: 0}
--- !u!65 &864137101
BoxCollider:
m_ObjectHideFlags: 0
@ -4577,7 +4615,7 @@ GameObject:
- component: {fileID: 910165457}
- component: {fileID: 910165458}
m_Layer: 0
m_Name: Serial
m_Name: TouchManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -4607,7 +4645,7 @@ MonoBehaviour:
m_GameObject: {fileID: 910165456}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c08c82d8bfafe7b4bb4386ab2dd79d9c, type: 3}
m_Script: {fileID: 11500000, guid: e001316a6dab3f04cbb2525904cfd6c8, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!224 &911390658 stripped
@ -5125,16 +5163,16 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 968258289}
m_LocalRotation: {x: -0.4260401, y: -0.42604008, z: 0.564349, w: 0.56434906}
m_LocalPosition: {x: 364, y: -6, z: -46}
m_LocalRotation: {x: -0.4260401, y: -0.42604008, z: 0.56434906, w: 0.56434906}
m_LocalPosition: {x: 514.00006, y: -6.000023, z: -46}
m_LocalScale: {x: 15, y: 1, z: 30}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1989318070}
- {fileID: 937211620}
- {fileID: 112502617}
m_Father: {fileID: 862273498}
m_RootOrder: 2
m_Father: {fileID: 1331449495}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: -74.1, z: 90}
--- !u!64 &968258291
MeshCollider:
@ -7314,6 +7352,8 @@ MonoBehaviour:
- {fileID: 1051197778}
- {fileID: 1444436736}
- {fileID: 939615484}
isIPCIdle: 0
useIPCLighting: 1
FadeDuration: 0.3
--- !u!4 &1251312952
Transform:
@ -7571,6 +7611,12 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
LightManager: {fileID: 1251312951}
--- !u!224 &1331449495 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 6563380805594740092, guid: 5da4516f609052242915c455fc208ca2,
type: 3}
m_PrefabInstance: {fileID: 8225331326148453084}
m_PrefabAsset: {fileID: 0}
--- !u!224 &1334366885 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 4545477537435998766, guid: 5da4516f609052242915c455fc208ca2,
@ -8977,8 +9023,8 @@ Transform:
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
m_ConstrainProportionsScale: 1
m_Children:
- {fileID: 1740661842}
- {fileID: 182119967}
- {fileID: 1740661842}
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 23, y: 35, z: 0}
@ -9452,7 +9498,7 @@ Camera:
width: 1
height: 1
near clip plane: 0.1
far clip plane: 50
far clip plane: 6
field of view: 40
orthographic: 0
orthographic size: 5
@ -9484,7 +9530,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1688695918}
m_RootOrder: 0
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 7.278, y: 21.625, z: 0.272}
--- !u!114 &1740661843
MonoBehaviour:
@ -29767,7 +29813,7 @@ Camera:
width: 1
height: 1
near clip plane: 0.1
far clip plane: 10
far clip plane: 5
field of view: 60
orthographic: 0
orthographic size: 5
@ -32094,7 +32140,7 @@ RectTransform:
- {fileID: 818854852}
- {fileID: 1785707800}
m_Father: {fileID: 1748802425554287224}
m_RootOrder: 1
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -32315,7 +32361,7 @@ RectTransform:
- {fileID: 911390658}
- {fileID: 1808507365}
m_Father: {fileID: 1748802425554287224}
m_RootOrder: 0
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -32396,8 +32442,8 @@ RectTransform:
m_LocalScale: {x: 0.00175, y: 0.00175, z: 0.00175}
m_ConstrainProportionsScale: 1
m_Children:
- {fileID: 1748802424534997467}
- {fileID: 1748802424439818172}
- {fileID: 1748802424534997467}
- {fileID: 1748802424285800368}
- {fileID: 1748802424301928155}
m_Father: {fileID: 0}
@ -32425,7 +32471,7 @@ MonoBehaviour:
m_CheckFor3DOcclusion: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Bits: 127
m_RaycastTriggerInteraction: 1
--- !u!114 &1748802425554287226
MonoBehaviour:
@ -32510,7 +32556,7 @@ MonoBehaviour:
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Bits: 127
--- !u!222 &1748802425967121442
CanvasRenderer:
m_ObjectHideFlags: 0
@ -32812,6 +32858,16 @@ PrefabInstance:
propertyPath: m_text
value: 'Hand Size:'
objectReference: {fileID: 0}
- target: {fileID: 840120427923841567, guid: 48a5eb7af38418f47aa7dd9c8f4512d7,
type: 3}
propertyPath: m_margin.w
value: 0
objectReference: {fileID: 0}
- target: {fileID: 840120427923841567, guid: 48a5eb7af38418f47aa7dd9c8f4512d7,
type: 3}
propertyPath: m_geometrySortingOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1014690918283339427, guid: 48a5eb7af38418f47aa7dd9c8f4512d7,
type: 3}
propertyPath: m_AnchorMax.x
@ -33249,6 +33305,11 @@ PrefabInstance:
propertyPath: m_text
value: 'Capture FPS:'
objectReference: {fileID: 0}
- target: {fileID: 840120427923841567, guid: 5da4516f609052242915c455fc208ca2,
type: 3}
propertyPath: m_RaycastTarget
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4545477537435998766, guid: 5da4516f609052242915c455fc208ca2,
type: 3}
propertyPath: m_Pivot.x
@ -34095,6 +34156,11 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 1748802424439818172}
m_Modifications:
- target: {fileID: 840120427923841567, guid: 5da4516f609052242915c455fc208ca2,
type: 3}
propertyPath: m_RaycastTarget
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4545477537435998766, guid: 5da4516f609052242915c455fc208ca2,
type: 3}
propertyPath: m_Pivot.x

View File

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

View File

@ -0,0 +1,3 @@
{
"name": "IPCManager"
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4b68ab8531bd5864db8bb4af74c61824
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,67 @@
using System.Collections;
using System.Collections.Generic;
using System.IO.MemoryMappedFiles;
using System.Security.Principal;
using UnityEngine;
public class IPCManager : MonoBehaviour
{
public static MemoryMappedFile sharedBuffer;
public static MemoryMappedViewAccessor sharedBufferAccessor;
public static bool isInitialized = false;
private void Awake()
{
EnsureInitialization();
}
private static void EnsureInitialization()
{
if (!isInitialized)
InitializeIPC("Local\\WACVR_SHARED_BUFFER", 2164);
}
private IEnumerator ReconnectWait()
{
yield return new WaitForSeconds(5);
InitializeIPC("Local\\WACVR_SHARED_BUFFER", 2164);
}
private void Reconnect()
{
InitializeIPC("Local\\WACVR_SHARED_BUFFER", 2164);
}
private static void InitializeIPC(string sharedMemoryName, int sharedMemorySize)
{
MemoryMappedFileSecurity CustomSecurity = new MemoryMappedFileSecurity();
SecurityIdentifier sid = new SecurityIdentifier(WellKnownSidType.WorldSid, null);
var acct = sid.Translate(typeof(NTAccount)) as NTAccount;
CustomSecurity.AddAccessRule(new System.Security.AccessControl.AccessRule<MemoryMappedFileRights>(acct.ToString(), MemoryMappedFileRights.FullControl, System.Security.AccessControl.AccessControlType.Allow));
sharedBuffer = MemoryMappedFile.CreateOrOpen(sharedMemoryName, sharedMemorySize, MemoryMappedFileAccess.ReadWrite, MemoryMappedFileOptions.None, CustomSecurity, System.IO.HandleInheritability.Inheritable);
sharedBufferAccessor = sharedBuffer.CreateViewAccessor();
isInitialized = true;
}
public static byte[] GetLightData()
{
EnsureInitialization();
byte[] bytes = new byte[1920];
IPCManager.sharedBufferAccessor.ReadArray<byte>(244, bytes, 0, 1920);
return bytes;
}
public static void SetTouchData(bool[] bytes)
{
EnsureInitialization();
IPCManager.sharedBufferAccessor.WriteArray<bool>(4, bytes, 0, 240);
}
public static void SetTouch(int index, bool value)
{
EnsureInitialization();
if (value)
IPCManager.sharedBufferAccessor.Write(4 + index, 1);
else
IPCManager.sharedBufferAccessor.Write(4 + index, 0);
}
}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: c08c82d8bfafe7b4bb4386ab2dd79d9c
guid: ddced15d8eef61f4d8c51a05cff9f958
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -2,7 +2,8 @@
"name": "LightManager",
"rootNamespace": "",
"references": [
"GUID:80de51a1f88203a4cb129a5922de311f"
"GUID:80de51a1f88203a4cb129a5922de311f",
"GUID:4b68ab8531bd5864db8bb4af74c61824"
],
"includePlatforms": [],
"excludePlatforms": [],

View File

@ -8,13 +8,12 @@ public class LightManager : MonoBehaviour
{
public List<GameObject> Lights = new List<GameObject>();
List<Material> Materials = new List<Material>();
public static bool isIPCIdle = false;
public static bool IsUseIPC = true;
[SerializeField]
public bool isIPCIdle = true;
[SerializeField]
public bool useIPCLighting = true;
static Texture2D RGBColor2D;
public static MemoryMappedFile sharedBuffer;
public static MemoryMappedViewAccessor sharedBufferAccessor;
private IEnumerator[] coroutines = new IEnumerator[240];
public float FadeDuration = 0.5f;
@ -27,9 +26,8 @@ public class LightManager : MonoBehaviour
for (int i = 0; i < Lights.Count; i++)
Materials.Add(Lights[i].GetComponent<Renderer>().material);
if (IsUseIPC)
if (useIPCLighting)
{
InitializeIPC("Local\\WACVR_SHARED_BUFFER", 2164);
RGBColor2D = new Texture2D(480, 1, TextureFormat.RGBA32, false);
//RGBColor2D.filterMode = FilterMode.Point; //for debugging
//GetComponent<Renderer>().material.mainTexture = RGBColor2D; //for debugging
@ -37,18 +35,23 @@ public class LightManager : MonoBehaviour
}
private void Update()
{
if (sharedBuffer != null)
GetTextureFromBytes(GetBytesFromMemory());
else
if (!useIPCLighting)
return;
if (IsUseIPC)
if (IPCManager.sharedBuffer != null)
{
GetTextureFromBytes(IPCManager.GetLightData());
CheckIPCState();
if (!isIPCIdle)
UpdateLED();
if (!isIPCIdle)
UpdateLED();
}
else
{
isIPCIdle = true;
}
}
void UpdateConfig()
{
IsUseIPC = ConfigManager.config.useIPCLighting;
useIPCLighting = ConfigManager.config.useIPCLighting;
}
private void CheckIPCState()
{
@ -57,15 +60,6 @@ public class LightManager : MonoBehaviour
else
isIPCIdle = true;
}
private void InitializeIPC(string sharedMemoryName, int sharedMemorySize)
{
MemoryMappedFileSecurity CustomSecurity = new MemoryMappedFileSecurity();
SecurityIdentifier sid = new SecurityIdentifier(WellKnownSidType.WorldSid, null);
var acct = sid.Translate(typeof(NTAccount)) as NTAccount;
CustomSecurity.AddAccessRule(new System.Security.AccessControl.AccessRule<MemoryMappedFileRights>(acct.ToString(), MemoryMappedFileRights.FullControl, System.Security.AccessControl.AccessControlType.Allow));
sharedBuffer = MemoryMappedFile.CreateOrOpen(sharedMemoryName, sharedMemorySize, MemoryMappedFileAccess.ReadWrite, MemoryMappedFileOptions.None, CustomSecurity, System.IO.HandleInheritability.Inheritable);
sharedBufferAccessor = sharedBuffer.CreateViewAccessor();
}
private void UpdateLED()
{
int index = 0;
@ -86,15 +80,9 @@ public class LightManager : MonoBehaviour
RGBColor2D.LoadRawTextureData(bytes);
RGBColor2D.Apply();
}
byte[] GetBytesFromMemory()
{
byte[] bytes = new byte[1920];
sharedBufferAccessor.ReadArray<byte>(244, bytes, 0, 1920);
return bytes;
}
public void UpdateLightFade(int Area, bool State)
{
if(!isIPCIdle)
if(!isIPCIdle || useIPCLighting)
return;
Area -= 1;

View File

@ -5,7 +5,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Collections;
public class ColliderToSerial : MonoBehaviour
public class ColliderToTouch : MonoBehaviour
{
public LightManager LightManager;
private int _insideColliderCount = 0;
@ -18,7 +18,7 @@ public class ColliderToSerial : MonoBehaviour
private void OnTriggerEnter(Collider other)
{
_insideColliderCount += 1;
Serial.SetTouch(Area, true);
TouchManager.SetTouch(Area, true);
touchDidChange?.Invoke();
LightManager.UpdateLightFade(Area, true);
}
@ -29,7 +29,7 @@ public class ColliderToSerial : MonoBehaviour
_insideColliderCount = Mathf.Max(0, _insideColliderCount);
if (_insideColliderCount == 0)
{
Serial.SetTouch(Area, false);
TouchManager.SetTouch(Area, false);
touchDidChange?.Invoke();
LightManager.UpdateLightFade(Area, false);
}

View File

@ -2,7 +2,8 @@
"name": "Serial",
"rootNamespace": "",
"references": [
"GUID:476196b3fd6829e45b839eb138f356ed"
"GUID:476196b3fd6829e45b839eb138f356ed",
"GUID:4b68ab8531bd5864db8bb4af74c61824"
],
"includePlatforms": [],
"excludePlatforms": [],

View File

@ -5,7 +5,7 @@ using System.Threading;
using System.IO.Ports;
using System.Linq;
using UnityEngine;
public class Serial : MonoBehaviour
public class TouchManager : MonoBehaviour
{
const byte CMD_GET_SYNC_BOARD_VER = 0xa0;
@ -55,7 +55,7 @@ public class Serial : MonoBehaviour
_touchThread = new Thread(TouchThreadLoop);
InvokeRepeating("PingTouchThread", 0, 1);
//Send touch updates whenever actual state changes to achieve desired update frequency without overloading
ColliderToSerial.touchDidChange += PingTouchThread;
ColliderToTouch.touchDidChange += PingTouchThread;
}
private void PingTouchThread()
@ -85,8 +85,8 @@ public class Serial : MonoBehaviour
ReadHead(ComL, 0);
if (ComR.IsOpen)
ReadHead(ComR, 1);
// if (Input.GetKeyDown(KeyCode.M)) //this is a touch test code
// StartCoroutine(TouchTest(true));
if (Input.GetKeyDown(KeyCode.M)) //this is a touch test code
StartCoroutine(TouchTest(true));
if (Input.GetKeyDown(KeyCode.M) && StartUp)
SendTouchState();
}
@ -230,19 +230,23 @@ public class Serial : MonoBehaviour
}
public static void SetTouch(int Area, bool State) //set touch data 0-239
{
//Area +=1;
if (Area < 121)
Area -= 1;
if (Area < 120)
{
Area += (Area-1) / 5 * 3 + 7;
TouchPackAll[Area + 120] = State;
Area += Area / 5 * 3 + 7;
ByteHelper.SetBit(TouchPackR, Area, State);
}
else if (Area >= 120)
{
TouchPackAll[Area - 120] = State;
Area -= 120;
Area += (Area-1) / 5 * 3 + 7;
Area += Area / 5 * 3 + 7;
ByteHelper.SetBit(TouchPackL, Area, State);
}
TouchPackAll[Area] = State;
IPCManager.SetTouchData(TouchPackAll);
}
}

View File

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

View File

@ -3,7 +3,7 @@ guid: f2a11b8bb9493024982d42c93ff3f9de
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
@ -63,6 +63,7 @@ TextureImporter:
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 1
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
@ -76,6 +77,30 @@ TextureImporter:
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []

View File

@ -3,7 +3,7 @@ guid: d252922176d51834db1a230a3a3f26ca
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
@ -63,6 +63,7 @@ TextureImporter:
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 1
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
@ -76,6 +77,30 @@ TextureImporter:
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []

View File

@ -3,7 +3,7 @@ guid: eba630737fd5c3d4b95859a8c16a6ffc
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
@ -63,6 +63,7 @@ TextureImporter:
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 1
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
@ -76,6 +77,30 @@ TextureImporter:
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []

View File

@ -3,7 +3,7 @@ guid: d9ad228a4f815574685d62384aa96889
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
@ -63,6 +63,7 @@ TextureImporter:
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 1
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
@ -76,6 +77,30 @@ TextureImporter:
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []

View File

@ -3,7 +3,7 @@ guid: 0e86a807c3282a442b3915b99b76e30b
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
@ -63,6 +63,7 @@ TextureImporter:
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 1
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
@ -76,6 +77,30 @@ TextureImporter:
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []

View File

@ -3,7 +3,7 @@ guid: 9a39b28f16a08a04db0433e352bf8e26
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
@ -63,6 +63,7 @@ TextureImporter:
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 1
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
@ -76,6 +77,30 @@ TextureImporter:
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []

View File

@ -12,7 +12,7 @@ TagManager:
- Water
- UI
- TPBlock
-
- UIText
-
-
-

View File

@ -137,7 +137,7 @@ void mercury_io_touch_set_leds(struct led_data data)
{
if (FileMapping)
{
data.rgba[3] = 0xFF; //IPC enable flag
data.rgba[3] = 0xFF; //IPC idle flag
memcpy(FileMapping->RGBAData, data.rgba, 480 * 4);
}
//for (size_t i = 0; i < 32; i++)
@ -158,7 +158,7 @@ static unsigned int __stdcall mercury_io_touch_thread_proc(void *ctx)
}
callback(cellPressed);
Sleep(1);
//Sleep(1);
}
return 0;