private void Initialize(HabitatControlPanel controlPanel, Text textPrefab) { target = controlPanel; activeButton = ColoredIconButton.Create(transform, HabitatControlPanel.ScreenContentColor, textPrefab, "Beacon Color", 100, 15); activeButton.text.supportRichText = true; }
public void Initialize(HabitatControlPanel target, PingType initialType) { base.Initialize(); this.target = target; var names = Enum.GetNames(typeof(PingType)); var values = (PingType[])Enum.GetValues(typeof(PingType)); var color = PingManager.colorOptions[target.BeaconColorIndex]; int initialPage = 0; for (int i = 0; i < buttons.Count; ++i) { var button = buttons[i]; var name = names[i + 1]; var value = values[i + 1]; var sprite = SpriteManager.Get(SpriteManager.Group.Pings, name); button.Initialize((int)value, color, value == initialType, sprite); if (value == initialType) { initialPage = i / ButtonsPerPage; } } onSelect = OnSelect; ShowPage(initialPage); }
private void Initialize(HabitatControlPanel controlPanel, Text textPrefab) { target = controlPanel; activeButton = CheckboxButton.CreateCheckbox(transform, HabitatControlPanel.ScreenContentColor, textPrefab, "", 150); activeButton.text.supportRichText = true; UpdateText(); }
private void Initialize(HabitatControlPanel controlPanel, Text textPrefab) { target = controlPanel; habitatNameText = GameObject.Instantiate(textPrefab); habitatNameText.fontSize = 16; habitatNameText.gameObject.name = "HabitatNameText"; habitatNameText.rectTransform.SetParent(transform, false); RectTransformExtensions.SetSize(habitatNameText.rectTransform, 140, 50); habitatNameText.text = target.HabitatLabel; }
public void Initialize(HabitatControlPanel target, Color initialColor) { base.Initialize(); this.target = target; var sprite = ImageUtils.LoadSprite(Mod.GetAssetPath("Circle.png"), new Vector2(0.5f, 0.5f)); for (int i = 0; i < buttons.Count; ++i) { var button = buttons[i]; button.Initialize(i, Colors[i], Colors[i] == initialColor, sprite); } onSelect = OnSelect; }
/////////////////////////////////////////////////////////////////////////////////////////// public static HabitatNameController Create(HabitatControlPanel controlPanel, Transform parent) { var lockerPrefab = Resources.Load <GameObject>("Submarine/Build/SmallLocker"); var textPrefab = Instantiate(lockerPrefab.GetComponentInChildren <Text>()); textPrefab.fontSize = 12; textPrefab.color = HabitatControlPanel.ScreenContentColor; var habitatNameController = new GameObject("HabitatNameController", typeof(RectTransform)).AddComponent <HabitatNameController>(); 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(controlPanel, textPrefab); return(habitatNameController); }
public void Initialize(HabitatControlPanel target, int initialIndex) { base.Initialize(); this.target = target; var sprite = ImageUtils.LoadSprite(Mod.GetAssetPath("Circle.png"), new Vector2(0.5f, 0.5f)); for (int i = 0; i < buttons.Count; ++i) { var button = buttons[i]; button.Initialize(i, PingManager.colorOptions[i], i == initialIndex, sprite); } onSelect += OnSelect; }
/////////////////////////////////////////////////////////////////////////////////////////// public static BatteryIndicator Create(HabitatControlPanel controlPanel, Transform parent) { var lockerPrefab = Resources.Load <GameObject>("Submarine/Build/SmallLocker"); var textPrefab = Instantiate(lockerPrefab.GetComponentInChildren <Text>()); textPrefab.fontSize = 12; textPrefab.color = HabitatControlPanel.ScreenContentColor; var chargerPrefab = Resources.Load <GameObject>("Submarine/Build/PowerCellCharger"); var charger = chargerPrefab.GetComponent <PowerCellCharger>(); var batteryUi = GameObject.Instantiate(charger.uiPowered.transform.Find("Battery1").gameObject); var batteryIndicator = new GameObject("BatteryIndicator", typeof(RectTransform)).AddComponent <BatteryIndicator>(); var rt = batteryIndicator.gameObject.transform as RectTransform; RectTransformExtensions.SetParams(rt, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), parent); RectTransformExtensions.SetSize(rt, 100, 100); rt.anchoredPosition = new Vector2(0, 0); batteryIndicator.Initialize(textPrefab, batteryUi); return(batteryIndicator); }
public static void AddBuildables() { HabitatControlPanel.AddBuildable(); }