Ejemplo n.º 1
0
        private void spectrumToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form2 windowR = new Form2();
            Form2 windowG = new Form2();
            Form2 windowB = new Form2();

            windowR.Text = "RED";
            windowG.Text = "GREEN";
            windowB.Text = "BLUE";
            toolStripProgressBar1.Maximum = Image_mem.Width;
            for (int i = 0; i < Image_mem.Width; i++)
            {
                toolStripProgressBar1.Value = i;
                for (int j = 0; j < Image_mem.Height; j++)
                {
                    Color color = Image_mem.GetPixel(i, j);
                    ImageR.SetPixel(i, j, Color.FromArgb(255, color.R, color.R, color.R));
                    ImageG.SetPixel(i, j, Color.FromArgb(255, color.G, color.G, color.G));
                    ImageB.SetPixel(i, j, Color.FromArgb(255, color.B, color.B, color.B));
                }
            }
            toolStripProgressBar1.Value = 0;
            windowR.pictureBox1.Image   = new Bitmap(ImageR);
            windowG.pictureBox1.Image   = new Bitmap(ImageG);
            windowB.pictureBox1.Image   = new Bitmap(ImageB);
            windowR.Show();
            windowG.Show();
            windowB.Show();
        }
Ejemplo n.º 2
0
    public void CheckSolution()
    {
        for (var i = 0; i < 7; i++)
        {
            var boxContent = _boxes[i].transform.Find("Drop Image").GetComponent <UnityEngine.UI.Image>().overrideSprite;
            if (boxContent != null)
            {
                //record to database
                if (_log != null)
                {
                    var locations = Order[_usedOrder[_imageCounter]];
                    _log.InsertLiveMeasurement("JRD_2D", locations, null, (i + 1).ToString());
                }
                _answered = true;
            }
        }
        if (_answered)
        {
            if (JrdImageRemover != null)
            {
                JrdImageRemover.resetImages();
            }
            _answered = false;
            _imageCounter++;
            if (_imageCounter < MaxRepetitions)
            {
                var locations = "";
                locations = Order[_usedOrder[_imageCounter]];

                _goalDir   = Landmarks[int.Parse(locations.Substring(2, 1))];
                _inFrontOf = Landmarks[int.Parse(locations.Substring(0, 1))];
                _lookAt    = Landmarks[int.Parse(locations.Substring(1, 1))];
                ImageA.GetComponent <UnityEngine.UI.Image>().sprite = _inFrontOf;
                ImageB.GetComponent <UnityEngine.UI.Image>().sprite = _lookAt;
                ImageC.GetComponent <UnityEngine.UI.Image>().sprite = _goalDir;
            }
            else
            {
                if (!_loading)
                {
                    _loading = true;
                    SceneManager.LoadScene("Launcher");
                }
            }
        }
    }
Ejemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        var launchManagerObject = GameObject.FindWithTag("LaunchManager");

        if (launchManagerObject != null)
        {
            var launchManager = launchManagerObject.GetComponent <LaunchManager>();
            _log = launchManager.LoggingManager;
        }
        else
        {
            Debug.LogError("LaunchManager not found");
        }

        var jrdBoxes = GameObject.Find("JRDBoxes");

        _boxes = new GameObject[7];
        for (int i = 0; i < 7; i++)
        {
            int num = i + 1;
            _boxes[i] = jrdBoxes.transform.Find($"Drop Box ({num})").gameObject;
        }

        _usedOrder = RandomizeOrder?CreateRandomOrder(Order.Length): Enumerable.Range(0, Order.Length).ToArray();

        var locations = "";

        locations = Order[_usedOrder[_imageCounter]];

        _goalDir   = Landmarks[int.Parse(locations.Substring(2, 1))];
        _inFrontOf = Landmarks[int.Parse(locations.Substring(0, 1))];
        _lookAt    = Landmarks[int.Parse(locations.Substring(1, 1))];
        ImageA.GetComponent <UnityEngine.UI.Image>().sprite = _inFrontOf;
        ImageB.GetComponent <UnityEngine.UI.Image>().sprite = _lookAt;
        ImageC.GetComponent <UnityEngine.UI.Image>().sprite = _goalDir;

        MaxRepetitions = MaxRepetitions < 0 ? Order.Length : MaxRepetitions;
    }
Ejemplo n.º 4
0
        public int Sample(Vector2i point)
        {
            int a = ImageA.Sample(point);
            int b = ImageB.Sample(point);

            switch (Operation)
            {
            case Operations.Add:
                return(a + b);

            case Operations.Subtract:
                return(a - b);

            case Operations.Multiply:
                return(a * b);

            case Operations.Divide:
                return(a / b);

            default:
                return(0);
            }
        }