Inheritance: EventType
Beispiel #1
0
    public void CutMesh(float time)
    {
        if (typeTarget.GetComponent<MeshRenderer> ().material.color.a < 0.9f)
            return;
        if (!this.name.Equals("")) {
            AudioSource.PlayClipAtPoint(typeSound, Vector3.zero, windowVolume);
            this.name = this.name.Substring (1);
            typeTarget.GetComponent<TextMesh> ().text =
                typeTarget.GetComponent<TextMesh> ().text.Substring (1);
            MeshRenderer meshRender = typeTarget.GetComponent<MeshRenderer> ();
            typeBackground.transform.localScale = new Vector3 ((meshRender.bounds.size.x + (padding * 2.0f)) /
            typeBackground.GetComponent<SpriteRenderer> ().bounds.size.x * typeBackground.transform.localScale.x,
            typeBackground.transform.localScale.y, typeBackground.transform.localScale.z);

            currentPulse = PulseType.IN;
            if (this.name.Equals (""))
            {
                startFadeTime = time;
                GameObject gun = GameObject.Find("Gun");
                gun.GetComponent<PlayerShot>().Shoot();
                AudioSource.PlayClipAtPoint(exitSound, Vector3.zero, windowVolume);
                currentFade = FadeType.FADEOUT;
            }
        }
    }
Beispiel #2
0
    public void CutMesh(float time)
    {
        if (typeTarget.GetComponent <MeshRenderer> ().material.color.a < 0.9f)
        {
            return;
        }
        if (!this.name.Equals(""))
        {
            AudioSource.PlayClipAtPoint(typeSound, Vector3.zero, windowVolume);
            this.name = this.name.Substring(1);
            typeTarget.GetComponent <TextMesh> ().text =
                typeTarget.GetComponent <TextMesh> ().text.Substring(1);
            MeshRenderer meshRender = typeTarget.GetComponent <MeshRenderer> ();
            typeBackground.transform.localScale = new Vector3((meshRender.bounds.size.x + (padding * 2.0f)) /
                                                              typeBackground.GetComponent <SpriteRenderer> ().bounds.size.x *typeBackground.transform.localScale.x,
                                                              typeBackground.transform.localScale.y, typeBackground.transform.localScale.z);

            currentPulse = PulseType.IN;
            if (this.name.Equals(""))
            {
                startFadeTime = time;
                GameObject gun = GameObject.Find("Gun");
                gun.GetComponent <PlayerShot>().Shoot();
                AudioSource.PlayClipAtPoint(exitSound, Vector3.zero, windowVolume);
                currentFade = FadeType.FADEOUT;
            }
        }
    }
Beispiel #3
0
    public static PulseType SelectAndReturnPulseType(string typeName)
    {
        Sqlite.Open();
        dbcmd.CommandText = "SELECT * " +
            " FROM " + Constants.PulseTypeTable +
            " WHERE name  = \"" + typeName +
            "\" ORDER BY uniqueID";

        LogB.SQL(dbcmd.CommandText.ToString());
        dbcmd.ExecuteNonQuery();

        SqliteDataReader reader;
        reader = dbcmd.ExecuteReader();

        PulseType myPulseType = new PulseType();

        while(reader.Read()) {
            myPulseType.Name = reader[1].ToString();
            myPulseType.FixedPulse = Convert.ToDouble(reader[2].ToString());
            myPulseType.TotalPulsesNum = Convert.ToInt32(reader[3]);
        }

        reader.Close();
        Sqlite.Close();

        return myPulseType;
    }
Beispiel #4
0
    public static PulseType SelectAndReturnPulseType(string typeName)
    {
        Sqlite.Open();
        dbcmd.CommandText = "SELECT * " +
                            " FROM " + Constants.PulseTypeTable +
                            " WHERE name  = \"" + typeName +
                            "\" ORDER BY uniqueID";

        LogB.SQL(dbcmd.CommandText.ToString());
        dbcmd.ExecuteNonQuery();

        SqliteDataReader reader;

        reader = dbcmd.ExecuteReader();

        PulseType myPulseType = new PulseType();

        while (reader.Read())
        {
            myPulseType.Name           = reader[1].ToString();
            myPulseType.FixedPulse     = Convert.ToDouble(reader[2].ToString());
            myPulseType.TotalPulsesNum = Convert.ToInt32(reader[3]);
        }

        reader.Close();
        Sqlite.Close();

        return(myPulseType);
    }
