Esempio n. 1
0
        // Get the appropriate Side from a string
        public static Side getSide(String sideName)
        {
//JAVA TO C# CONVERTER TODO TASK: The following line could not be converted:
            if (FRONT.getLabel().equals(sideName))
            {
                return(FRONT);
            }
//JAVA TO C# CONVERTER TODO TASK: The following line could not be converted:
            if (BACK.getLabel().equals(sideName))
            {
                return(BACK);
            }
            return(null);
        }
Esempio n. 2
0
        /// <summary>
        /// Yields a sequence of views that implement the tool
        /// </summary>
        public override IEnumerator <View> GetEnumerator()
        {
            IViewResult result;

            // for each image, get the user's input
            var stimuli = this.stimulusClass.Stimuli.ToIArray();

            for (int i = 0; i < stimuli.Count; i++)
            {
                yield return(new ClassifyView(stimuli[i], this.stimulusClass, out result));

                if (BACK.Equals(result.Value))
                {
                    i = Math.Max(-1, i - 2);
                    continue;
                }
                if (SKIP.Equals(result.Value))
                {
                    continue;
                }
                stimuli[i].Subclass = (bool?)result.Value;
            }

            // a brief break
            yield return(new RestView(500));

            // offer to save
            yield return(new ChoiceView(new string[]
            {
                SAVE,
                "Don't Save"
            }, out result));

            // save
            if (SAVE.Equals(result.Value))
            {
                if (this.stimulusClass.TrySave())
                {
                    yield return(new TextView("Results saved to " + this.stimulusClass.SavePath, 2000));
                }
                else
                {
                    GUIUtils.Alert("Failed to save results to " + this.stimulusClass.SavePath, MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 3
0
            public ClassifyView(Stimulus stimulus, StimulusClass stimulusClass, out IViewResult result)
                : base()
            {
                var   table    = this.RegisterDisposable(GUIUtils.CreateTable(new double[] { .7, .1, .2 }, Direction.Vertical));
                Panel topPanel = new Panel()
                {
                    Dock = DockStyle.Fill
                }, bottomPanel = new Panel()
                {
                    Dock = DockStyle.Fill
                };

                table.Controls.Add(topPanel, 0, 0);
                var label = new Label()
                {
                    Dock      = DockStyle.Fill,
                    AutoSize  = true,
                    TextAlign = ContentAlignment.MiddleCenter,
                    Text      = "Current selection: ",
                    Font      = GUIUtils.Constants.DISPLAY_FONT
                };

                table.Controls.Add(label, 0, 1);
                table.Controls.Add(bottomPanel, 0, 2);

                var imageView = new ImageView(-1)
                {
                    ImagePath = stimulus.PathOrText
                };
                var choiceView = new ChoiceView(new string[] { stimulusClass.Settings.Answer1, stimulusClass.Settings.Answer2, GUIUtils.Strings.UNCLASSIFIED, SKIP, BACK });

                this.DoOnDeploy(c =>
                {
                    this.DeploySubView(imageView, topPanel);
                    topPanel.Controls.Add(new Label()
                    {
                        Text = GUIUtils.Strings.ImageExtensions.Contains(Path.GetExtension(stimulus.PathOrText))
                            ? Path.GetFileNameWithoutExtension(stimulus.PathOrText)
                            : stimulus.PathOrText,
                        Dock      = DockStyle.Top,
                        TextAlign = ContentAlignment.MiddleCenter,
                        Font      = GUIUtils.Constants.DISPLAY_FONT
                    });
                    if (stimulus.Subclass == null)
                    {
                        label.Text += GUIUtils.Strings.UNCLASSIFIED;
                    }
                    else
                    {
                        label.Text += (bool)stimulus.Subclass
                            ? stimulusClass.Settings.Answer1
                            : stimulusClass.Settings.Answer2;
                    }
                    this.DeploySubView(choiceView, bottomPanel);
                    c.Controls.Add(table);
                });
                this.DoOnFinishing(() =>
                {
                    if (!(bool)imageView.Result.Value)
                    {
                        this.SetResult(null);
                    }
                    else if (stimulusClass.Settings.Answer1.Equals(choiceView.Result.Value))
                    {
                        this.SetResult(true);
                    }
                    else if (stimulusClass.Settings.Answer2.Equals(choiceView.Result.Value))
                    {
                        this.SetResult(false);
                    }
                    else if (BACK.Equals(choiceView.Result.Value))
                    {
                        this.SetResult(BACK);
                    }
                    else if (SKIP.Equals(choiceView.Result.Value))
                    {
                        this.SetResult(SKIP);
                    }
                    else
                    {
                        this.SetResult(null);
                    }
                });

                result = this.Result;
            }
    // Update is called once per frame
    void Update()
    {
//
//		Vector3 dwn = transform.TransformDirection(Vector3.down);
//
//		if(Physics.Raycast(transform.position,dwn,out hit,2.5f,lm)){
//
//			Debug.DrawLine(transform.position, hit.point,Color.red);
//
//			if(hit.collider.tag=="ground"){
//
//				isOnAir = false;
//
//			}
//
//		}else{
//
//			isOnAir = true;
//		}


        //print(transform.position);

        if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android)
        {
            if (Input.GetKey("mouse 0"))
            {
                Vector3 pos = Input.mousePosition;

                if (FWD.HitTest(pos))
                {
                    if (isOnAir)
                    {
                        //Player.SendMessage("setMass",3);
                        StartCoroutine(WaitForDisable(2.0f));
                    }
                    isDisable = true;
                    TyreParticle.SetActive(true);
                    Player.SendMessage("pickupFWD", 3);
                }


                if (BACK.HitTest(pos))
                {
                    if (isOnAir)
                    {
                        //	Player.SendMessage("setMass",2);
                        StartCoroutine(WaitForDisable(2.0f));
                    }

                    Player.SendMessage("pickupFWD", 2);
                }

                if (Pause.HitTest(pos))
                {
                    Application.LoadLevel(0);
                }
            }
            else
            {
                isOnAir = false;
                Player.SendMessage("setMass", 1);

                if (isDisable)
                {
                    isDisable = false;
                    StartCoroutine(particleDisable());
                }
                Player.SendMessage("pickupFWD", 1);
            }
        }

        if (Application.platform == RuntimePlatform.OSXEditor)
        {
            if (Input.GetKey(KeyCode.RightArrow))
            {
                isDisable = true;
                TyreParticle.SetActive(true);
                Player.SendMessage("pickupFWD", 3);

                if (isOnAir)
                {
                    Player.SendMessage("setMass", 3);
                    StartCoroutine(WaitForDisable(2.0f));
                }
            }
            else if (Input.GetKey(KeyCode.LeftArrow))
            {
                if (isOnAir)
                {
                    Player.SendMessage("setMass", 2);
                    StartCoroutine(WaitForDisable(2.0f));
                }
            }
            else
            {
                if (isDisable)
                {
                    isDisable = false;
                    StartCoroutine(particleDisable());
                }
                Player.SendMessage("pickupFWD", 1);
                Player.SendMessage("setMass", 1);
            }
        }
    }