1
0
mirror of synced 2024-09-23 18:48:21 +02:00

change card image; clean code for serial; move dll to plugin folder

This commit is contained in:
xpeng 2022-05-23 23:31:33 +02:00
parent 192249cd89
commit 8b3c03af3d
9 changed files with 101 additions and 2350 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: dca300f13f0e93746993d164be2df94e
guid: d7df676b9f3cb3440b31baf54f9b32e8
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 0d466e4e052418941a390e9537f2cb5d
guid: 8201d5f789cf244438bb7b733ba89ae8
PluginImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -32970,7 +32970,7 @@ MonoBehaviour:
m_GameObject: {fileID: 2104653491023758766}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9df7ca68b30810848ac3fa535422e6f4, type: 3}
m_Script: {fileID: 0}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &8875919877197206717

View File

@ -4,7 +4,6 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Collections;
public class Serial : MonoBehaviour
{
@ -31,7 +30,6 @@ public class Serial : MonoBehaviour
byte[] SettingData_162 = new byte[7];
byte[] SettingData_148 = new byte[7];
byte[] SettingData_201 = new byte[7];
int TouchPackCounter = 0;
static byte[] TouchPackL = new byte[36];
static byte[] TouchPackR = new byte[36];
bool StartUp = false;
@ -44,20 +42,16 @@ public class Serial : MonoBehaviour
SetSettingData_201();
SetSettingData_162();
SetSettingData_148();
// SettingData_168 = ByteHelper.ConvertTextToByteArray(SettingData_168_Text);
}
// Update is called once per frame
void Update()
{
if(ComL.IsOpen)
ReadHead(ComL, 0);
if (ComR.IsOpen)
ReadHead(ComR, 1);
//SendTouch(ComL, TouchPackL);
//SendTouch(ComR, TouchPackR);
if (Input.GetKeyDown(KeyCode.M))
StartCoroutine(Test(true));
if (Input.GetKeyDown(KeyCode.M)) //this is a touch test code
StartCoroutine(TouchTest(true));
}
private void FixedUpdate() {
@ -65,7 +59,7 @@ public class Serial : MonoBehaviour
SendTouch(ComR, TouchPackR);
}
IEnumerator Test(bool State)
IEnumerator TouchTest(bool State) //this is a touch test code
{
for (int i = 0; i < 240; i++)
{
@ -77,7 +71,7 @@ public class Serial : MonoBehaviour
}
}
void ReadHead(SerialPort Serial, int side)
void ReadHead(SerialPort Serial, int side) //Read head byte
{
if(Serial.BytesToRead > 0)
{
@ -101,7 +95,6 @@ public class Serial : MonoBehaviour
syncbytes.Add(syncCheckSum);
Serial.Write(syncbytes.ToArray(), 0, syncbytes.Count);
Debug.Log($"GET SYNC BOARD VER {side}");
//Bytes.Clear();
break;
case CMD_NEXT_READ:
//Response: corresponding read bytes + checksum
@ -131,8 +124,6 @@ public class Serial : MonoBehaviour
Debug.Log("Extra Read");
break;
}
// Serial.Write(SettingData_114, 0, 81);
//Bytes.Clear();
break;
case CMD_GET_UNIT_BOARD_VER:
//Response: cmd byte + sync board ver bytes + 'L'/'R' based on side + unit board ver bytes x6 + checksum
@ -148,24 +139,20 @@ public class Serial : MonoBehaviour
unitBytes.Add(unitCheckSum);
Serial.Write(unitBytes.ToArray(), 0, unitBytes.Count);
Debug.Log($"GET UNIT BOARD VER {side}");
//Bytes.Clear();
break;
case CMD_MYSTERY1:
StartUp = false;
Serial.Write(SettingData_162, 0, 3);
Debug.Log($"MYSTERY 1 SIDE {side}");
//Bytes.Clear();
break;
case CMD_MYSTERY2:
StartUp = false;
Serial.Write(SettingData_148, 0, 3);
Debug.Log($"MYSTERY 2 SIDE {side}");
//Bytes.Clear();
break;
case CMD_START_AUTO_SCAN:
Serial.Write(SettingData_201.ToArray(), 0, 3);
Debug.Log($"START AUTO SCAN SIDE {side}");
//Bytes.Clear();
StartUp = true;
break;
case CMD_BEGIN_WRITE:
@ -177,12 +164,11 @@ public class Serial : MonoBehaviour
case 154:
StartUp = false;
Debug.Log("BAD");
//Bytes.Clear();
break;
}
}
byte[] GetTouchPack(byte[] Pack)
byte[] GetTouchPack(byte[] Pack) //convert touch to right format for game
{
Pack[0] = 129;
Pack[34] = Pack[34]++;
@ -192,12 +178,12 @@ public class Serial : MonoBehaviour
Pack[34] = 0;
return Pack;
}
void SendTouch(SerialPort Serial, byte[] Pack)
void SendTouch(SerialPort Serial, byte[] Pack) //Send touch data
{
if (StartUp)
Serial.Write(GetTouchPack(Pack), 0, 36);
}
public static void SetTouch(int Area, bool State)
public static void SetTouch(int Area, bool State) //set touch data 0-239
{
Area +=1;
if (Area < 121)
@ -267,12 +253,4 @@ public static class ByteHelper
tempList.Add(Convert.ToByte(data[i]));
return tempList;
}
public static byte[] ConvertTextToByteArray(TextAsset TextObj)
{
var splitedData = TextObj.text.Split(Convert.ToChar("\n"));
byte[] tempList = new byte[splitedData.Length];
for (int i = 0; i < splitedData.Length; i++)
tempList[i] = Convert.ToByte(splitedData[i]);
return tempList;
}
}

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -8,18 +8,18 @@ MonoBehaviour:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 1
m_EditorHideFlags: 0
m_Script: {fileID: 12004, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
m_EditorClassIdentifier:
m_PixelRect:
serializedVersion: 2
x: 0
y: 43
width: 1920
height: 997
y: 43.2
width: 1536
height: 820.8
m_ShowMode: 4
m_Title: Inspector
m_Title: Project
m_RootView: {fileID: 5}
m_MinSize: {x: 875, y: 300}
m_MaxSize: {x: 10000, y: 10000}
@ -40,9 +40,9 @@ MonoBehaviour:
m_Position:
serializedVersion: 2
x: 0
y: 568
width: 1920
height: 379
y: 461.6
width: 1536
height: 309.19998
m_MinSize: {x: 230, y: 271}
m_MaxSize: {x: 10000, y: 10021}
m_ActualView: {fileID: 13}
@ -70,12 +70,12 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 30
width: 1920
height: 947
width: 1536
height: 770.8
m_MinSize: {x: 300, y: 200}
m_MaxSize: {x: 24288, y: 16192}
vertical: 1
controlID: 88
controlID: 341
--- !u!114 &4
MonoBehaviour:
m_ObjectHideFlags: 52
@ -93,8 +93,8 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 0
width: 302
height: 568
width: 247.2
height: 461.6
m_MinSize: {x: 201, y: 221}
m_MaxSize: {x: 4001, y: 4021}
m_ActualView: {fileID: 15}
@ -122,8 +122,8 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 0
width: 1920
height: 997
width: 1536
height: 820.8
m_MinSize: {x: 875, y: 300}
m_MaxSize: {x: 10000, y: 10000}
m_UseTopView: 1
@ -147,7 +147,7 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 0
width: 1920
width: 1536
height: 30
m_MinSize: {x: 0, y: 0}
m_MaxSize: {x: 0, y: 0}
@ -172,12 +172,12 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 0
width: 1920
height: 568
width: 1536
height: 461.6
m_MinSize: {x: 300, y: 100}
m_MaxSize: {x: 24288, y: 8096}
vertical: 0
controlID: 89
controlID: 342
--- !u!114 &8
MonoBehaviour:
m_ObjectHideFlags: 52
@ -194,8 +194,8 @@ MonoBehaviour:
m_Position:
serializedVersion: 2
x: 0
y: 977
width: 1920
y: 800.8
width: 1536
height: 20
m_MinSize: {x: 0, y: 0}
m_MaxSize: {x: 0, y: 0}
@ -214,10 +214,10 @@ MonoBehaviour:
m_Children: []
m_Position:
serializedVersion: 2
x: 302
x: 247.2
y: 0
width: 1024
height: 568
width: 813.60004
height: 461.6
m_MinSize: {x: 202, y: 221}
m_MaxSize: {x: 4002, y: 4021}
m_ActualView: {fileID: 14}
@ -241,12 +241,12 @@ MonoBehaviour:
m_Children: []
m_Position:
serializedVersion: 2
x: 1326
x: 1060.8
y: 0
width: 594
height: 568
m_MinSize: {x: 275, y: 50}
m_MaxSize: {x: 4000, y: 4000}
width: 475.19995
height: 461.6
m_MinSize: {x: 276, y: 71}
m_MaxSize: {x: 4001, y: 4021}
m_ActualView: {fileID: 12}
m_Panes:
- {fileID: 12}
@ -268,15 +268,15 @@ MonoBehaviour:
m_MaxSize: {x: 4000, y: 4000}
m_TitleContent:
m_Text: Console
m_Image: {fileID: -4327648978806127646, guid: 0000000000000000d000000000000000,
m_Image: {fileID: -4950941429401207979, guid: 0000000000000000d000000000000000,
type: 0}
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 0
y: 641
width: 1920
height: 358
y: 535.2
width: 1536
height: 288.19998
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
m_LastAppliedPresetName: Default
@ -297,15 +297,15 @@ MonoBehaviour:
m_MaxSize: {x: 4000, y: 4000}
m_TitleContent:
m_Text: Inspector
m_Image: {fileID: -2667387946076563598, guid: 0000000000000000d000000000000000,
m_Image: {fileID: -440750813802333266, guid: 0000000000000000d000000000000000,
type: 0}
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 1326
y: 73
width: 593
height: 547
x: 1060.8
y: 73.6
width: 474.19995
height: 440.6
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
m_LastAppliedPresetName: Default
@ -317,7 +317,7 @@ MonoBehaviour:
m_ControlHash: -371814159
m_PrefName: Preview_InspectorPreview
m_LastInspectedObjectInstanceID: -1
m_LastVerticalScrollValue: 414
m_LastVerticalScrollValue: 0
m_GlobalObjectId:
m_InspectorMode: 0
m_LockTracker:
@ -339,15 +339,15 @@ MonoBehaviour:
m_MaxSize: {x: 10000, y: 10000}
m_TitleContent:
m_Text: Project
m_Image: {fileID: -5467254957812901981, guid: 0000000000000000d000000000000000,
m_Image: {fileID: -5179483145760003458, guid: 0000000000000000d000000000000000,
type: 0}
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 0
y: 641
width: 1920
height: 358
y: 535.2
width: 1536
height: 288.19998
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
m_LastAppliedPresetName: Default
@ -365,22 +365,22 @@ MonoBehaviour:
m_SkipHidden: 0
m_SearchArea: 1
m_Folders:
- Assets/Script
- Assets
m_Globs: []
m_OriginalText:
m_ViewMode: 1
m_StartGridSize: 64
m_LastFolders:
- Assets/Script
- Assets
m_LastFoldersGridSize: -1
m_LastProjectPath: D:\folder to stuff stuff in\BuildingTest\WACVR
m_LastProjectPath: D:\WACCA\WACVR
m_LockTracker:
m_IsLocked: 0
m_FolderTreeState:
scrollPos: {x: 0, y: 0}
m_SelectedIDs: 98820000
m_LastClickedID: 33432
m_ExpandedIDs: 000000006082000000ca9a3bffffff7f
scrollPos: {x: 0, y: 3.8000183}
m_SelectedIDs: 046f0000
m_LastClickedID: 28420
m_ExpandedIDs: 00000000046f00000a6f00005a6f000000ca9a3bffffff7f
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@ -408,7 +408,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
m_LastClickedID: 0
m_ExpandedIDs: 0000000060820000
m_ExpandedIDs: 00000000046f000000ca9a3bffffff7f
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@ -480,15 +480,15 @@ MonoBehaviour:
m_MaxSize: {x: 4000, y: 4000}
m_TitleContent:
m_Text: Scene
m_Image: {fileID: 2593428753322112591, guid: 0000000000000000d000000000000000,
m_Image: {fileID: 8634526014445323508, guid: 0000000000000000d000000000000000,
type: 0}
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 302
y: 73
width: 1022
height: 547
x: 247.2
y: 73.6
width: 811.60004
height: 440.6
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
m_LastAppliedPresetName: Default
@ -499,7 +499,7 @@ MonoBehaviour:
collapsed: 0
displayed: 1
snapOffset: {x: 0, y: 0}
snapOffsetDelta: {x: -101, y: -26}
snapOffsetDelta: {x: -100, y: -25.600006}
snapCorner: 3
id: Tool Settings
index: 0
@ -509,9 +509,9 @@ MonoBehaviour:
floating: 0
collapsed: 0
displayed: 1
snapOffset: {x: 101, y: 0}
snapOffset: {x: -141, y: 149}
snapOffsetDelta: {x: 0, y: 0}
snapCorner: 0
snapCorner: 1
id: unity-grid-and-snap-toolbar
index: 1
layout: 1
@ -690,9 +690,9 @@ MonoBehaviour:
m_PlayAudio: 0
m_AudioPlay: 0
m_Position:
m_Target: {x: 0.9459671, y: 0.34996235, z: 9.561394}
m_Target: {x: -0.23342612, y: 1.154188, z: -0.029027253}
speed: 2
m_Value: {x: 0.9459671, y: 0.34996235, z: 9.561394}
m_Value: {x: -0.23342612, y: 1.154188, z: -0.029027253}
m_RenderMode: 0
m_CameraMode:
drawMode: 0
@ -739,13 +739,13 @@ MonoBehaviour:
m_GridAxis: 1
m_gridOpacity: 0.5
m_Rotation:
m_Target: {x: 0.045547932, y: 0.046751417, z: -0.002087073, w: 0.997929}
m_Target: {x: 0.14618626, y: 0.061685134, z: -0.009133707, w: 0.98729026}
speed: 2
m_Value: {x: 0.045541864, y: 0.0482452, z: -0.0021552558, w: 0.99779445}
m_Value: {x: 0.14618619, y: 0.061685104, z: -0.009133702, w: 0.9872898}
m_Size:
m_Target: 5.4043775
m_Target: 0.19183554
speed: 2
m_Value: 5.4043775
m_Value: 0.19183554
m_Ortho:
m_Target: 0
speed: 2
@ -786,25 +786,25 @@ MonoBehaviour:
m_MaxSize: {x: 4000, y: 4000}
m_TitleContent:
m_Text: Hierarchy
m_Image: {fileID: 7966133145522015247, guid: 0000000000000000d000000000000000,
m_Image: {fileID: -3734745235275155857, guid: 0000000000000000d000000000000000,
type: 0}
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 0
y: 73
width: 301
height: 547
y: 73.6
width: 246.2
height: 440.6
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
m_LastAppliedPresetName: Default
m_SaveData: []
m_SceneHierarchy:
m_TreeViewState:
scrollPos: {x: 0, y: 3410}
m_SelectedIDs: c4760000
m_LastClickedID: 30404
m_ExpandedIDs: f0faffffc2730000ba750000
scrollPos: {x: 0, y: 0}
m_SelectedIDs: 046f0000
m_LastClickedID: 0
m_ExpandedIDs: 76f8ffff2c730000607300002a740000ca760000c2780000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@ -844,15 +844,15 @@ MonoBehaviour:
m_MaxSize: {x: 4000, y: 4000}
m_TitleContent:
m_Text: Game
m_Image: {fileID: -6423792434712278376, guid: 0000000000000000d000000000000000,
m_Image: {fileID: 4621777727084837110, guid: 0000000000000000d000000000000000,
type: 0}
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 302
y: 73
width: 1022
height: 547
x: 241.6
y: 73.6
width: 817.2001
height: 440.6
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
m_LastAppliedPresetName: Default
@ -865,7 +865,7 @@ MonoBehaviour:
m_ShowGizmos: 0
m_TargetDisplay: 0
m_ClearColor: {r: 0, g: 0, b: 0, a: 0}
m_TargetSize: {x: 1022, y: 526}
m_TargetSize: {x: 817.2001, y: 419.6}
m_TextureFilterMode: 0
m_TextureHideFlags: 61
m_RenderIMGUI: 1
@ -880,10 +880,10 @@ MonoBehaviour:
m_VRangeLocked: 0
hZoomLockedByDefault: 0
vZoomLockedByDefault: 0
m_HBaseRangeMin: -511
m_HBaseRangeMax: 511
m_VBaseRangeMin: -263
m_VBaseRangeMax: 263
m_HBaseRangeMin: -326.88004
m_HBaseRangeMax: 326.88004
m_VBaseRangeMin: -167.84001
m_VBaseRangeMax: 167.84001
m_HAllowExceedBaseRangeMin: 1
m_HAllowExceedBaseRangeMax: 1
m_VAllowExceedBaseRangeMin: 1
@ -901,23 +901,23 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 21
width: 1022
height: 526
width: 817.2001
height: 419.6
m_Scale: {x: 1, y: 1}
m_Translation: {x: 511, y: 263}
m_Translation: {x: 408.60004, y: 209.8}
m_MarginLeft: 0
m_MarginRight: 0
m_MarginTop: 0
m_MarginBottom: 0
m_LastShownAreaInsideMargins:
serializedVersion: 2
x: -511
y: -263
width: 1022
height: 526
x: -408.60004
y: -209.8
width: 817.2001
height: 419.6
m_MinimalGUI: 1
m_defaultScale: 1
m_LastWindowPixelSize: {x: 1022, y: 547}
m_LastWindowPixelSize: {x: 1021.5001, y: 550.75}
m_ClearInEditMode: 1
m_NoCameraWarning: 1
m_LowResolutionForAspectRatios: 01000000000000000000