Inheritance: EventType
Example #1
0
    private void Update()
    {
        GetInput();

        if (!isJumping && (jumpPressed || miniJumpPressed))
        {
            // Cuvamo vrstu skoka
            if (jumpPressed)
            {
                jumpType = JumpType.Big;
            }
            else if (miniJumpPressed)
            {
                jumpType = JumpType.Mini;
            }

            // Zapocinjemo skok
            StartJump();
        }

        if (isRotating)
        {
            Rotate();
        }

        if (isJumping)
        {
            Jump();
        }
    }
Example #2
0
        public JumpType Update(JumpType entity)
        {
            var toEdit = FindById(entity.IdJumpType);

            toEdit = entity;
            return(toEdit);
        }
Example #3
0
    private void on_combo_tests_changed(object o, EventArgs args)
    {
        if (UtilGtk.ComboGetActive(combo_test_types) == Catalog.GetString(Constants.UndefinedDefault))
        {
            UtilGtk.ComboUpdate(combo_variables, Util.StringToStringArray(Constants.UndefinedDefault), "");
        }
        else if (UtilGtk.ComboGetActive(combo_test_types) == Catalog.GetString(Constants.JumpSimpleName))
        {
            JumpType jt = SqliteJumpType.SelectAndReturnJumpType(UtilGtk.ComboGetActive(combo_tests), false);
            if (jt.StartIn)
            {
                UtilGtk.ComboUpdate(combo_variables, variablesJumpSimple, "");
            }
            else
            {
                UtilGtk.ComboUpdate(combo_variables, variablesJumpSimpleWithTC, "");
            }
        }
        else if (UtilGtk.ComboGetActive(combo_test_types) == Catalog.GetString(Constants.JumpReactiveName))
        {
            UtilGtk.ComboUpdate(combo_variables, variablesJumpReactive, "");
        }
        else if (UtilGtk.ComboGetActive(combo_test_types) == Catalog.GetString(Constants.RunSimpleName))
        {
            UtilGtk.ComboUpdate(combo_variables, variablesRunSimple, "");
        }
        else
        {
            new DialogMessage(Constants.MessageTypes.WARNING, "Problem on tests");
        }

        combo_variables.Active = 0;

        on_entries_required_changed(new object(), new EventArgs());
    }
Example #4
0
    /// <summary>
    /// Base on number of each jump type. We will permutate it.
    /// </summary>
    /// <returns>The permutation jumps.</returns>
    /// <param name="shortJump">Short jump.</param>
    /// <param name="mediumJump">Medium jump.</param>
    /// <param name="longJump">Long jump.</param>
    private static List <JumpType> RandomJumpList(int shortJump, int mediumJump, int longJump)
    {
        List <JumpType> jumpLine = new List <JumpType> ();

        for (int i = 0; i < shortJump; i++)
        {
            jumpLine.Add(JumpType.SHORT_JUMP);
        }
        for (int i = 0; i < mediumJump; i++)
        {
            jumpLine.Add(JumpType.MEDIUM_JUMP);
        }
        for (int i = 0; i < longJump; i++)
        {
            jumpLine.Add(JumpType.LONG_JUMP);
        }

        for (int i = 0; i < jumpLine.Count; i++)
        {
            int      minRange = Mathf.Max(0, i - jumpLine.Count / 3);
            int      maxRange = Mathf.Min(jumpLine.Count, i + jumpLine.Count / 3);
            int      ran      = UnityEngine.Random.Range(minRange, maxRange);
            JumpType tmp      = jumpLine [i];
            jumpLine [i]   = jumpLine [ran];
            jumpLine [ran] = tmp;
        }
        return(jumpLine);
    }
Example #5
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            Debug.Log("Normal Jump");
            Type = JumpType.Normal;
            DoJump(Type);
        }

        if (Input.GetKey(KeyCode.UpArrow))
        {
            if (Input.GetKeyDown(KeyCode.LeftArrow))
            {
                Debug.Log("Left Strafe");
                Type = JumpType.LeftStrafe;
                DoJump(Type);
            }
            else if (Input.GetKeyDown(KeyCode.RightArrow))
            {
                Debug.Log("Right Strafe");
                Type = JumpType.RightStrafe;
                DoJump(Type);
            }
        }
    }
 public void SetPositionFor(JumpType jumpType)
 {
     foreach (JumpPlaceholder jumpPlaceholder in this.Where(j => j.Type == jumpType))
     {
         jumpPlaceholder.End();
     }
 }
Example #7
0
    /// <summary>
    /// Call this to allow jumping from a given state.
    /// This is used to workaround the lack of oneshot Input events in the physics step.
    /// </summary>
    void AllowJump(JumpType jumpType)
    {
        transform.parent = null;

        if (Input.touchCount > 0 || Input.GetKey(KeyCode.Space) || Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.W))
        {
            jumpWanted = true;
            switch (jumpType)
            {
            case JumpType.Standard:
            {
                playerAnimation.Jump();
                SetPlayerState(PlayerState.Jump);
            }
                return;

            case JumpType.WallJump:
            {
                playerAnimation.Jump();
                SetPlayerState(PlayerState.WallJump);
            }
                return;
            }
        }

        jumpWanted = false;
    }
        private void CreateEdge(ControlFlowNode fromNode, ControlFlowNode toNode, JumpType type)
        {
            ControlFlowEdge edge = new ControlFlowEdge(fromNode, toNode, type);

            fromNode.Outgoing.Add(edge);
            toNode.Incoming.Add(edge);
        }
Example #9
0
    /// <summary>
    /// Apply jump action based on the type
    /// </summary>
    /// <param name="baseJumpForce">base jump force</param>
    /// <param name="timeMultiplier">the time that the player held the button down</param>
    /// <param name="jumpType">Type of jump action to perform</param>
    void Jump(int baseJumpForce, float timeMultiplier, JumpType jumpType)
    {
        var totalJumpForce = baseJumpForce + timeMultiplier * timeMultiplierBaseForce;
        var rigidBody2D    = gameObject.GetComponent <Rigidbody2D>();

        if (isGrounded || canJump)
        {
            /// Normal Jump
            if (jumpType == JumpType.NormalJump)
            {
                rigidBody2D.AddForce(new Vector2(0, totalJumpForce));
                canJump = false;
            }
            /// Double JUMP
            else if (jumpType == JumpType.DoubleJump)
            {
                canJump = true;
                doubleJumpCounter++;

                if (doubleJumpCounter == MaxDoubleJumps)
                {
                    canJump = false;
                }

                rigidBody2D.AddForce(new Vector2(0, totalJumpForce));
            }
        }

        isGrounded = false;
    }
Example #10
0
 private static void ConvertJump(ArticyData articyData, JumpType jump)
 {
     if (jump != null)
     {
         articyData.jumps.Add(jump.Id, new ArticyData.Jump(jump.Id, jump.TechnicalName, ConvertLocalizableText(jump.DisplayName),
                                                           ConvertLocalizableText(jump.Text), ConvertFeatures(jump.Features), Vector2.zero, ConvertConnectionRef(jump.Target), ConvertPins(jump.Pins)));
     }
 }
