public static void HideAllTexts() { foreach (KeyValuePair <BaseLabel, int> pair in LabelsBucket.GetLabels()) { Instance.HideText(pair.Value); } }
void Start() { SetupEnv(); totalUniqueLabels = labeledNames.Count; CsvWriter.SaveLabels(LabelsBucket.GetLabels().Select(pair => pair.Key).ToList()); Debug.Log("Total Labeled items: " + totalLabeledItems + " of which unique: " + totalUniqueLabels + " total void items: " + totalVoids); }
public static string LabelColors() { LabelClass labelClass = new LabelClass(); int len = LabelsBucket.GetLabels().Count; int labelClassIndex = 0; labelClass.colors = new Color32[len]; labelClass.labels = new int[len]; foreach (KeyValuePair <BaseLabel, int> pair in LabelsBucket.GetLabels()) { labelClass.labels[labelClassIndex] = pair.Value; if (LabelMaskCoordinator.HasState(pair.Key.labelName)) { labelClass.colors[labelClassIndex] = pair.Key.encoderColor; } else { labelClass.colors[labelClassIndex] = new Color32(0, 0, 0, 0); } //Debug.Log(pair.Key.encoderColor + " " + pair.Value + " " + pair.Key.labelName); labelClassIndex += 1; } labelClass.mime = "mimey"; string json = JsonUtility.ToJson(labelClass); return(json); }
void Start() { foreach (KeyValuePair <BaseLabel, int> pair in LabelsBucket.GetLabels()) { GameObject newText = Instantiate(textPrefab); newText.transform.parent = transform; newText.GetComponent <RectTransform>().anchoredPosition = Vector3.zero; newText.GetComponent <RectTransform>().offsetMin = Vector3.zero; newText.GetComponent <RectTransform>().offsetMax = Vector3.zero; newText.GetComponent <TextMeshProUGUI>().text = pair.Key.labelName; newText.GetComponent <TextMeshProUGUI>().color = pair.Key.encoderColor; labelTexts[pair.Value] = newText; allIds.Add(pair.Value); } HideAllTexts(); }