Documentation for the Unity C# Library
Loading...
Searching...
No Matches
StepsData.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.Text.RegularExpressions;
4using Sirenix.OdinInspector;
5using UnityEngine;
6using UnityEngine.Serialization;
7
8namespace PixoVR.Event
9{
10 [Obsolete("Use StepsDataSO instead")]
12 {
13 public List<StepItem> listOfSteps;
14
15 public StepItem GetStepItem(string stepID = "")
16 {
17 if (stepID == string.Empty)
18 {
19 return listOfSteps[0];
20 }
21
22 for (int i = 0; i < listOfSteps.Count; i++)
23 {
24 if (listOfSteps[i].stepID == stepID)
25 {
26 return listOfSteps[i];
27 }
28 }
29
30 return null;
31 }
32
33 private void OnValidate()
34 {
35 Debug.Log($"StepsData {name} validation begin");
36
37 for (int i = 0; i < listOfSteps.Count; i++)
38 {
39 var v1 = listOfSteps[i].stepID;
40
41 if (Regex.IsMatch(v1, @"\p{IsCyrillic}"))
42 {
43 Debug.LogError($"StepsData {v1} Cyrillic symbol presented!!");
44 }
45
46 for (int j = i + 1; j < listOfSteps.Count; j++)
47 {
48 var v2 = listOfSteps[j].stepID;
49
50 if (v1.Equals(v2))
51 {
52 Debug.LogError($"StepsData {v1} duplicates at position {i}:{j}");
53 }
54 }
55 }
56
57 Debug.Log($"StepsData {name} validation finish");
58 }
59 }
60}
[Serializable]
Definition StepItem.cs:12
List< StepItem > listOfSteps
Definition StepsData.cs:13
StepItem GetStepItem(string stepID="")
Definition StepsData.cs:15