Example #11
0
 public JumpPlaceholder(BytecodeWriter writer, JumpType type)
 {
     Writer         = writer;
     Type           = type;
     placeHolderIdx = writer.bytecode.Count;
     writer.WriteByte(0);
     writer.WriteByte(0);
 }
 public JournalStartJump(JObject evt) : base(evt, JournalTypeEnum.StartJump)
 {
     JumpType          = evt["JumpType"].Str();
     IsHyperspace      = JumpType.Equals("Hyperspace", System.StringComparison.InvariantCultureIgnoreCase);
     StarSystem        = evt["StarSystem"].Str();
     StarClass         = evt["StarClass"].Str();
     FriendlyStarClass = (StarClass.Length > 0) ? Bodies.StarName(Bodies.StarStr2Enum(StarClass)) : "";
     SystemAddress     = evt["SystemAddress"].LongNull();
 }
Example #13
0
		public JumpInstruction(int offset, JumpType jumpType, Condition condition, ushort destination)
			: base(offset, condition)
		{
			this.jumpType = jumpType;
			this.destination = destination;

			if (!(JumpsToRom || JumpsToHighRam))
				throw new NotSupportedException("Jumps outside of ROM or HRAM are unsupported yet.");
		}
 public Jump(ref Instruction instruction)
 {
     this.op          = instruction.op;
     this.operands    = instruction.operands;
     this.isAddr      = instruction.isAddr;
     instruction      = null;
     this.isRelative  = (this.operands[0] & 0x80) != 0;
     this.type        = (JumpType)((this.operands[0] >> 4) & 7);
     this.codeAddress = (UInt16)((((UInt16)this.operands[0] & 0xF) << 8) | this.operands[1]);
 }
Example #15
0
    public static string [] SelectTestMaxStuff(int personID, JumpType jumpType)
    {
        double tc = 0.0;

        if (!jumpType.StartIn)
        {
            tc = 1;             //just a mark meaning that tc has to be shown
        }
        double tv = 1;

        //special cases where there's no tv
        if (jumpType.Name == Constants.TakeOffName || jumpType.Name == Constants.TakeOffWeightName)
        {
            tv = 0.0;
        }


        string sqlSelect = "";

        if (tv > 0)
        {
            if (tc <= 0)
            {
                sqlSelect = "100*4.9*(jump.TV/2)*(jump.TV/2)";
            }
            else
            {
                sqlSelect = "jump.TV";                 //if tc is higher than tv it will be fixed on PrepareJumpSimpleGraph
            }
        }
        else
        {
            sqlSelect = "jump.TC";
        }

        Sqlite.Open();
        dbcmd.CommandText = "SELECT session.date, session.name, MAX(" + sqlSelect + "), jump.simulated " +
                            " FROM jump, session WHERE type = \"" + jumpType.Name + "\" AND personID = " + personID +
                            " AND jump.sessionID = session.uniqueID";

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

        SqliteDataReader reader;

        reader = dbcmd.ExecuteReader();
        reader.Read();

        string [] str = DataReaderToStringArray(reader, 4);

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

        return(str);
    }
Example #16
0
        public JumpInstruction(int offset, JumpType jumpType, Condition condition, ushort destination)
            : base(offset, condition)
        {
            this.jumpType    = jumpType;
            this.destination = destination;

            if (!(JumpsToRom || JumpsToHighRam))
            {
                throw new NotSupportedException("Jumps outside of ROM or HRAM are unsupported yet.");
            }
        }
Example #17
0
    private void Start()
    {
        _run =
            new RunNormal(transform,
                          speed: speed,
                          acc: acceleration);

        _jump =
            new JumpNormal(transform,
                           GetComponent <Rigidbody>(),
                           force: jumpForce,
                           maxJumps: maxJumps);
    }
        void CreateEdge(ControlFlowNode fromNode, Label toLabel, JumpType type)
        {
            Instruction last = methodBody.Last();

            if (toLabel.Address > last.Address)
            {
                CreateEdge(fromNode, regularExit, type);
            }
            else
            {
                CreateEdge(fromNode, nodes.Single(n => n.Start != null && n.Start.Address == toLabel.Address), type);
            }
        }
        private void RunInvalidJumpDestinationProgram(OpCode aOp,
                                                      JumpType aType)
        {
            const Registers r1 = Registers.R1;

            // Calculate the value required value to ensure
            // that the jump condition is or isn't taken.
            var value = aType switch
            {
                JumpType.EQ => 1,
                JumpType.NEQ => 0,
                JumpType.LT => 1,
                JumpType.GT => - 1,
                JumpType.LTE => 2,
                JumpType.GTE => - 2,
                _ => 0
            };

            var program = new List <CompilerIns>();

            object arg;
            var    argTypes = _instructionCache[aOp].ArgumentTypes;

            if (argTypes[0] == typeof(Registers))
            {
                // Set the register to the required value.
                program.Add
                (
                    new CompilerIns(OpCode.MOV_LIT_REG,
                                    new object[] { value, r1 })
                );

                // This will become the jump instruction
                // condition argument below.
                arg = r1;
            }
            else
            {
                // This will become the jump instruction
                // condition argument below.
                arg = value;
            }

            program.Add(new CompilerIns(aOp,
                                        new [] { arg, -2 }));

            Vm.Run(QuickCompile.RawCompile(program.ToArray()));

            Vm.Cpu.FetchExecuteNextInstruction();
        }
    public string UploadJumpType(JumpType type, int evalSID)
    {
        string typeServer = type.Name + "-" + evalSID.ToString();

        Console.WriteLine("JUMP" + typeServer + ":" + type.StartIn + ":" + type.HasWeight + ":" + type.Description);
        if (!Sqlite.Exists(false, Constants.JumpTypeTable, typeServer))
        {
            SqliteJumpType.JumpTypeInsert(
                typeServer + ":" + Util.BoolToInt(type.StartIn).ToString() + ":" +
                Util.BoolToInt(type.HasWeight).ToString() + ":" + type.Description,
                false);
            return(typeServer);
        }
        return("-1");
    }
Example #21
0
 public override void Update(ShipStatus ship)
 {
     ship.FSDJump     = true;
     ship.FsdCharging = false;
     if (JumpType.Equals("Hyperspace", StringComparison.InvariantCultureIgnoreCase))
     {
         ship.FSDJumpType        = FSDJumpType.Hyperspace;
         ship.FSDTarget          = StarSystem;
         ship.FSDTargetStarClass = StarClass;
         ship.InHyperspace       = true;
     }
     else  // supercruise
     {
         ship.FSDJumpType  = FSDJumpType.Supercruise;
         ship.InHyperspace = false;
     }
 }
Example #22
0
        private static void JumpExploit(JumpType type)
        {
            Vector3 myPos = Player.ServerPosition;
            Vector3 castPos;

            if (type == JumpType.ToCursor)
            {
                castPos = myPos - (myPos - Game.CursorPos).Normalized() * E.Range;
            }
            else
            {
                castPos = myPos - (myPos - GetHomePos(Player.Team)).Normalized() * E.Range;
            }

            E.Cast(castPos);
            Utility.DelayAction.Add(600,
                                    () => E.Cast(Game.CursorPos));
        }
