Skip to content

Commit b7b7771

Browse files
committed
Remove old Button prefab and add new Button Blue and Button Yellow prefabs. Update SampleScene with new button values and adjust AnchoredPosition. Update Anton SDF font asset and ProjectSettings with new LFS references. Update README to reflect Unity Editor version change and additional build instructions.
1 parent 04cd65b commit b7b7771

File tree

14 files changed

+301
-46
lines changed

14 files changed

+301
-46
lines changed

Assets/CSscript/DataList.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,21 @@ public class DataList : MonoBehaviour
1818
[SerializeField] List<Data> data;
1919
private UnityPublisher pubcon;
2020

21-
void Start(){
21+
void Start()
22+
{
2223
Debug.Log(data.Count);
2324
pubcon = GameObject.Find("Pubcontoroller").GetComponent<UnityPublisher>();
2425

25-
for(int count = 0;count < data.Count;count++){
26+
for(int count = 0;count < data.Count;count++)
27+
{
2628
Button button1 = data[count].button;
2729
string string1 = data[count].topic;
2830
button1.onClick.AddListener(() => SendMsg(string1));
2931
}
3032
}
31-
void Update(){
32-
}
33-
void SendMsg(string msg){
33+
34+
void SendMsg(string msg)
35+
{
3436
pubcon.queue.Enqueue(msg);
3537
Debug.Log("SendMsg: " + msg);
3638
}

Assets/CSscript/DualButton.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,22 @@ public class DualButton : MonoBehaviour
66
[SerializeField] private Button originButton;
77
[SerializeField] private Button targetButton;
88

9-
void Start() {
9+
void Start()
10+
{
1011
originButton.gameObject.SetActive(true);
1112
targetButton.gameObject.SetActive(false);
1213
originButton.onClick.AddListener(OnOriginButtonClick);
1314
targetButton.onClick.AddListener(OnTargetButtonClick);
1415
}
1516

16-
private void OnOriginButtonClick() {
17+
private void OnOriginButtonClick()
18+
{
1719
originButton.gameObject.SetActive(false);
1820
targetButton.gameObject.SetActive(true);
1921
}
2022

21-
private void OnTargetButtonClick() {
23+
private void OnTargetButtonClick()
24+
{
2225
targetButton.gameObject.SetActive(false);
2326
originButton.gameObject.SetActive(true);
2427
}

Assets/CSscript/HoldPanelAction.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ private void Awake()
2525
_hold.action.Enable();
2626
}
2727

28-
private void OnDestroy() {
28+
private void OnDestroy()
29+
{
2930
if (_hold == null) return;
3031
_hold.action.performed -= OnHold;
3132
_hold.action.canceled -= OffHold;

Assets/CSscript/PanelContoroller.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ void Start () {
2323
autoOn();
2424
}
2525

26-
void Update()
27-
{
28-
}
29-
3026
void autoOn(){
3127
is_autoPanel = true;
3228
is_manualPanel = false;

Assets/CSscript/Toggle.cs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,23 @@ public class Toggle : MonoBehaviour
2222
[SerializeField] private string originalText = "/originalText";
2323
[SerializeField] private string targetText = "/targetText";
2424

25-
private void Start() {
25+
private void Start()
26+
{
2627
handlePosX = Mathf.Abs(handle.anchoredPosition.x);
2728
Value = onAwake;
2829
UpdateToggle(0);
2930
displayText.text = originalText;
3031
displayText.color = ORIGINAL_TEXT_COLOR;
3132
}
3233

33-
public void SwitchToggle() {
34+
public void SwitchToggle()
35+
{
3436
Value = !Value;
3537
UpdateToggle(SWITCH_DURATION);
3638
}
3739

38-
private void UpdateToggle(float duration) {
40+
private void UpdateToggle(float duration)
41+
{
3942
var bgColor = Value ? ON_BG_COLOR : OFF_BG_COLOR;
4043
var handleDestX = Value ? handlePosX : -handlePosX;
4144

@@ -45,12 +48,15 @@ private void UpdateToggle(float duration) {
4548
.Join(handle.DOAnchorPosX(handleDestX, duration / 2));
4649
}
4750

48-
private void Update() {
49-
if (targetToggle.Value) {
51+
private void Update()
52+
{
53+
if (targetToggle.Value)
54+
{
5055
displayText.text = targetText;
5156
displayText.color = ORIGINAL_TEXT_COLOR;
5257
}
53-
else {
58+
else
59+
{
5460
displayText.text = originalText;
5561
displayText.color = TARGET_TEXT_COLOR;
5662
}

Assets/CSscript/UnitySubscriber.cs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
using TS = geometry_msgs.msg.TwistStamped;
1515
using Sw = nhk2025b_msgs.msg.Swerve;
1616
using Sa = nhk2025b_msgs.msg.StateArray;
17-
using Pe = rcl_interfaces.msg.ParameterEvent;
1817

1918
public class UnitySubscriber : MonoBehaviour
2019
{
@@ -29,7 +28,6 @@ public class UnitySubscriber : MonoBehaviour
2928
private ISubscription<Sw> result_sub;
3029
private ISubscription<Sw> cmd_sub;
3130
private ISubscription<Sa> state_sub;
32-
private ISubscription<Pe> parameter_sub;
3331

3432
private Queue<string> recqueue = new Queue<string>();
3533

@@ -164,7 +162,6 @@ void Update()
164162
result_sub = ros2Node.CreateSubscription<Sw>("/swerve/result", resultCallback);
165163
cmd_sub = ros2Node.CreateSubscription<Sw>("/visualization/swerve", cmdCallback);
166164
state_sub = ros2Node.CreateSubscription<Sa>("/behavior/avaiable_state_array", stateCallback);
167-
parameter_sub = ros2Node.CreateSubscription<Pe>("/parameter_events", parameterCallback);
168165
}
169166
}
170167

@@ -246,7 +243,7 @@ void Update()
246243
//Visualize Path
247244
if(subscribedPath != null && subscribedPath.Poses.Length > 0)
248245
{
249-
int setmax=0;
246+
int setmax = 0;
250247
if(subscribedPath.Poses.Length<maxPointCount) setmax= subscribedPath.Poses.Length;
251248
else setmax = 100;
252249
for(int i = 0;i < maxPointCount;i++){
@@ -431,17 +428,6 @@ void stateCallback(Sa msg)
431428
Array.Copy(stateName, prevStateName, stateSize);
432429
}
433430

434-
void parameterCallback(Pe msg)
435-
{
436-
// foreach (var parameter in msg.Changed_parameters)
437-
// {
438-
// if (parameter.Name == "is_red")
439-
// {
440-
// ogIsRed = parameter.Value.Bool_value;
441-
// }
442-
// }
443-
}
444-
445431
void sendStatus(int status)
446432
{
447433
unityPublisher.intQueue.Enqueue(status);

0 commit comments

Comments
 (0)