private void RebuildResourceList() { sortedTechTypes.Clear(); sortedTechTypes.AddRange(availableTechTypes); sortedTechTypes.Sort(new Comparison <TechType>(CompareByName)); int num = currentPage * resourceList.Count; int num2 = 0; int num3 = Mathf.Min(sortedTechTypes.Count, num + resourceList.Count); for (int i = num; i < num3; i++) { TechType techType = sortedTechTypes[i]; uGUI_SeaTruckResourceNode uGUI_SeaTruckResourceNode = resourceList[num2]; uGUI_SeaTruckResourceNode.gameObject.SetActive(true); uGUI_SeaTruckResourceNode.SetTechType(techType); num2++; } for (int j = num2; j < resourceList.Count; j++) { resourceList[j].gameObject.SetActive(false); } navText.text = Language.main.GetFormat("MapRoomPagesFormat", currentPage + 1, Pages); prevPageButton.GetComponent <Image>().color = ((currentPage != 0) ? defaultColor : disabledColor); nextPageButton.GetComponent <Image>().color = ((currentPage + 1 < Pages) ? defaultColor : disabledColor); }
public void Awake() { manager = GetComponentInParent <SeaTruckScannerModuleManager>(); raycaster = GetComponent <uGUI_GraphicRaycaster>(); scanner_cullable = transform.Find("scanner_cullable"); List <uGUI_MapRoomResourceNode> mapRoomNodes = new List <uGUI_MapRoomResourceNode>(); scanner_cullable.Find("list").gameObject.GetComponentsInChildren(true, mapRoomNodes); List <uGUI_SeaTruckResourceNode> seatruckNodes = new List <uGUI_SeaTruckResourceNode>(); foreach (uGUI_MapRoomResourceNode mapRoomNode in mapRoomNodes) { uGUI_SeaTruckResourceNode seatruckNode = mapRoomNode.gameObject.AddComponent <uGUI_SeaTruckResourceNode>(); resourceList.Add(seatruckNode); } resourceListRoot = scanner_cullable.Find("list").gameObject; scanningRoot = scanner_cullable.Find("scanning").gameObject; nextPageButton = scanner_cullable.Find("list/nav/scroll_down").gameObject; SetNextPageButtonEventTriggers(); prevPageButton = scanner_cullable.Find("list/nav/scroll_up").gameObject; SetPrevPageButtonEventTriggers(); scanner_cullable.Find("scanning/cancelButton").gameObject.AddComponent <uGUI_SeaTruckScannerCancel>(); activeTechTypeLabel = scanner_cullable.Find("scanning/activeTechType").GetComponent <TextMeshProUGUI>(); scanningText = scanner_cullable.Find("scanning/scanningText").GetComponent <TextMeshProUGUI>(); navText = scanner_cullable.Find("list/nav/pagenum").GetComponent <TextMeshProUGUI>(); scanningIcon = scanner_cullable.Find("scanning/icon").GetComponent <uGUI_Icon>(); startScanningSound = ScriptableObject.CreateInstance <FMODAsset>(); startScanningSound.name = "scan"; startScanningSound.path = "event:/sub/base/map room/scan"; cancelScanningSound = ScriptableObject.CreateInstance <FMODAsset>(); cancelScanningSound.name = "option_tweek"; cancelScanningSound.path = "event:/interface/option_tweek"; hoverSound = ScriptableObject.CreateInstance <FMODAsset>(); hoverSound.name = "select"; hoverSound.path = "event:/sub/base/map room/select"; pageChangeSound = ScriptableObject.CreateInstance <FMODAsset>(); pageChangeSound.name = "text_type"; pageChangeSound.path = "event:/interface/text_type"; segmentListener = transform.parent.GetComponentInParent <SeaTruckSegmentListener>(); segmentListener.onPlayerExited += OnPlayerExit; Sprite scanning_background = ImageUtils.LoadSpriteFromFile($"{Main.modFolder}/Assets/scanning_background_02.png"); Sprite scanning_foreground = ImageUtils.LoadSpriteFromFile($"{Main.modFolder}/Assets/scanning_foreground_02.png"); GameObject animation = scanningRoot.transform.Find("animation").gameObject; GameObject scanningBackground = new GameObject("scanningBackground", new Type[] { typeof(RectTransform) }); scanningBackground.transform.SetParent(scanningRoot.transform, false); scanningBackground.transform.SetSiblingIndex(0); scanningBackground.transform.localScale = new Vector3(0.62f, 0.62f, 0.62f); scanningBackground.transform.localPosition = new Vector3(0, -12f, 0); Image newScanningBackground = scanningBackground.AddComponent <Image>(); newScanningBackground.sprite = scanning_background; Image animationImage = animation.GetComponent <Image>(); animationImage.sprite = scanning_foreground; uGUI_RotateImage rotateImage = animation.GetComponent <uGUI_RotateImage>(); rotateImage.rotationTime = -4; }