Example #23
0
    void Jump(JumpType type)
    {
        Vector2 dir;

        _JumpInputDurationR = 0;
        // CanWallJump() has to return 1 or 2 as this jump can't be triggered when there's no wall that could be grabbed, the rest of the math formats it to -1 or 1
        int wall = ((int)CanWallJump() - 1) * 2 - 1;

        switch (type)
        {
        case JumpType.Ground:
            _Rigidbody.velocity = new Vector2(_Rigidbody.velocity.x, _GroundJumpForce);
            break;

        case JumpType.Wall:
            _WallJumpDurationR = _WallJumpDuration;
            if (_CurrentStamina > 0)
            {
                dir = new Vector2(-wall * _WallJumpSlope.x, _WallJumpSlope.y).normalized;
                _Rigidbody.velocity = dir * _WallJumpForce;
            }
            else
            {
                dir = new Vector2(-wall * _NoStaminaWallJumpSlope.x, _NoStaminaWallJumpSlope.y).normalized;
                _Rigidbody.velocity = dir * _NoStaminaWallJumpForce;
            }
            break;

        case JumpType.Grabbing:
            StopClimbing();
            _WallJumpDurationR = _GrabbingJumpDuration;
            _CurrentStamina   -= _GrabJumpStaminaCost;
            dir = new Vector2(GetDirection().x, 1);
            if (dir.x == wall)
            {
                dir.x = 0;
            }
            dir = dir.normalized;
            _Rigidbody.velocity = dir * _GrabbingJumpForce;
            break;
        }
    }
Example #24
0
        public static string GetString(JumpType jump)
        {
            switch (jump)
            {
            case JumpType.Continue:
                return("continue");

            case JumpType.Break:
                return("break");

            case JumpType.Discard:
                return("discard");

            case JumpType.Return:
                return("return");

            default:
                return(null);
            }
        }
Example #25
0
        public Jump(XmlReader r)
        {
            M.Assert(r.Name == "jump");

            int count = r.AttributeCount;

            for (int i = 0; i < count; i++)
            {
                r.MoveToAttribute(i);
                switch (r.Name)
                {
                case "location":
                {
                    PositionInMeasure = new PositionInMeasure(r.Value);
                    break;
                }

                case "type":
                    switch (r.Value)
                    {
                    case "segno":
                        JumpType = JumpType.segno;
                        break;

                    case "dsalfine":
                        JumpType = JumpType.dsalfine;
                        break;

                    default:
                        JumpType = JumpType.unknown;
                        break;
                    }
                    break;

                default:
                    M.ThrowError("Unknown jump attribute.");
                    break;
                }
            }
            // r.Name is now the name of the last jump attribute that has been read.
        }
Example #26
0
    private PathNode GetNext(PathNode toCheck, PathNode fromNode, DirectionType dir, JumpType jumpType)
    {
        if (!mapPath.CheckWalkable(toCheck) || toCheck.status == NodeStatus.Close)
        {
            return(null);
        }

        DirectionType jumpNodeDir;
        var           tempValue = jumpType == JumpType.Line ? IsLineJumpNode(toCheck, dir, out jumpNodeDir) : IsTitleJumpNode(toCheck, dir, out jumpNodeDir);

        if (tempValue)                             // toCheck是跳点
        {
            if (toCheck.status == NodeStatus.Open) // 已经在openlist里了 判断是否更新G值 更新parent
            {
                var cost  = ComputeG(dir, fromNode, toCheck);
                var gTemp = fromNode.g + cost;
                if (gTemp < toCheck.g)
                {
                    var oldDir = GetDirection(toCheck.parent, toCheck);
                    toCheck.dir    = (toCheck.dir ^ oldDir) | jumpNodeDir; // 去掉旧的父亲方向 保留自身方向 添加新的方向
                    toCheck.parent = fromNode;
                    toCheck.g      = gTemp;
                    toCheck.f      = gTemp + toCheck.h;
                }

                mapPath.OpenHeap.TryUpAdjust(toCheck);
                return(null);
            }
            //加入openlist
            toCheck.parent = fromNode;
            toCheck.g      = fromNode.g + ComputeG(dir, toCheck, fromNode);
            toCheck.h      = PathNode.ComputeH(toCheck, endNode);
            toCheck.f      = toCheck.g + toCheck.h;
            toCheck.status = NodeStatus.Open;
            toCheck.dir    = jumpNodeDir;
            mapPath.OpenHeap.Enqueue(toCheck);
            return(null);
        }
        return(toCheck);
    }
Example #27
0
    public void DoJump(JumpType Type)
    {
        Rigidbody2D body = GetComponent <Rigidbody2D>();

        body.AddForce(new Vector2(jumpX, jumpHeight));

        if (Type == JumpType.Normal)
        {
            jumpHeight = 125;
            jumpX      = 0;
        }
        else if (Type == JumpType.LeftStrafe)
        {
            jumpHeight = 125;
            jumpX      = -125;
        }
        else if (Type == JumpType.RightStrafe)
        {
            jumpHeight = 125;
            jumpX      = 125;
        }
    }
    public static JumpState CreateJumpState(JumpType type)
    {
        JumpState toReturn = null;

        switch (type)
        {
        case JumpType.Null:
            toReturn = new NullJump();
            break;

        case JumpType.Single:
            toReturn = new SingleJump(DEFAULT_TIME_HOLD)
            {
                StartFallSpeed   = DEFAULT_START_FALL_SPEED,
                TerminalVelocity = DEFAULT_TERMINAL_VELOCITY,
                Gravity          = DEFAULT_GRAVITY,
                JumpHeight       = DEFAULT_JUMP_FORCE
            };
            break;

        case JumpType.Double:
            toReturn = new DoubleJump()
            {
                StartFallSpeed   = DEFAULT_START_FALL_SPEED,
                TerminalVelocity = DEFAULT_TERMINAL_VELOCITY,
                Gravity          = DEFAULT_GRAVITY,
                JumpHeight       = DEFAULT_JUMP_FORCE
            };
            break;

        default:
            //Only thrown if a new jump type is added and there is no corresponding case.
            throw new NotImplementedException();
            break;
        }
        return(toReturn);
    }
Example #29
0
    public void CalcPlayerJumpPath(Vector3 p_playerDir)
    {
        Vector3 __targetPos = playerGO.transform.localPosition + p_playerDir;

        positions = new List <MovimentPosition> ();
        if (HasWallInPosition(__targetPos + Vector3.up, 0.3f) ||
            HasStairInPosition(__targetPos + Vector3.up, 0.3f))
        {
            currentJumpType = JumpType.VERTICAL_JUMP;
            positions.Add(new MovimentPosition(playerGO.transform.localPosition, 0f));
            positions.Add(new MovimentPosition(playerGO.transform.localPosition, 1f));
            positions.Add(new MovimentPosition(playerGO.transform.localPosition, 1f));
        }
        else if (HasWallInPosition(__targetPos + p_playerDir + Vector3.up, 0.3f))
        {
            currentJumpType = JumpType.HALF_JUMP;
            positions.Add(new MovimentPosition(playerGO.transform.localPosition, 0f));
            positions.Add(new MovimentPosition(__targetPos + Vector3.up, 1f));
            positions.Add(new MovimentPosition(__targetPos, 1f));
        }
        else if (HasStairInPosition(__targetPos + p_playerDir + (Vector3.up * 0.5f), 0.3f))
        {
            currentJumpType = JumpType.LAND_ON_STAIR;
            positions.Add(new MovimentPosition(playerGO.transform.localPosition, 0f));
            positions.Add(new MovimentPosition(__targetPos + Vector3.up, 1f));
            positions.Add(new MovimentPosition(__targetPos + p_playerDir + (Vector3.up * 0.5f), 1f));
            nextTile = NextTile.STAIR_UP;
        }
        else
        {
            currentJumpType = JumpType.FULL_JUMP;
            positions.Add(new MovimentPosition(playerGO.transform.localPosition, 0f));
            positions.Add(new MovimentPosition(__targetPos + Vector3.up, 1f));
            positions.Add(new MovimentPosition(__targetPos + p_playerDir, 1f));
        }
        Debug.Log(currentJumpType);
    }
