//////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public static CustomizeScreen Create(Transform parent, SaveDataEntry data, GameObject lockerPrefab = null)
        {
#if SUBNAUTICA
            lockerPrefab = Resources.Load <GameObject>("Submarine/Build/SmallLocker");
            var textPrefab = Instantiate(lockerPrefab.GetComponentInChildren <Text>());
#elif BELOWZERO
            var textPrefab = Instantiate(lockerPrefab.GetComponentInChildren <TextMeshProUGUI>());
#endif
            textPrefab.fontSize = 12;
            textPrefab.color    = CustomizeScreen.ScreenContentColor;

            var screen = new GameObject("CustomizeScreen", typeof(RectTransform)).AddComponent <CustomizeScreen>();
            RectTransformExtensions.SetParams(screen.rectTransform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), parent);
            RectTransformExtensions.SetSize(screen.rectTransform, 114, 241);

            screen.background        = new GameObject("Background").AddComponent <Image>();
            screen.background.sprite = ImageUtils.LoadSprite(Mod.GetAssetPath("CustomizeScreen.png"));
            RectTransformExtensions.SetParams(screen.background.rectTransform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), screen.transform);
            RectTransformExtensions.SetSize(screen.background.rectTransform, 114, 241);

            screen.labelLabel = LockerPrefabShared.CreateText(screen.background.transform, textPrefab, ScreenContentColor, 100, 9, "Label:");
            RectTransformExtensions.SetSize(screen.labelLabel.rectTransform, 90, 40);
#if SUBNAUTICA
            screen.labelLabel.alignment = TextAnchor.MiddleLeft;
#elif BELOWZERO
            screen.labelLabel.alignment = TextAlignmentOptions.MidlineLeft;
#endif

            screen.label = LabelController.Create(data, screen.background.transform, lockerPrefab);
            screen.label.rectTransform.anchoredPosition = new Vector2(0, 80);

            screen.exitButton = ConfigureButton.Create(screen.background.transform, Color.white, 40);

            var startX = 0;
            var startY = 30;
            screen.labelColorSetting = ColorSetting.Create(screen.background.transform, "Label Color", lockerPrefab);
            screen.labelColorSetting.rectTransform.anchoredPosition = new Vector2(startX, startY);

            screen.iconColorSetting = ColorSetting.Create(screen.background.transform, "Icon Color", lockerPrefab);
            screen.iconColorSetting.rectTransform.anchoredPosition = new Vector2(startX, startY - 19);

            screen.textColorSetting = ColorSetting.Create(screen.background.transform, "Filters Color", lockerPrefab);
            screen.textColorSetting.rectTransform.anchoredPosition = new Vector2(startX, startY - (19 * 2));

            screen.buttonsColorSetting = ColorSetting.Create(screen.background.transform, "Misc Color", lockerPrefab);
            screen.buttonsColorSetting.rectTransform.anchoredPosition = new Vector2(startX, startY - (19 * 3));

            screen.lockerColorSetting = ColorSetting.Create(screen.background.transform, "Locker Color", lockerPrefab);
            screen.lockerColorSetting.rectTransform.anchoredPosition = new Vector2(startX, startY - (19 * 4));

            screen.colorPicker = ColorPicker.Create(screen.background.transform, lockerPrefab);
            screen.colorPicker.gameObject.SetActive(false);
            screen.colorPicker.rectTransform.anchoredPosition = new Vector2(0, 30);

            return(screen);
        }
示例#2
0
        /*_____________________________________________________________________________________________________*/

        public static CustomizeScreen Create(Transform parent, SaveDataEntry data, GameObject lockerPrefab = null)
        {
#if SUBNAUTICA
            lockerPrefab = Resources.Load <GameObject>("Submarine/Build/SmallLocker");
            var textPrefab = Instantiate(lockerPrefab.GetComponentInChildren <Text>());
#elif BELOWZERO
            var textPrefab = Instantiate(lockerPrefab.GetComponentInChildren <TextMeshProUGUI>());
#endif
            textPrefab.fontSize = 12;
            textPrefab.color    = CustomizeScreen.ScreenContentColor;
            // The color picker settings
            var screen = new GameObject("CustomizeScreen", typeof(RectTransform)).AddComponent <CustomizeScreen>();
            RectTransformExtensions.SetParams(screen.rectTransform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), parent);
            RectTransformExtensions.SetSize(screen.rectTransform, 114, 241);

            screen.background        = new GameObject("Background").AddComponent <Image>();
            screen.background.sprite = ImageUtils.LoadSprite(Mod.GetAssetPath("CustomizeScreen.png"));
            // 1st = 2nd = 3rd = horizontal 4th = vertical positon of the color settings
            RectTransformExtensions.SetParams(screen.background.rectTransform, new Vector2(0.5f, 0.5f), new Vector2(0.41f, 0.4f), screen.transform);
            RectTransformExtensions.SetSize(screen.background.rectTransform, 114, 220);

            screen.label = LabelController.Create(data, screen.background.transform, lockerPrefab);
            // The position of the LOCKER label
            screen.label.rectTransform.anchoredPosition = new Vector2(0, 70);
            // The position of the close (X) button on the color settings
            screen.exitButton = ConfigureButton.Create(screen.background.transform, Color.white, 0, -85);

            var startX = 0;
            var startY = 30;
            screen.lockerColorSetting = ColorSetting.Create(screen.background.transform, "Locker Color", lockerPrefab);
            screen.lockerColorSetting.rectTransform.anchoredPosition = new Vector2(startX, startY);

            screen.iconColorSetting = ColorSetting.Create(screen.background.transform, "Icon Color", lockerPrefab);
            screen.iconColorSetting.rectTransform.anchoredPosition = new Vector2(startX, startY - 19);

            screen.textColorSetting = ColorSetting.Create(screen.background.transform, "Filters Color", lockerPrefab);
            screen.textColorSetting.rectTransform.anchoredPosition = new Vector2(startX, startY - (19 * 2));

            screen.buttonsColorSetting = ColorSetting.Create(screen.background.transform, "Misc Color", lockerPrefab);
            screen.buttonsColorSetting.rectTransform.anchoredPosition = new Vector2(startX, startY - (19 * 3));

            screen.labelColorSetting = ColorSetting.Create(screen.background.transform, "Label Color", lockerPrefab);
            screen.labelColorSetting.rectTransform.anchoredPosition = new Vector2(startX, startY - (19 * 4));

            screen.colorPicker = ColorPicker.Create(screen.background.transform, lockerPrefab);
            screen.colorPicker.gameObject.SetActive(false);
            screen.colorPicker.rectTransform.anchoredPosition = new Vector2(0, 30);

            return(screen);
        }