private void OnDataLoaded(SaveData allSaveData)
 {
     Logger.Log("OnDataLoaded");
     saveData = GetSaveData();
     InitializeFromSaveData();
     InitializeFilters();
     UpdateText();
 }
예제 #2
0
 private void SetColor(SaveDataEntry saveData)
 {
     label.text.color = saveData.LabelColor.ToColor();
     labelColorSetting.SetColor(saveData.LabelColor.ToColor());
     iconColorSetting.SetColor(saveData.IconColor.ToColor());
     textColorSetting.SetColor(saveData.OtherTextColor.ToColor());
     buttonsColorSetting.SetColor(saveData.ButtonsColor.ToColor());
     lockerColorSetting.SetColor(saveData.LockerColor.ToColor());
 }
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////
        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);
        }
예제 #4
0
        public void SaveFilters(SaveData saveData)
        {
            var prefabIdentifier = GetComponent <PrefabIdentifier>();
            var id = prefabIdentifier.Id;

            var entry = new SaveDataEntry()
            {
                Id = id, FilterData = currentFilters
            };

            saveData.Entries.Add(entry);
        }
        private void Initialize(SaveDataEntry data, Text textPrefab)
        {
            target = data;

            text                 = GameObject.Instantiate(textPrefab);
            text.fontSize        = 16;
            text.gameObject.name = "Text";
            text.rectTransform.SetParent(transform, false);
            RectTransformExtensions.SetSize(text.rectTransform, 140, 50);

            text.text = target.Label;
        }
예제 #6
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);
        }
        ///////////////////////////////////////////////////////////////////////////////////////////
        public static LabelController Create(SaveDataEntry data, Transform parent)
        {
            var lockerPrefab = Resources.Load <GameObject>("Submarine/Build/SmallLocker");
            var textPrefab   = Instantiate(lockerPrefab.GetComponentInChildren <Text>());

            textPrefab.fontSize = 12;
            textPrefab.color    = CustomizeScreen.ScreenContentColor;

            var habitatNameController = new GameObject("LabelController", typeof(RectTransform)).AddComponent <LabelController>();
            var rt = habitatNameController.gameObject.transform as RectTransform;

            RectTransformExtensions.SetParams(rt, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), parent);
            habitatNameController.Initialize(data, textPrefab);

            return(habitatNameController);
        }
예제 #8
0
        private void Initialize()
        {
            background.gameObject.SetActive(true);
            icon.gameObject.SetActive(true);
            text.gameObject.SetActive(true);

            background.sprite           = ImageUtils.LoadSprite(Mod.GetAssetPath("LockerScreen.png"));
            icon.sprite                 = ImageUtils.LoadSprite(Mod.GetAssetPath("Receptacle.png"));
            configureButtonImage.sprite = ImageUtils.LoadSprite(Mod.GetAssetPath("Configure.png"));
            customizeButtonImage.sprite = ImageUtils.LoadSprite(Mod.GetAssetPath("Edit.png"));

            configureButton.onClick = ShowConfigureMenu;
            customizeButton.onClick = ShowCustomizeMenu;

            saveData = GetSaveData();
            InitializeFromSaveData();

            InitializeFilters();

            UpdateText();

            StartCoroutine("FinalSetup");
            initialized = true;
        }
예제 #9
0
 private void Initialize(SaveDataEntry data, Text textPrefab)