Example #30
0
    public static JumpBehavior CreateJumpBehavior(JumpType type, MonoBehaviour root)
    {
        JumpBehavior toReturn = null;

        switch (type)
        {
        case JumpType.Null:
            toReturn = new NullJump();
            break;

        case JumpType.Single:
            toReturn = new SingleJump(root.GetComponent <CharacterController>())
            {
                StartFallSpeed   = DEFAULT_START_FALL_SPEED,
                TerminalVelocity = DEFAULT_TERMINAL_VELOCITY,
                Gravity          = DEFAULT_GRAVITY,
                JumpForce        = DEFAULT_JUMP_FORCE
            };
            break;

        case JumpType.Double:
            toReturn = new DoubleJump(root.GetComponent <CharacterController>())
            {
                StartFallSpeed   = DEFAULT_START_FALL_SPEED,
                TerminalVelocity = DEFAULT_TERMINAL_VELOCITY,
                Gravity          = DEFAULT_GRAVITY,
                JumpForce        = DEFAULT_JUMP_FORCE
            };
            break;

        default:
            //Only thrown if a new jump type is added and there is no corresponding case.
            throw new NotImplementedException();
            break;
        }
        return(null);
    }
Example #31
0
    public static JumpType SelectAndReturnJumpType(string typeName, bool dbconOpened)
    {
        if (!dbconOpened)
        {
            Sqlite.Open();
        }
        dbcmd.CommandText = "SELECT * " +
                            " FROM " + Constants.JumpTypeTable + " " +
                            " WHERE name  = \"" + typeName +
                            "\" ORDER BY uniqueID";

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

        reader = dbcmd.ExecuteReader();

        JumpType myJumpType = new JumpType();

        while (reader.Read())
        {
            myJumpType.Name        = reader[1].ToString();
            myJumpType.StartIn     = Util.IntToBool(Convert.ToInt32(reader[2].ToString()));
            myJumpType.HasWeight   = Util.IntToBool(Convert.ToInt32(reader[3].ToString()));
            myJumpType.Description = reader[4].ToString();
        }

        myJumpType.IsPredefined = myJumpType.FindIfIsPredefined();

        reader.Close();
        if (!dbconOpened)
        {
            Sqlite.Close();
        }

        return(myJumpType);
    }
Example #32
0
    void on_button_execute_test_clicked(object o, EventArgs args)
    {
        if(radio_mode_jumps_small.Active) {
            extra_window_jumps_weight = (double) extra_window_jumps_spinbutton_weight.Value;
            extra_window_jumps_fall = (double) extra_window_jumps_spinbutton_fall.Value;
            extra_window_jumps_arms = extra_window_jumps_check_dj_arms.Active;

            //need to check DJ because is what happens when press DJ button
            //need to check other because maybe we changed some option since last jump
            //and currentJumpType.Name is the name of last jump type, eg: DJa
            if(currentJumpType.Name == "DJ" ||
                    currentJumpType.Name == "DJa" || currentJumpType.Name == "DJna") {
                if(extra_window_jumps_arms)
                    currentJumpType = new JumpType("DJa");
                else
                    currentJumpType = new JumpType("DJna");
            }

            on_normal_jump_activate(o, args);
        }
        else if(radio_mode_jumps_reactive_small.Active) {
            extra_window_jumps_rj_limited = (double) extra_window_jumps_rj_spinbutton_limit.Value;
            extra_window_jumps_rj_weight = (double) extra_window_jumps_rj_spinbutton_weight.Value;
            extra_window_jumps_rj_fall = (double) extra_window_jumps_rj_spinbutton_fall.Value;

            on_rj_activate(o, args);
        }
        else if(radio_mode_runs_small.Active) {
            extra_window_runs_distance = (double) extra_window_runs_spinbutton_distance.Value;

            on_normal_run_activate(o, args);
        }
        else if(radio_mode_runs_intervallic_small.Active) {
            extra_window_runs_interval_distance = (double) extra_window_runs_interval_spinbutton_distance.Value;
            extra_window_runs_interval_limit = extra_window_runs_interval_spinbutton_limit.Value;

            on_run_interval_activate(o, args);
        }
        else if(radio_mode_reaction_times_small.Active) {
            on_reaction_time_activate (o, args);
        }
        else if(radio_mode_pulses_small.Active) {
            on_pulse_activate (o, args);
        }
        else if(radio_mode_multi_chronopic_small.Active) {
            on_multi_chronopic_start_clicked(o, args);
        }

        //if a test has been deleted
        //notebook_results_data changes to page 8: "deleted test"
        //when a new test is done
        //this notebook has to poing again to data of it's test
        //then just show same page as notebook_execute
        notebook_results_data.CurrentPage = notebook_execute.CurrentPage;
    }
Example #33
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;
    }
Example #34
0
    private void on_extra_window_jumps_check_dj_arms_clicked(object o, EventArgs args)
    {
        JumpType j = new JumpType();
        if(extra_window_jumps_check_dj_arms.Active)
            j = new JumpType("DJa");
        else
            j = new JumpType("DJna");

        changeTestImage(EventType.Types.JUMP.ToString(), j.Name, j.ImageFileName);
    }
Example #35
0
    private JumpType previousJumpType; //used on More to turnback if cancel or delete event is pressed

    #endregion Fields

    #region Methods

    //creates and if is not predefined, checks database to gather all the data
    //simple == true  for normal jumps, and false for reactive
    private JumpType createJumpType(string name, bool simple)
    {
        JumpType t = new JumpType(name);

        if(! t.IsPredefined) {
            if(simple) {
                t = SqliteJumpType.SelectAndReturnJumpType(name, false);
                t.ImageFileName = SqliteEvent.GraphLinkSelectFileName(Constants.JumpTable, name);
            } else {
                t = SqliteJumpType.SelectAndReturnJumpRjType(name, false);
                t.ImageFileName = SqliteEvent.GraphLinkSelectFileName(Constants.JumpRjTable, name);
            }
        }
        return t;
    }
Example #36
0
 public string UploadJumpType(JumpType type, int evalSID)
 {
     object[] results = this.Invoke("UploadJumpType", new object[] {
                 type,
                 evalSID});
     return ((string)(results[0]));
 }
		public ResolvedJumpInstruction(int offset, JumpType jumpType, Condition condition, ushort destination, Label resolvedDestination)
			: base(offset, jumpType, condition, destination)
		{
			this.resolvedDestination = resolvedDestination;
		}
Example #38
0
    private void extra_window_showFallData(JumpType myJumpType, bool show)
    {
        if(myJumpType.IsRepetitive) {
            extra_window_jumps_rj_label_fall.Visible = show;
            extra_window_jumps_rj_spinbutton_fall.Visible = show;
            extra_window_jumps_rj_label_cm.Visible = show;

            //only on simple jumps
            extra_window_jumps_hbox_fall.Visible = false;
        } else
            extra_window_jumps_hbox_fall.Visible = show;
    }
    public string UploadJumpType(JumpType type, int evalSID)
    {
        string typeServer = type.Name + "-" + evalSID.ToString();

        Console.WriteLine("JUMP" + typeServer + ":" + type.StartIn + ":" + type.HasWeight + ":" + type.Description);
        if(! Sqlite.Exists(Constants.JumpTypeTable, typeServer)) {
            SqliteJumpType.JumpTypeInsert(
                    typeServer + ":" + Util.BoolToInt(type.StartIn).ToString() + ":" +
                    Util.BoolToInt(type.HasWeight).ToString() + ":" + type.Description,
                    false);
            return typeServer;
        }
        return "-1";
    }