Beispiel #5
0
        public override void MouseDown(Point location)
        {
            if (_clickType == ClickType.Touch)
            {
                if (_clickableVertical)
                {
                    _increment = (location.Y > (this.GetCurrentTranslation( ).Y + Height / 2d));
                    _pulseType = PulseType.Vertical;

                    Pulse(_pulseType, _increment);
                }
                else if (_clickableHorizontal)
                {
                    _increment = (location.X > (this.GetCurrentTranslation( ).X + Width / 2d));
                    _pulseType = PulseType.Horizontal;
                    Pulse(_pulseType, _increment);
                }

                //_repeating = false;
                ////_repeatRate = 200d;
                //_repeatRate = 0d;
                //_lastRepeat = Environment.TickCount & Int32.MaxValue;

                //if ( Parent != null && Parent.Profile != null )
                //{
                //    Parent.Profile.ProfileTick += new EventHandler( Profile_ProfileTick );
                //}
            }
            else if (_clickType == ClickType.Swipe)
            {
                _mouseDown         = true;
                _mouseDownLocation = location;
            }
        }
 protected override void Pulse(PulseType type, bool increment)
 {
     if ((increment && InvertedHorizontal == false && InvertedHorizontal == false) || (!increment && (InvertedHorizontal == true || InvertedHorizontal == true)))
     {
         if (type == PulseType.Vertical)
         {
             ValueTranslationY = Math.Min(ValueTranslationY + _stepValueTranslationY, 1);
         }
         else if (type == PulseType.Horizontal)
         {
             ValueTranslationX = Math.Min(ValueTranslationX + _stepValueTranslationX, 1);
         }
     }
     else
     {
         if (type == PulseType.Vertical)
         {
             ValueTranslationY = Math.Max(ValueTranslationY - _stepValueTranslationY, 0);
         }
         else if (type == PulseType.Horizontal)
         {
             ValueTranslationX = Math.Max(ValueTranslationX - _stepValueTranslationX, 0);
         }
     }
 }
Beispiel #7
0
 protected override void PulseThisNative(PulseType type)
 {
     base.PulseThisNative(type);
     if (type == PulseType.Reset)
     {
         Frame = 0;
     }
 }
Beispiel #8
0
 protected override void PulseThisNative(PulseType type)
 {
     base.PulseThisNative(type);
     if (type == PulseType.Reset)
     {
         SetValue(Input.DefaultValue, false);
     }
 }
Beispiel #9
0
        protected override void PulseThisNative(PulseType type)
        {
            base.PulseThisNative(type);

            if (type == PulseType.PositionChanged)
            {
                UpdateSign();
            }
        }
        protected override double CalculateNumberSteps(PulseType type, double increment)
        {
            double maxValueTranslation  = type == PulseType.Horizontal ? MaxValueTranslationX : MaxValueTranslationY;
            double minValueTranslation  = type == PulseType.Horizontal ? MinValueTranslationX : MinValueTranslationY;
            double stepValueTranslation = type == PulseType.Horizontal ? StepValueTranslationX : StepValueTranslationY;

            double number = increment / ((maxValueTranslation - minValueTranslation) * stepValueTranslation);

            return(number);
        }
Beispiel #11
0
    private void on_extra_window_pulses_test_changed(object o, EventArgs args)
    {
        if (extra_window_radio_pulses_free.Active)
        {
            currentPulseType = new PulseType("Free");
        }
        else if (extra_window_radio_pulses_custom.Active)
        {
            currentPulseType = new PulseType("Custom");
        }

        extra_window_pulses_initialize(currentPulseType);
    }
Beispiel #12
0
        public override void MouseDrag(Point location)
        {
            if (_mouseDown && _clickType == ClickType.Swipe)
            {
                if (DragOneOnOne)
                {
                    double    increment = 0;
                    PulseType type      = PulseType.None;

                    if (_clickableVertical)
                    {
                        increment = location.Y - _mouseDownLocation.Y;
                        type      = PulseType.Vertical;
                    }
                    else if (_clickableHorizontal)
                    {
                        increment = location.X - _mouseDownLocation.X;
                        type      = PulseType.Horizontal;
                    }

                    var numberSteps = CalculateNumberSteps(type, increment);
                    for (int i = 0; i < Math.Round(Math.Abs(numberSteps)); i++)
                    {
                        Pulse(type, increment > 0);
                    }
                    _mouseDownLocation = location;
                }
                else
                {
                    if (_clickableVertical)
                    {
                        var increment = location.Y - _mouseDownLocation.Y;
                        if ((increment > 0 && increment > _swipeThreshold) || (increment < 0 && (increment * -1) > _swipeThreshold))
                        {
                            Pulse(PulseType.Vertical, increment > 0);
                            _mouseDownLocation = location;
                        }
                    }
                    else if (_clickableHorizontal)
                    {
                        var increment = location.X - _mouseDownLocation.X;
                        if ((increment > 0 && increment > _swipeThreshold) || (increment < 0 && (increment * -1) > _swipeThreshold))
                        {
                            Pulse(PulseType.Horizontal, increment > 0);
                            _mouseDownLocation = location;
                        }
                    }
                }
            }
        }
