Exemple #1
0
        public void GetSeaTruckScannerModulesInRange(Vector3 position, float range, ICollection <SeaTruckScannerModuleManager> outlist)
        {
            for (int i = 0; i < Main.scannerModules.Count; i++)
            {
                SeaTruckScannerModuleManager manager = Main.scannerModules[i];

                if ((manager.transform.position - position).sqrMagnitude <= range * range)
                {
                    outlist.Add(manager);
                }
            }
        }
        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;
        }