Example #40
0
    private void on_extra_window_jumps_rj_more(object o, EventArgs args)
    {
        previousJumpRjType = currentJumpRjType;

        jumpsRjMoreWin = JumpsRjMoreWindow.Show(app1, true);
        jumpsRjMoreWin.Button_accept.Clicked += new EventHandler(on_more_jumps_rj_accepted);
        jumpsRjMoreWin.Button_cancel.Clicked += new EventHandler(on_more_jumps_rj_cancelled);
        jumpsRjMoreWin.Button_selected.Clicked += new EventHandler(on_more_jumps_rj_update_test);
    }
Example #41
0
    private void on_combo_eventType_changed(object o, EventArgs args)
    {
        //if the distance of the new runType is fixed, put this distance
        //if not conserve the old
        JumpType myJumpType = new JumpType (UtilGtk.ComboGetActive(combo_eventType));

        if(myJumpType.Name == Constants.TakeOffName || myJumpType.Name == Constants.TakeOffWeightName) {
            entry_tv_value.Text = "0";
            entry_tv_value.Sensitive = false;
        } else
            entry_tv_value.Sensitive = true;

        if(myJumpType.HasWeight) {
            if(weightOldStore != "0")
                entry_weight_value.Text = weightOldStore;

            entry_weight_value.Sensitive = true;
        } else {
            //store weight in a variable if needed
            if(entry_weight_value.Text != "0")
                weightOldStore = entry_weight_value.Text;

            entry_weight_value.Text = "0";
            entry_weight_value.Sensitive = false;
        }

        frame_jumps_single_leg.Visible = (myJumpType.Name == "slCMJleft" || myJumpType.Name == "slCMJright");
        entry_description.Sensitive = (myJumpType.Name != "slCMJleft" && myJumpType.Name != "slCMJright");
        if(myJumpType.Name == "slCMJleft" || myJumpType.Name == "slCMJright") {
            fillSingleLeg(entry_description.Text);
        }
    }
Example #42
0
    protected override void fillTreeView(Gtk.TreeView tv, TreeStore store)
    {
        //select data without inserting an "all jumps", without filter, and not obtain only name of jump
        string [] myJumpTypes = SqliteJumpType.SelectJumpTypes(false, "", "", false);

        //remove typesTranslated
        typesTranslated = new String [myJumpTypes.Length];
        int count = 0;

        foreach (string myType in myJumpTypes) {
            string [] myStringFull = myType.Split(new char[] {':'});
            if(myStringFull[2] == "1") {
                myStringFull[2] = Catalog.GetString("Yes");
            } else {
                myStringFull[2] = Catalog.GetString("No");
            }
            if(myStringFull[3] == "1") {
                myStringFull[3] = Catalog.GetString("Yes");
            } else {
                myStringFull[3] = Catalog.GetString("No");
            }

            JumpType tempType = new JumpType (myStringFull[1]);
            string description  = getDescriptionLocalised(tempType, myStringFull[4]);

            //if we are going to execute: show all types
            //if we are going to delete: show user defined types
            if(testOrDelete || ! tempType.IsPredefined)
                store.AppendValues (
                        //myStringFull[0], //don't display de uniqueID
                        Catalog.GetString(myStringFull[1]),	//name (translated)
                        myStringFull[2], 	//startIn
                        myStringFull[3], 	//weight
                        description
                        );

            //create typesTranslated
            typesTranslated [count++] = myStringFull[1] + ":" + Catalog.GetString(myStringFull[1]);
        }
    }
Example #43
0
 private void extra_window_showWeightData(JumpType myJumpType, bool show)
 {
     if(myJumpType.IsRepetitive) {
         extra_window_jumps_rj_label_weight.Visible = show;
         extra_window_jumps_rj_spinbutton_weight.Visible = show;
         extra_window_jumps_rj_radiobutton_kg.Visible = show;
         extra_window_jumps_rj_radiobutton_weight.Visible = show;
     } else {
         extra_window_jumps_label_weight.Visible = show;
         extra_window_jumps_spinbutton_weight.Visible = show;
         extra_window_jumps_radiobutton_kg.Visible = show;
         extra_window_jumps_radiobutton_weight.Visible = show;
     }
 }
Example #44
0
 public void UploadJumpTypeAsync(JumpType type, int evalSID, object userState)
 {
     if ((this.UploadJumpTypeOperationCompleted == null)) {
         this.UploadJumpTypeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUploadJumpTypeCompleted);
     }
     this.InvokeAsync("UploadJumpType", new object[] {
                 type,
                 evalSID}, this.UploadJumpTypeOperationCompleted, userState);
 }
Example #45
0
    RepairJumpRjWindow(Gtk.Window parent, JumpRj myJump, int pDN)
    {
        Glade.XML gladeXML;
        gladeXML = Glade.XML.FromAssembly (Util.GetGladePath() + "repair_sub_event.glade", "repair_sub_event", null);
        gladeXML.Autoconnect(this);

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

        repair_sub_event.Parent = parent;
        this.jumpRj = myJump;

        //this.pDN = pDN;

        repair_sub_event.Title = Catalog.GetString("Repair reactive jump");

        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);

        jumpType = SqliteJumpType.SelectAndReturnJumpRjType(myJump.Type, false);

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

        createTreeView(treeview_subevents);
        //count, tc, tv
        store = new TreeStore(typeof (string), typeof (string), typeof(string));
        treeview_subevents.Model = store;
        fillTreeView (treeview_subevents, store, myJump, 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;
    }
Example #46
0
    public static JumpType SelectAndReturnJumpType(string typeName, bool dbconOpened)
    {
        if(!dbconOpened)
            Sqlite.Open();
        dbcmd.CommandText = "SELECT * " +
            " FROM " + Constants.JumpTypeTable + " " +
            " WHERE name  = \"" + typeName +
            "\" ORDER BY uniqueID";

        LogB.SQL(dbcmd.CommandText.ToString());
        dbcmd.ExecuteNonQuery();
        SqliteDataReader reader;
        reader = dbcmd.ExecuteReader();

        JumpType myJumpType = new JumpType();

        while(reader.Read()) {
            myJumpType.Name = reader[1].ToString();
            myJumpType.StartIn = Util.IntToBool(Convert.ToInt32(reader[2].ToString()));
            myJumpType.HasWeight = Util.IntToBool(Convert.ToInt32(reader[3].ToString()));
            myJumpType.Description = reader[4].ToString();
        }

        myJumpType.IsPredefined = myJumpType.FindIfIsPredefined();

        reader.Close();
        if(!dbconOpened)
            Sqlite.Close();

        return myJumpType;
    }
		public ResolvedJumpInstruction(int offset, JumpType jumpType, ushort destination, Label resolvedDestination)
			: this(offset, jumpType, Condition.Always, destination, resolvedDestination)
		{
		}