Beispiel #13
0
    private string createTextForTextView(PulseType myPulseType)
    {
        string pulseTypeString = string.Format(Catalog.GetString(
                                                   "PulseType: {0}."), myPulseType.Name);

        string fixedString = "";


        /*
         * currently all pulseTypes are non fixed, and it's not possible to create more types (by user), then there are no limitations
         */

        return(pulseTypeString + fixedString);
    }
Beispiel #14
0
    private void extra_window_pulses_initialize(PulseType myPulseType)
    {
        currentEventType = myPulseType;
        changeTestImage(EventType.Types.PULSE.ToString(), myPulseType.Name, myPulseType.ImageFileName);
        bool hasOptions = false;

        if (myPulseType.Name == "Custom")
        {
            hasOptions = true;
            extra_window_pulses_spinbutton_pulse_step.Value   = extra_window_pulseStep;
            extra_window_pulses_spinbutton_total_pulses.Value = extra_window_totalPulses;
        }

        extra_window_pulses_showNoOptions(hasOptions);
    }
Beispiel #15
0
    private void extra_window_pulses_initialize(PulseType myPulseType)
    {
        extra_window_pulses_label_selected.Text = "<b>" + Catalog.GetString(myPulseType.Name) + "</b>";
        extra_window_pulses_label_selected.UseMarkup = true;
        currentEventType = myPulseType;
        changeTestImage(EventType.Types.PULSE.ToString(), myPulseType.Name, myPulseType.ImageFileName);
        bool hasOptions = false;

        if(myPulseType.Name == "Custom") {
            hasOptions = true;
            extra_window_pulses_spinbutton_pulse_step.Value = extra_window_pulseStep;
            extra_window_pulses_spinbutton_total_pulses.Value = extra_window_totalPulses;
        }

        extra_window_pulses_showNoOptions(hasOptions);
    }
Beispiel #16
0
    Pulse myPulse;     //used on button_accept


    RepairPulseWindow(Gtk.Window parent, Pulse myPulse, int pDN)
    {
        Glade.XML gladeXML;
        gladeXML = Glade.XML.FromAssembly(Util.GetGladePath() + "repair_sub_event.glade", "repair_sub_event", "chronojump");
        gladeXML.Autoconnect(this);

        //put an icon to window
        UtilGtk.IconWindow(repair_sub_event);

        repair_sub_event.Parent = parent;
        this.myPulse            = myPulse;

        repair_sub_event.Title = Catalog.GetString("Repair pulse");

        System.Globalization.NumberFormatInfo localeInfo = new System.Globalization.NumberFormatInfo();
        localeInfo        = System.Globalization.NumberFormatInfo.CurrentInfo;
        label_header.Text = string.Format(Catalog.GetString("Use this window to repair this test.\nDouble clic any cell to edit it (decimal separator: '{0}')"), localeInfo.NumberDecimalSeparator);


        pulseType = SqlitePulseType.SelectAndReturnPulseType(myPulse.Type);

        TextBuffer tb = new TextBuffer(new TextTagTable());

        tb.Text          = createTextForTextView(pulseType);
        textview1.Buffer = tb;

        createTreeView(treeview_subevents);
        //count, time
        store = new TreeStore(typeof(string), typeof(string));
        treeview_subevents.Model = store;
        fillTreeView(treeview_subevents, store, myPulse, pDN);

        button_add_before.Sensitive = false;
        button_add_after.Sensitive  = false;
        button_delete.Sensitive     = false;

        label_totaltime_value.Text = getTotalTime().ToString() + " " + Catalog.GetString("seconds");

        treeview_subevents.Selection.Changed += onSelectionEntry;
    }
Beispiel #17
0
    public void PulseMesh(float pulseSpeed)
    {
        if (currentPulse == PulseType.NONE)
        {
            return;
        }
        else if (currentPulse == PulseType.IN)
        {
            typeBackground.transform.localScale -= new Vector3(0, pulseSpeed, 0);
        }
        else
        {
            typeBackground.transform.localScale += new Vector3(0, pulseSpeed, 0);
        }

        if (typeBackground.transform.localScale.y >= originalWordScale.y)
        {
            currentPulse = PulseType.NONE;
        }
        else if (typeBackground.transform.localScale.y <= originalWordScale.y * 0.75f)
        {
            currentPulse = PulseType.OUT;
        }
    }
