예제 #1
0
    private void Awake()
    {
        selectedArtifactImage             = transform.Find("image_selected-artifact").GetComponent <Image>();
        selectedArtifactImage.color       = Color.clear;
        selectedArtifactBlendMode         = selectedArtifactImage.GetComponent <UIBlendMode>();
        selectedArtifactNameText          = transform.Find("text_selected-artifact-name").GetComponent <Text>();
        selectedArtifactNameText.text     = string.Empty;
        selectedArtifactScanInfoText      = transform.Find("text_selected-artifact-scan-info").GetComponent <Text>();
        selectedArtifactScanInfoText.text = string.Empty;
        analyzeSelectedArtifactButton     = transform.Find("button_analyze-artifact").GetComponent <Button>();
        analyzeSelectedArtifactButton.OnClick(() => {
            if (SelectedArtifact == null || SelectedArtifact.Status != ArtifactStatus.Found)
            {
                return;
            }

            WorkshopController.AnalyzeArtifact(SelectedArtifact);
            UpdateArtifactView();
        });
        contentParent = transform.Find("panel_artifacts/panel_scroll/content");

        foreach (var artifact in ServiceLocator.State.Artifacts)
        {
            if (artifact.Status == ArtifactStatus.NotFound)
            {
                continue;
            }

            var artifactButton = BaseView.AddUIElement("button_artifact", contentParent).GetComponent <ArtifactButton>();
            artifactButton.Initialize(artifact);
        }
        artifactsScroll = transform.Find("panel_artifacts/panel_scroll").GetComponent <ScrollRect>();
        artifactsScroll.verticalNormalizedPosition = 1;
        scrollUpButton = transform.Find("panel_artifacts/button_scroll-up").GetComponent <Button>();
        scrollUpButton.OnClick(() => artifactsScroll.verticalNormalizedPosition =
                                   Mathf.Clamp(artifactsScroll.verticalNormalizedPosition + 1 / ((RectTransform)contentParent).sizeDelta.y * 165, 0, 1));
        scrollDownButton = transform.Find("panel_artifacts/button_scroll-down").GetComponent <Button>();
        scrollDownButton.OnClick(() => artifactsScroll.verticalNormalizedPosition =
                                     Mathf.Clamp(artifactsScroll.verticalNormalizedPosition - 1 / ((RectTransform)contentParent).sizeDelta.y * 165, 0, 1));

        SelectedArtifact = ServiceLocator.State.Artifacts[0];
    }
예제 #2
0
    private void AddProbe(int[] probe, bool spot = false)
    {
        var synthProbe = BaseView.AddUIElement(spot ? "probe-spot" : "synth-probe", probesParent).GetComponent <SynthProbe>();

        synthProbe.Initialize(probe, spot);
    }