Example #48
0
    private void extra_window_jumps_rj_initialize(JumpType myJumpType)
    {
        currentEventType = myJumpType;
        changeTestImage(EventType.Types.JUMP.ToString(), myJumpType.Name, myJumpType.ImageFileName);
        checkbutton_allow_finish_rj_after_time.Visible = false;

        if(myJumpType.FixedValue >= 0) {
            string jumpsName = Catalog.GetString("jumps");
            string secondsName = Catalog.GetString("seconds");
            if(myJumpType.JumpsLimited) {
                extra_window_jumps_rj_jumpsLimited = true;
                extra_window_jumps_rj_label_limit_units.Text = jumpsName;
            } else {
                extra_window_jumps_rj_jumpsLimited = false;
                extra_window_jumps_rj_label_limit_units.Text = secondsName;
                checkbutton_allow_finish_rj_after_time.Visible = true;
            }
            if(myJumpType.FixedValue > 0) {
                extra_window_jumps_rj_spinbutton_limit.Sensitive = false;
                extra_window_jumps_rj_spinbutton_limit.Value = myJumpType.FixedValue;
            } else {
                extra_window_jumps_rj_spinbutton_limit.Sensitive = true;
                extra_window_jumps_rj_spinbutton_limit.Value = extra_window_jumps_rj_limited;
            }
            extra_window_showLimitData (true);
        } else  //unlimited
            extra_window_showLimitData (false);

        if(myJumpType.HasWeight) {
            extra_window_showWeightData(myJumpType, true);
        } else
            extra_window_showWeightData(myJumpType, false);

        if(myJumpType.HasFall || myJumpType.Name == Constants.RunAnalysisName) {
            extra_window_showFallData(myJumpType, true);
        } else
            extra_window_showFallData(myJumpType, false);

        extra_window_jumps_rj_spinbutton_weight.Value = extra_window_jumps_rj_weight;
        extra_window_jumps_rj_spinbutton_fall.Value = extra_window_jumps_rj_fall;
        if (extra_window_jumps_rj_option == "Kg") {
            extra_window_jumps_rj_radiobutton_kg.Active = true;
        } else {
            extra_window_jumps_rj_radiobutton_weight.Active = true;
        }
    }
Example #49
0
 public System.IAsyncResult BeginUploadJumpType(JumpType type, int evalSID, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("UploadJumpType", new object[] {
                 type,
                 evalSID}, callback, asyncState);
 }
Example #50
0
    private void extra_window_jumps_initialize(JumpType myJumpType)
    {
        currentEventType = myJumpType;
        changeTestImage(EventType.Types.JUMP.ToString(), myJumpType.Name, myJumpType.ImageFileName);

        if(myJumpType.HasWeight) {
            extra_window_showWeightData(myJumpType, true);
        } else
            extra_window_showWeightData(myJumpType, false);

        if(myJumpType.HasFall) {
            extra_window_showFallData(myJumpType, true);
        } else
            extra_window_showFallData(myJumpType, false);

        if(myJumpType.Name == "DJa" || myJumpType.Name == "DJna") {
            //on DJa and DJna (coming from More jumps) need to show technique data but not change
            if(myJumpType.Name == "DJa")
                extra_window_jumps_check_dj_arms.Active = true;
            else //myJumpType.Name == "DJna"
                extra_window_jumps_check_dj_arms.Active = false;

            extra_window_showTechniqueArmsData(true, false); //visible, sensitive

            if(extra_window_jumps_check_dj_fall_calculate.Active) {
                if(extra_window_jumps_check_dj_arms.Active)
                    changeTestImage("","", "jump_dj_a_inside.png");
                else
                    changeTestImage("","", "jump_dj_inside.png");
            }
        } else if(myJumpType.Name == "DJ") {
            //user has pressed DJ button
            extra_window_jumps_check_dj_arms.Active = extra_window_jumps_arms;

            on_extra_window_jumps_check_dj_arms_clicked(new object(), new EventArgs());
            extra_window_showTechniqueArmsData(true, true); //visible, sensitive
        } else
            extra_window_showTechniqueArmsData(false, false); //visible, sensitive

        extra_window_jumps_spinbutton_weight.Value = 100;
        extra_window_jumps_spinbutton_fall.Value = extra_window_jumps_fall;
        if (extra_window_jumps_option == "Kg") {
            extra_window_jumps_radiobutton_kg.Active = true;
        } else {
            extra_window_jumps_radiobutton_weight.Active = true;
        }

        extra_window_showSingleLegStuff(myJumpType.Name == "slCMJleft" || myJumpType.Name == "slCMJright");
        if(myJumpType.Name == "slCMJleft" || myJumpType.Name == "slCMJright") {
            extra_window_jumps_spin_single_leg_distance.Value = 0;
            extra_window_jumps_spin_single_leg_angle.Value = 90;
        }

        updateGraphJumpsSimple();
    }
Example #51
0
 public void UploadJumpTypeAsync(JumpType type, int evalSID)
 {
     this.UploadJumpTypeAsync(type, evalSID, null);
 }
Example #52
0
 private void on_more_jumps_update_test(object o, EventArgs args)
 {
     currentEventType = new JumpType(jumpsMoreWin.SelectedEventName);
     comboSelectJumps.MakeActive(jumpsMoreWin.SelectedEventName);
 }
Example #53
0
    public static JumpType SelectAndReturnJumpRjType(string typeName, bool dbconOpened)
    {
        if(!dbconOpened)
            Sqlite.Open();
        dbcmd.CommandText = "SELECT * " +
            " FROM " + Constants.JumpRjTypeTable + " " +
            " WHERE name  = \"" + typeName +
            "\" ORDER BY uniqueID";

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

        SqliteDataReader reader;
        reader = dbcmd.ExecuteReader();

        JumpType myJumpType = new JumpType();

        while(reader.Read()) {
            myJumpType.Name = reader[1].ToString();

            if(reader[2].ToString() == "1") { myJumpType.StartIn = true; }
            else { myJumpType.StartIn = false; }

            if(reader[3].ToString() == "1") { myJumpType.HasWeight = true; }
            else { myJumpType.HasWeight = false; }

            myJumpType.IsRepetitive = true;

            if(reader[4].ToString() == "1") { myJumpType.JumpsLimited = true; }
            else { myJumpType.JumpsLimited = false; }

            myJumpType.FixedValue = Convert.ToInt32( reader[5].ToString() );
        }

        myJumpType.IsPredefined = myJumpType.FindIfIsPredefined();

        reader.Close();
        if(!dbconOpened)
            Sqlite.Close();

        return myJumpType;
    }
Example #54
0
		public ControlFlowEdge(ControlFlowNode source, ControlFlowNode target, JumpType type)
		{
			this.Source = source;
			this.Target = target;
			this.Type = type;
		}
Example #55
0
		void CreateEdge(ControlFlowNode fromNode, Instruction toInstruction, JumpType type)
		{
			CreateEdge(fromNode, nodes.Single(n => n.Start == toInstruction), type);
		}
