private void Initialize() { background.gameObject.SetActive(true); icon.gameObject.SetActive(true); text.gameObject.SetActive(true); text.supportRichText = true; background.sprite = ImageUtils.LoadSprite(Mod.GetAssetPath("LockerScreen.png")); icon.sprite = ImageUtils.LoadSprite(Mod.GetAssetPath("Receptacle.png")); seamothIcon.sprite = ImageUtils.LoadSprite(Mod.GetAssetPath("Seamoth.png")); exosuitIcon.sprite = ImageUtils.LoadSprite(Mod.GetAssetPath("Exosuit.png")); enableCheckbox.toggled = saveData != null ? saveData.Enabled : true; enableCheckbox.Initialize(); #if USE_AUTOSORT autosortCheckbox.toggled = saveData != null ? saveData.Autosort : true; autosortCheckbox.Initialize(); #endif subRoot = gameObject.GetComponentInParent <SubRoot>(); GetDockingBays(); UpdateDockedVehicles(); UpdateText(); initialized = true; }
private void Initialize() { background.gameObject.SetActive(true); icon.gameObject.SetActive(true); text.gameObject.SetActive(true); #if !BZ text.supportRichText = true; #endif background.sprite = ImageUtils.LoadSprite(Mod.GetAssetPath("LockerScreen.png")); icon.sprite = ImageUtils.LoadSprite(Mod.GetAssetPath("Receptacle.png")); seamothIcon.sprite = ImageUtils.LoadSprite(Mod.GetAssetPath("Seamoth.png")); exosuitIcon.sprite = ImageUtils.LoadSprite(Mod.GetAssetPath("Exosuit.png")); enableCheckbox.toggled = saveData != null ? saveData.Enabled : true; enableCheckbox.transform.localPosition = new Vector3(0, -104); enableCheckbox.Initialize(); if (Mod.config.UseAutosortMod) { autosortCheckbox.toggled = saveData != null ? saveData.Autosort : true; autosortCheckbox.transform.localPosition = new Vector3(0, -104 + 19); autosortCheckbox.Initialize(); } subRoot = gameObject.GetComponentInParent<SubRoot>(); GetDockingBays(); UpdateDockedVehicles(); UpdateText(); initialized = true; }
private void Awake() { Vector2 buttonPositionCenter = new Vector2(0, 0); int buttonSpacing = 104; Transform parent = GetComponentInChildren <Canvas>().transform; Color32 color = new Color32(189, 255, 255, 255); #if SN1 Text text = new GameObject("label", typeof(RectTransform)).AddComponent <Text>(); RectTransformExtensions.SetParams(text.rectTransform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), parent); RectTransformExtensions.SetSize(text.rectTransform, 500, 140); text.rectTransform.anchoredPosition = buttonPositionCenter + new Vector2(0, 80); text.color = GetComponentInChildren <Text>().color; text.text = "Position"; text.fontSize = Mathf.FloorToInt(GetComponentInChildren <Text>().fontSize * 1.8f); text.font = GetComponentInChildren <Text>().font; text.alignment = TextAnchor.MiddleCenter; #elif BZ TextMeshProUGUI text = new GameObject("label", typeof(RectTransform)).AddComponent <TextMeshProUGUI>(); RectTransformExtensions.SetParams(text.rectTransform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), parent); RectTransformExtensions.SetSize(text.rectTransform, 500, 140); text.rectTransform.anchoredPosition = buttonPositionCenter + new Vector2(0, 80); text.color = GetComponentInChildren <TextMeshProUGUI>().color; text.text = "Position"; text.fontSize = Mathf.FloorToInt(GetComponentInChildren <TextMeshProUGUI>().fontSize * 1.8f); text.font = GetComponentInChildren <TextMeshProUGUI>().font; text.alignment = TextAlignmentOptions.Midline; #endif text.raycastTarget = false; for (int i = 0; i < 4; i++) { CheckboxButton button = CheckboxButton.CreateCheckboxNoText(parent, color, 100); button.Initialize(); button.toggled = false; button.rectTransform.anchoredPosition = buttonPositionCenter + new Vector2((-1.5f + i) * buttonSpacing, 0); var buttonIndex = i; button.onToggled = (bool toggled) => { SetPosition(buttonIndex); }; positionButtons.Add(button); } OnProtoDeserialize(null); }