Beispiel #18
0
 protected abstract double CalculateNumberSteps(PulseType type, double increment);
Beispiel #19
0
    private string createTextForTextView(PulseType myPulseType)
    {
        string pulseTypeString = string.Format(Catalog.GetString(
                    "PulseType: {0}."), myPulseType.Name);

        string fixedString = "";

        /*
         * currently all pulseTypes are non fixed, and it's not possible to create more types (by user), then there are no limitations
         */

        return pulseTypeString + fixedString;
    }
Beispiel #20
0
    private bool eventTypeHasLongDescription(string eventTypeString, string eventName)
    {
        if(eventTypeString != "" && eventName != "")
        {
            EventType myType = new EventType ();

            if(eventTypeString == EventType.Types.JUMP.ToString())
                myType = new JumpType(eventName);
            else if (eventTypeString == EventType.Types.RUN.ToString())
                myType = new RunType(eventName);
            else if (eventTypeString == EventType.Types.REACTIONTIME.ToString())
                myType = new ReactionTimeType(eventName);
            else if (eventTypeString == EventType.Types.PULSE.ToString())
                myType = new PulseType(eventName);
            else if (eventTypeString == EventType.Types.MULTICHRONOPIC.ToString())
                myType = new MultiChronopicType(eventName);
            else Log.WriteLine("Error on eventTypeHasLongDescription");

            if(myType.HasLongDescription)
                return true;
        }
        return false;
    }
Beispiel #21
0
    public void PulseMesh(float pulseSpeed)
    {
        if (currentPulse == PulseType.NONE)
            return;
        else if (currentPulse == PulseType.IN) typeBackground.transform.localScale -= new Vector3 (0, pulseSpeed, 0);
        else typeBackground.transform.localScale += new Vector3 (0, pulseSpeed, 0);

        if (typeBackground.transform.localScale.y >= originalWordScale.y)
            currentPulse = PulseType.NONE;
        else if (typeBackground.transform.localScale.y <= originalWordScale.y * 0.75f)
            currentPulse = PulseType.OUT;
    }
Beispiel #22
0
    RepairPulseWindow(Gtk.Window parent, Pulse myPulse, int pDN)
    {
        Glade.XML gladeXML;
        gladeXML = Glade.XML.FromAssembly (Util.GetGladePath() + "chronojump.glade", "repair_sub_event", null);
        gladeXML.Autoconnect(this);

        //put an icon to window
        UtilGtk.IconWindow(repair_sub_event);

        this.parent = parent;
        this.myPulse = myPulse;

        repair_sub_event.Title = Catalog.GetString("Repair pulse");

        System.Globalization.NumberFormatInfo localeInfo = new System.Globalization.NumberFormatInfo();
        localeInfo = System.Globalization.NumberFormatInfo.CurrentInfo;
        label_header.Text = string.Format(Catalog.GetString("Use this window to repair this test.\nDouble clic any cell to edit it (decimal separator: '{0}')"), localeInfo.NumberDecimalSeparator);

        pulseType = SqlitePulseType.SelectAndReturnPulseType(myPulse.Type);

        TextBuffer tb = new TextBuffer (new TextTagTable());
        tb.Text = createTextForTextView(pulseType);
        textview1.Buffer = tb;

        createTreeView(treeview_subevents);
        //count, time
        store = new TreeStore(typeof (string), typeof (string));
        treeview_subevents.Model = store;
        fillTreeView (treeview_subevents, store, myPulse, pDN);

        button_add_before.Sensitive = false;
        button_add_after.Sensitive = false;
        button_delete.Sensitive = false;

        label_totaltime_value.Text = getTotalTime().ToString() + " " + Catalog.GetString("seconds");

        treeview_subevents.Selection.Changed += onSelectionEntry;
    }
Beispiel #23
0
 protected abstract void Pulse(PulseType type, bool increment);
Beispiel #24
0
 private void PublishPulse(PulseType pulseType)
 {
     this.redisStorage.Publish(this.WaitChannel, ((int)pulseType).ToString());
 }
Beispiel #25
0
    private void on_extra_window_pulses_test_changed(object o, EventArgs args)
    {
        if(extra_window_radio_pulses_free.Active) currentPulseType = new PulseType("Free");
        else if (extra_window_radio_pulses_custom.Active) currentPulseType = new PulseType("Custom");

        extra_window_pulses_initialize(currentPulseType);
    }