Example #56
0
    private string createTextForTextView(JumpType myJumpType)
    {
        string jumpTypeString = string.Format(Catalog.GetString(
                    "JumpType: {0}."), myJumpType.Name);

        //if it's a jump type that starts in, then don't allow first TC be different than -1
        string startString = "";
        if(myJumpType.StartIn) {
            startString = string.Format(Catalog.GetString("\nThis jump type starts inside, the first time should be a flight time."));
        }

        string fixedString = "";
        if(myJumpType.FixedValue > 0) {
            if(myJumpType.JumpsLimited) {
                //if it's a jump type jumpsLimited with a fixed value, then don't allow the creation of more jumps, and respect the -1 at last TF if found
                fixedString = "\n" + string.Format(
                        Catalog.GetPluralString(
                            "This jump type is fixed to one jump.",
                            "This jump type is fixed to {0} jumps.",
                            Convert.ToInt32(myJumpType.FixedValue)),
                        myJumpType.FixedValue) +
                    Catalog.GetString("You cannot add more.");
            } else {
                //if it's a jump type timeLimited with a fixed value, then complain when the total time is higher
                fixedString = "\n" + string.Format(
                        Catalog.GetPluralString(
                            "This jump type is fixed to one second.",
                            "This jump type is fixed to {0} seconds.",
                            Convert.ToInt32(myJumpType.FixedValue)),
                        myJumpType.FixedValue) +
                    Catalog.GetString("You cannot add more.");
            }
        }
        return jumpTypeString + startString + fixedString;
    }
Example #57
0
    public bool ChooseStat()
    {
        if ( statisticType == Constants.TypeSessionSummary ) {
            int jumperID = -1; //all jumpers
            string jumperName = ""; //all jumpers
            if(graph) {
                myStat = new GraphGlobal(myStatTypeStruct, jumperID, jumperName);
            } else {
                myStat = new StatGlobal(myStatTypeStruct, treeview_stats, jumperID, jumperName);
            }
        }
        else if (statisticType == Constants.TypeJumperSummary)
        {
            if(statisticApplyTo.Length == 0) {
                LogB.Information("Jumper-ret");
                return false;
            }
            int jumperID = Util.FetchID(statisticApplyTo);
            if(jumperID == -1) {
                return false;
            }

            string jumperName = Util.FetchName(statisticApplyTo);
            if(graph) {
                myStat = new GraphGlobal(myStatTypeStruct, jumperID, jumperName);
            }
            else {
                myStat = new StatGlobal(myStatTypeStruct, treeview_stats,
                        jumperID, jumperName);
            }
        }
        else if(statisticType == Constants.TypeJumpsSimple)
        {
            if(statisticApplyTo.Length == 0) {
                LogB.Information("Simple-ret");
                return false;
            }

            if(statisticSubType != Catalog.GetString("No indexes"))
            {
                string indexType = "";
                if(statisticSubType == Catalog.GetString(Constants.SubtractionBetweenTests))
                    indexType = "subtraction";
                else if(statisticSubType == Constants.ChronojumpProfile)
                    indexType = "ChronojumpProfile";
                else if(statisticSubType == Constants.IeIndexFormula)
                    indexType = "IE";
                else if(statisticSubType == Constants.ArmsUseIndexFormula)
                    indexType = "Arms Use Index";
                else if(statisticSubType == Constants.IRnaIndexFormula)
                    indexType = "IRna";
                else if(statisticSubType == Constants.IRaIndexFormula)
                    indexType = "IRa";
                else if(statisticSubType == Constants.FvIndexFormula)
                    indexType = "F/V";
                else if(
                        statisticSubType == Constants.PotencyLewisFormulaShort ||
                        statisticSubType == Constants.PotencyHarmanFormulaShort ||
                        statisticSubType == Constants.PotencySayersSJFormulaShort ||
                        statisticSubType == Constants.PotencySayersCMJFormulaShort ||
                        statisticSubType == Constants.PotencyShettyFormulaShort ||
                        statisticSubType == Constants.PotencyCanavanFormulaShort ||
                        //statisticSubType == Constants.PotencyBahamondeFormula ||
                        statisticSubType == Constants.PotencyLaraMaleApplicantsSCFormulaShort ||
                        statisticSubType == Constants.PotencyLaraFemaleEliteVoleiFormulaShort ||
                        statisticSubType == Constants.PotencyLaraFemaleMediumVoleiFormulaShort ||
                        statisticSubType == Constants.PotencyLaraFemaleSCStudentsFormulaShort ||
                        statisticSubType == Constants.PotencyLaraFemaleSedentaryFormulaShort
                        ) {
                    indexType = statisticSubType;
                }

                if(indexType == "subtraction") {
                    if(graph)
                        myStat = new GraphJumpSimpleSubtraction(myStatTypeStruct);
                    else
                        myStat = new StatJumpSimpleSubtraction(myStatTypeStruct, treeview_stats);
                } else if(indexType == "ChronojumpProfile") {
                    if(graph)
                        //myStat = new GraphChronojumpProfile(myStatTypeStruct);
                        LogB.Warning("TODO");
                    else
                        myStat = new StatChronojumpProfile(myStatTypeStruct, treeview_stats);
                } else if(indexType == "IE" || indexType == Constants.ArmsUseIndexName ||
                        indexType == "IRna" || indexType == "IRa") {
                    if(graph)
                        myStat = new GraphJumpIndexes (myStatTypeStruct, indexType);
                    else
                        myStat = new StatJumpIndexes(myStatTypeStruct, treeview_stats, indexType);
                } else if(indexType == "F/V") {
                    if(graph)
                        myStat = new GraphFv (myStatTypeStruct, indexType);
                    else
                        myStat = new StatFv(myStatTypeStruct, treeview_stats, indexType);
                } else {
                    //indexType = (Potency sayers or lewis);
                    if(graph)
                        myStat = new GraphPotency(myStatTypeStruct, indexType);
                    else
                        myStat = new StatPotency(myStatTypeStruct, treeview_stats, indexType);
                }
            }
            else {
                JumpType myType = new JumpType(statisticApplyTo);

                //manage all weight jumps and the AllJumpsName (simple)
                if(myType.HasWeight ||
                        statisticApplyTo == Constants.AllJumpsName)
                {
                    if(graph)
                        myStat = new GraphSjCmjAbkPlus (myStatTypeStruct);
                    else
                        myStat = new StatSjCmjAbkPlus (myStatTypeStruct, treeview_stats);
                } else {
                    if(graph)
                        myStat = new GraphSjCmjAbk (myStatTypeStruct);
                    else
                        myStat = new StatSjCmjAbk (myStatTypeStruct, treeview_stats);
                }
            }
        }
        else if(statisticType == Constants.TypeJumpsSimpleWithTC)
        {
            if(statisticApplyTo.Length == 0) {
                LogB.Information("WithTC-ret");
                return false;
            }

            if(statisticSubType == Constants.DjIndexFormula)
            {
                if(graph)
                    myStat = new GraphDjIndex (myStatTypeStruct);
                            //heightPreferred is not used, check this
                else
                    myStat = new StatDjIndex(myStatTypeStruct, treeview_stats);
                            //heightPreferred is not used, check this

            } else if(statisticSubType == Constants.QIndexFormula)
            {
                if(graph)
                    myStat = new GraphDjQ (myStatTypeStruct);
                            //heightPreferred is not used, check this
                else
                    myStat = new StatDjQ(myStatTypeStruct, treeview_stats);
                            //heightPreferred is not used, check this

            } else if(statisticSubType == Constants.DjPowerFormula)
            {
                if(graph)
                    myStat = new GraphDjPower (myStatTypeStruct);
                            //heightPreferred is not used, check this
                else
                    myStat = new StatDjPower(myStatTypeStruct, treeview_stats);
                            //heightPreferred is not used, check this
            }
        }
        else if(statisticType == Constants.TypeJumpsReactive) {
            if(statisticSubType == Catalog.GetString("Average Index"))
            {
                if(graph)
                    myStat = new GraphRjIndex (myStatTypeStruct);
                else
                    myStat = new StatRjIndex(myStatTypeStruct, treeview_stats);
            }
            else if(statisticSubType == Constants.RJPotencyBoscoFormula)
            {
                if(graph)
                    myStat = new GraphRjPotencyBosco (myStatTypeStruct);
                else
                    myStat = new StatRjPotencyBosco(myStatTypeStruct, treeview_stats);
            }
            else if(statisticSubType == Catalog.GetString("Evolution"))
            {
                if(graph)
                    myStat = new GraphRjEvolution (myStatTypeStruct, evolution_mark_consecutives);
                else
                    myStat = new StatRjEvolution(myStatTypeStruct, evolution_mark_consecutives, treeview_stats);
            }
            else if(statisticSubType == Constants.RJAVGSDRjIndexName)
            {
                if(graph)
                    myStat = new GraphRjAVGSD(myStatTypeStruct, Constants.RjIndexName);
                else
                    myStat = new StatRjAVGSD(myStatTypeStruct, treeview_stats, Constants.RjIndexName);
            }
            else if(statisticSubType == Constants.RJAVGSDQIndexName)
            {
                if(graph)
                    myStat = new GraphRjAVGSD(myStatTypeStruct, Constants.QIndexName);
                else
                    myStat = new StatRjAVGSD(myStatTypeStruct, treeview_stats, Constants.QIndexName);
            }
        }
        else if(statisticType == Constants.TypeRunsSimple)
        {
            if(statisticApplyTo.Length == 0) {
                LogB.Information("Simple-ret");
                return false;
            }

            if(graph)
                myStat = new GraphRunSimple (myStatTypeStruct);
            else
                myStat = new StatRunSimple (myStatTypeStruct, treeview_stats);
        }
        else if(statisticType == Constants.TypeRunsIntervallic)
        {
            if(statisticApplyTo.Length == 0) {
                LogB.Information("Simple-ret");
                return false;
            }

            if(graph)
                myStat = new GraphRunIntervallic (myStatTypeStruct, evolution_mark_consecutives);
            else
                myStat = new StatRunIntervallic (myStatTypeStruct,
                        evolution_mark_consecutives, treeview_stats);
        }

        myStat.FakeButtonRowCheckedUnchecked.Clicked +=
            new EventHandler(on_fake_button_row_checked_clicked);
        myStat.FakeButtonRowsSelected.Clicked +=
            new EventHandler(on_fake_button_rows_selected_clicked);
        myStat.FakeButtonNoRowsSelected.Clicked +=
            new EventHandler(on_fake_button_no_rows_selected_clicked);

        myStat.PrepareData();

        if(toReport) {
            if(graph) {
                bool notEmpty = myStat.CreateGraphR(fileName, false, statCount); //dont' show
                if(notEmpty) { linkImage(fileName); }
            } else {
                writer.WriteLine(myStat.ReportString());
            }
        } else {
            if(graph) {
                //myStat.CreateGraph();
                myStat.CreateGraphR(Constants.FileNameRGraph, true, -1); //show
            }
        }

        //if we just made a graph, store is not made,
        //and we cannot change the Male/female visualizations in the combo
        //with this we can assign a store to the graph (we assign the store of the last stat (not graph)
        if(! toReport) {
            if(! graph)
                lastStore = myStat.Store;
            else {
                myStat.Store = lastStore;
                myStat.MarkedRows = markedRows;
            }
        }

        return true;
    }
Example #58
0
    public static string[] SelectTestMaxStuff(int personID, JumpType jumpType)
    {
        double tc = 0.0;
        if(! jumpType.StartIn)
            tc = 1; //just a mark meaning that tc has to be shown

        double tv = 1;
        //special cases where there's no tv
        if(jumpType.Name == Constants.TakeOffName || jumpType.Name == Constants.TakeOffWeightName)
            tv = 0.0;

        string sqlSelect = "";
        if(tv > 0) {
            if(tc <= 0)
                sqlSelect = "100*4.9*(jump.TV/2)*(jump.TV/2)";
            else
                sqlSelect = "jump.TV"; //if tc is higher than tv it will be fixed on PrepareJumpSimpleGraph
        } else
            sqlSelect = "jump.TC";

        Sqlite.Open();
        dbcmd.CommandText = "SELECT session.date, session.name, MAX(" + sqlSelect + "), jump.simulated " +
            " FROM jump, session WHERE type = \"" + jumpType.Name + "\" AND personID = " + personID +
            " AND jump.sessionID = session.uniqueID";

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

        SqliteDataReader reader;
        reader = dbcmd.ExecuteReader();
        reader.Read();

        string [] str = DataReaderToStringArray(reader, 4);

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

        return str;
    }
Example #59
0
		void CreateEdge(ControlFlowNode fromNode, ControlFlowNode toNode, JumpType type)
		{
			ControlFlowEdge edge = new ControlFlowEdge(fromNode, toNode, type);
			fromNode.Outgoing.Add(edge);
			toNode.Incoming.Add(edge);
		}
Example #60
0
    protected override void fillTreeView(Gtk.TreeView tv, TreeStore store)
    {
        //select data without inserting an "all jumps", and not obtain only name of jump
        string [] myJumpTypes = SqliteJumpType.SelectJumpRjTypes("", false);

        //remove typesTranslated
        typesTranslated = new String [myJumpTypes.Length];
        int count = 0;

        foreach (string myType in myJumpTypes) {
            string [] myStringFull = myType.Split(new char[] {':'});
            if(myStringFull[2] == "1") {
                myStringFull[2] = Catalog.GetString("Yes");
            } else {
                myStringFull[2] = Catalog.GetString("No");
            }
            if(myStringFull[3] == "1") {
                myStringFull[3] = Catalog.GetString("Yes");
            } else {
                myStringFull[3] = Catalog.GetString("No");
            }
            //limited
            string myLimiter = "";
            string myLimiterValue = "";

            //check if it's unlimited
            if(myStringFull[5] == "-1") { //unlimited mark
                myLimiter= Catalog.GetString("Unlimited");
                myLimiterValue = "-";
            } else {
                myLimiter = Catalog.GetString("Jumps");
                if(myStringFull[4] == "0") {
                    myLimiter = Catalog.GetString("Seconds");
                }
                myLimiterValue = "?";
                if(Convert.ToDouble(myStringFull[5]) > 0) {
                    myLimiterValue = myStringFull[5];
                }
            }

            JumpType tempType = new JumpType (myStringFull[1]);
            string description  = getDescriptionLocalised(tempType, myStringFull[6]);

            //if we are going to execute: show all types
            //if we are going to delete: show user defined types
            if(testOrDelete || ! tempType.IsPredefined)
                store.AppendValues (
                        //myStringFull[0], //don't display de uniqueID
                        Catalog.GetString(myStringFull[1]),	//name (translated)
                        myLimiter,		//jumps or seconds
                        myLimiterValue,		//? or exact value
                        myStringFull[2], 	//startIn
                        myStringFull[3], 	//weight
                        description
                        );

            //create typesTranslated
            typesTranslated [count++] = myStringFull[1] + ":" + Catalog.GetString(myStringFull[1]);
        }
    }