public FetchStatement(CursorPositionToken cursorPosition, CursorName cursorName, Sequence<VariableName> destinationVariables) {
			Debug.Assert(cursorPosition != null);
			Debug.Assert(cursorName != null);
			this.cursorPosition = cursorPosition;
			this.cursorName = cursorName;
			this.destinationVariables = destinationVariables.ToList();
		}
示例#2
0
        public void testAddMethod() {
            var sequence = new Sequence();
            sequence.Add("a", 10d);

            Assert.AreEqual("a", sequence.Outcomes[0]);
            Assert.AreEqual(10d, sequence.Probabilities[0]);
        }
        public void ComNegotiateRequest(Sequence<string> dialects)
        {
            Packet_Header responseHeader = new Packet_Header();
            DialectRevision selectedDialect = DialectRevision.Smb2Unknown;
            NEGOTIATE_Response responsePayload = new NEGOTIATE_Response();
            byte[] smb2ClientGssToken;
            ModelSmb2Status status = ModelSmb2Status.STATUS_SUCCESS;

            try
            {
                status = (ModelSmb2Status)smb2Client.MultiProtocolNegotiate(dialects.ToArray(), out selectedDialect, out smb2ClientGssToken, out responseHeader, out responsePayload);
                if (status != ModelSmb2Status.STATUS_SUCCESS)
                {
                    selectedDialect = DialectRevision.Smb2Unknown;
                }
                this.NegotiateResponse(status, selectedDialect);
                if (selectedDialect == DialectRevision.Smb2Wildcard)
                {
                    messageId = 1;
                }
            }
            catch
            {
            }
        }
 /// <summary>
 /// The get composition of peptide.
 /// </summary>
 /// <param name="peptide">
 /// The peptide.
 /// </param>
 /// <returns>
 /// The <see cref="Composition"/>.
 /// </returns>
 public static Composition GetCompositionOfPeptide(string peptide)
 {
     Sequence peptideSequence = new Sequence(peptide, AminoAcidSet.GetStandardAminoAcidSet());
     var composition = peptideSequence.Composition;
     composition += Composition.H2O;
     return composition;
 }
示例#5
0
        private Sequence<InstructionNode> Create(IEnumerator<XamlInstruction> stream)
        {
            var nodes = new Sequence<InstructionNode>();

            while (IsLeading(stream.Current))
            {
                var currentNode = new InstructionNode { Leading = stream.Current };
                var continueWorking = true;
                while (stream.MoveNext() && continueWorking)
                {
                    if (IsLeading(stream.Current))
                    {
                        currentNode.Children = Create(stream);
                    }

                    var xamlNode = stream.Current;

                    if (IsTrailing(xamlNode))
                    {
                        continueWorking = false;
                        currentNode.Trailing = stream.Current;
                    }
                    else
                    {
                        currentNode.Body.Add(stream.Current);
                    }
                }

                nodes.Add(currentNode);
            }

            return nodes;
        }
示例#6
0
 public static Type[] ConvertSequenceToTypeArray(Sequence<Parameter> pars)
 {
     var l = new List<Type>();
     foreach (Parameter p in pars)
         l.Add(p.type);
     return l.ToArray();
 }
    public override Tweener buildTweener(Sequence sequence, int frameRate)
    {
        if(go == null) return null;

        //active won't really be set, it's just a filler along with ease
        return HOTween.To(go, getTime(frameRate), new TweenParms().Prop("active", new AMPlugGOActive(setActive)).Ease(EaseType.Linear));
    }
示例#8
0
        /// <summary>
        /// Transcribes a DNA sequence into an RNA sequence. The length
        /// of the resulting sequence will equal the length of the source
        /// sequence. Gap and ambiguous characters will also be transcribed.
        /// For example:
        /// Sequence dna = new Sequence(Alphabets.DNA, "TACCGC");
        /// Sequence rna = Transcription.Transcribe(dna);
        /// rna.ToString() would produce "AUGGCG"
        /// </summary>
        /// <param name="dnaSource">The dna source sequence to be transcribed.</param>
        /// <returns>The transcribed RNA sequence.</returns>
        public static ISequence Transcribe(ISequence dnaSource)
        {
            if (dnaSource == null)
            {
                throw new ArgumentNullException("dnaSource");
            }

            if (dnaSource.Alphabet != Alphabets.DNA && dnaSource.Alphabet != Alphabets.AmbiguousDNA)
            {
                throw new InvalidOperationException(Properties.Resource.InvalidAlphabetType);
            }

            byte[] transcribedResult = new byte[dnaSource.Count];
            long counter = 0;

            foreach (byte n in dnaSource)
            {
                transcribedResult[counter] = GetRnaComplement(n);
                counter++;
            }

            var alphabet = dnaSource.Alphabet == Alphabets.DNA ? Alphabets.RNA : Alphabets.AmbiguousRNA;
            Sequence result = new Sequence(alphabet, transcribedResult);
            result.ID = "Complement: " + dnaSource.ID;

            return result;
        }
示例#9
0
        public EnemySlime()
        {
            Sprite = Support.TiledSpriteFromFile("/Application/assets/slime_green_frames.png", 4, 4);

            IdleAnimation = new Support.AnimationAction(Sprite, 0, 8, 0.5f, looping: true);
            JumpInAnimation = new Support.AnimationAction(Sprite, 8, 12, 0.3f, looping: false);
            JumpMidAnimation = new Support.AnimationAction(Sprite, 12, 13, 1.0f, looping: false);
            JumpOutAnimation = new Support.AnimationAction(Sprite, 13, 16, 0.2f, looping: false);

            JumpAnimationSequence = new Sequence();
            JumpAnimationSequence.Add(JumpInAnimation);
            JumpAnimationSequence.Add(new CallFunc(this.Jump));
            JumpAnimationSequence.Add(JumpMidAnimation);
            JumpAnimationSequence.Add(new DelayTime() { Duration = 0.40f });
            JumpAnimationSequence.Add(JumpOutAnimation);
            JumpAnimationSequence.Add(new DelayTime() { Duration = 0.05f });
            JumpAnimationSequence.Add(IdleAnimation);

            this.AddChild(Sprite);
            Sprite.RunAction(IdleAnimation);

            //            CollisionDatas.Add(new EntityCollider.CollisionEntry() {
            //	            type = EntityCollider.CollisionEntityType.Enemy,
            //				owner = this,
            //				collider = Sprite,
            //				center = () => GetCollisionCenter(Sprite) + new Vector2(0.0f, -8.0f),
            //				radius = () => 24.0f,
            //			});
            //
            //			GroundFriction = new Vector2(0.85f);
            Health = 2.0f;
            MoveDelay = 3.0f;
        }
示例#10
0
	void FixedUpdate(){
		if (GameController.GetInstance().intoRobot == true && GameController.GetInstance().CurrentPlayer == BallRobot) {
			if( GameController.GetInstance().ObjectTriggerID.GetComponent<RobotGameOver>().isAvail == true && BallRobot.GetComponent<PlayerControl>().isAvail == true && GameController.GetInstance().BallToRobot == true && GameController.GetInstance().IsRobot == false){
				GameController.GetInstance().moveRight[0] = 0;
				GameController.GetInstance().moveLeft[0] = 0;
				//当前操作对象变更为小球接触到的有效机器人
				GameController.GetInstance().CurrentPlayer =  GameController.GetInstance().ObjectID;
				//被操作的机器人(玩家机器人)半透明状态还原
				GameController.GetInstance().ObjectID.gameObject.GetComponent<tk2dSprite>().color = new Color(1f, 1f, 1f, 1.0f);
				//当前操作对象变的触发更为小球接触到的有效机器人的触发
				GameController.GetInstance().CurrentPlayerTrigger =  GameController.GetInstance().ObjectTriggerID;
				CurrentPlayerString =  GameController.GetInstance().CurrentPlayer.name.Substring (start - 1, length);
				//小球不再接触到有效机器人
				GameController.GetInstance().PlayerIsTriggered = false;
				MissingBall = Instantiate(MissingBallPlayer, BallRobot.gameObject.transform.position,  Quaternion.identity) as GameObject;
				//小球被灭活,就消失了
				BallRobot.gameObject.SetActive(false);
				//摄像机位置调整
				Sequence BallAnim = new Sequence (new SequenceParms().OnComplete(ChangeRole));
				if(GameController.GetInstance().CurrentPlayer.transform.position [0] > GameController.GetInstance().FollowedLeftLine && GameController.GetInstance().CurrentPlayer.transform.position [0] < GameController.GetInstance().FollowedRightLine){
					BallAnim.Prepend(HOTween.To (GameObject.Find("Camera01").gameObject.transform, 0.3f,new TweenParms().Prop("position",new Vector3( GameController.GetInstance().CurrentPlayer.transform.position[0], GameController.GetInstance().CurrentPlayer.transform.position[1],-21.3f))));
				}else if(GameController.GetInstance().CurrentPlayer.transform.position [0] < GameController.GetInstance().FollowedLeftLine){
					BallAnim.Prepend(HOTween.To (GameObject.Find("Camera01").gameObject.transform, 0.3f,new TweenParms().Prop("position",new Vector3( GameController.GetInstance().FollowedLeftLine, GameController.GetInstance().CurrentPlayer.transform.position[1],-21.3f))));
				}else if(GameController.GetInstance().CurrentPlayer.transform.position [0] > GameController.GetInstance().FollowedRightLine){
					BallAnim.Prepend(HOTween.To (GameObject.Find("Camera01").gameObject.transform, 0.3f,new TweenParms().Prop("position",new Vector3( GameController.GetInstance().FollowedRightLine, GameController.GetInstance().CurrentPlayer.transform.position[1],-21.3f))));
				}
				//小球附身时本体消失的动画
				BallAnim.Insert(0,HOTween.To (MissingBall.gameObject.transform, 0.15f,new TweenParms().Prop("localScale", new Vector3(0.1f,1.5f,1f))));
				BallAnim.Insert(0.1f,HOTween.To (MissingBall.gameObject.transform, 0.2f,new TweenParms().Prop("position", new Vector3(MissingBall.gameObject.transform.position[0],MissingBall.gameObject.transform.position[1]+2.3f,MissingBall.gameObject.transform.position[2]))));
				BallAnim.Insert(0.2f,HOTween.To (MissingBall.gameObject.GetComponent<tk2dSprite>(), 0.1f,new TweenParms().Prop("color", new Color(1,1,1,0))));
				BallAnim.Play();
			}
		}
	}
示例#11
0
        public void SetUp()
        {
            _gatingSequence = new Sequence(Sequencer.InitialCursorValue);

            _sequencer = new Sequencer(new SingleThreadedClaimStrategy(BufferSize), new SleepingWaitStrategy());
            _sequencer.SetGatingSequences(_gatingSequence);
        }
		public ExpressionColumnFunctionCalls(TableName tableName, ColumnName columnName, Sequence<NamedFunction> functions): base(functions.Item, functions.Next) {
			Debug.Assert(tableName != null);
			Debug.Assert(columnName != null);
			columnNameQualified = new Qualified<TableName, ColumnName>(tableName, columnName);
			Debug.Assert(!functions.Item.FunctionName.IsQualified);
			functions.Item.FunctionName.LockOverride();
		}
示例#13
0
        public void SmithWatermanProteinSeqAffineGap()
        {
            IPairwiseSequenceAligner sw = new SmithWatermanAligner
                {
                    SimilarityMatrix = new SimilarityMatrix(SimilarityMatrix.StandardSimilarityMatrix.Blosum62),
                    GapOpenCost = -8,
                    GapExtensionCost = -1,
                };

            ISequence sequence1 = new Sequence(Alphabets.Protein, "HEAGAWGHEE");
            ISequence sequence2 = new Sequence(Alphabets.Protein, "PAWHEAE");
            IList<IPairwiseSequenceAlignment> result = sw.Align(sequence1, sequence2);
            AlignmentHelpers.LogResult(sw, result);

            IList<IPairwiseSequenceAlignment> expectedOutput = new List<IPairwiseSequenceAlignment>();
            IPairwiseSequenceAlignment align = new PairwiseSequenceAlignment();
            PairwiseAlignedSequence alignedSeq = new PairwiseAlignedSequence
                {
                    FirstSequence = new Sequence(Alphabets.Protein, "AWGHE"),
                    SecondSequence = new Sequence(Alphabets.Protein, "AW-HE"),
                    Consensus = new Sequence(Alphabets.AmbiguousProtein, "AWGHE"),
                    Score = 20,
                    FirstOffset = 0,
                    SecondOffset = 3
                };
            align.PairwiseAlignedSequences.Add(alignedSeq);
            expectedOutput.Add(align);

            Assert.IsTrue(AlignmentHelpers.CompareAlignment(result, expectedOutput));
        }
示例#14
0
 public IEnumerable<Bitmap> IteratePartsKNN(IResult res, double dqp, float stddev, float mean, Sequence seq)
 {
     var sym = this.Discretize(dqp, stddev, mean);
     yield return seq.Unravel(sym);
     var left = sym - 1;
     var right = sym + 1;
     bool do_next = true;
     while (do_next) {
         do_next = false;
         var __left = this.Discretize(dqp - res.CoveringRadius, stddev, mean);
         if (0 <= left && __left <= left) {
             yield return seq.Unravel(left);
             --left;
             do_next = true;
         }
         var __right = this.Discretize(dqp + res.CoveringRadius, stddev, mean);
         if (right <= __right && right < seq.Sigma) {
             yield return seq.Unravel(right);
             ++right;
             do_next = true;
         }
         /*Console.WriteLine ("left: {0}, right: {1}, __left: {2}, __right: {3}",
                            left, right, __left, __right);*/
     }
 }
示例#15
0
 public void Can_be_reset()
 {
     var sequence = new Sequence(100);
     var value = sequence.Next;
     sequence.Reset();
     Assert.Equal(100, sequence.Next);
 }
		public TableForeignKeyConstraint(ConstraintName constraintName, Sequence<ColumnName> columnNames, Qualified<SchemaName, TableName> refTableName, Optional<Sequence<ColumnName>> refColumnNames, Sequence<ForeignKeyAction> keyActions): base(constraintName) {
			Debug.Assert(refTableName != null);
			this.columnNames = columnNames.ToList();
			this.refTableName = refTableName;
			this.refColumnNames = refColumnNames.ToList();
			this.keyActions = keyActions.ToList();
		}
 void OnJellyfishDrain()
 {
     pulse = DOTween.Sequence().Pause().SetLoops(loopCount);
     pulse.Append(image.DOColor(toColor, intervalOn).SetEase(easeOn));
     pulse.Append(image.DOColor(Color.black, intervalOff).SetEase(easeOff));
     pulse.Play();
 }
示例#18
0
        public ExecutableNodeFactory(Executable executable,Executables collection)
        {
            _collection = collection;
            _executable = (DtsContainer)executable;
            _host = _executable as TaskHost;
            _seq = _executable as Sequence;
            _foreachloop = _executable as ForEachLoop;
            _forloop = _executable as ForLoop;
            _psExecutable = PSObject.AsPSObject(_executable);

            if (null != _host)
            {
                _psExecutable.Properties.Add( new PSNoteProperty( "IsTaskHost", true ));
                _mainPipe = _host.InnerObject as MainPipe;
            }
            if (null != _mainPipe)
            {
                _psExecutable.Properties.Add(new PSNoteProperty("IsDataFlow", true));
            }
            if (null != _seq)
            {
                _psExecutable.Properties.Add(new PSNoteProperty("IsSequence", true));
            }
            if (null != _foreachloop)
            {
                _psExecutable.Properties.Add(new PSNoteProperty("IsForEachLoop", true));
            }
            if (null != _forloop)
            {
                _psExecutable.Properties.Add(new PSNoteProperty("IsForLoop", true));
            }
        }
示例#19
0
        public void TestMUMmerAlignerMultipleMum()
        {
            string reference = "ATGCGCATCCCCTT";
            string search = "GCGCCCCCTA";

            Sequence referenceSeq = null;
            Sequence searchSeq = null;

            referenceSeq = new Sequence(Alphabets.DNA, reference);
            searchSeq = new Sequence(Alphabets.DNA, search);

            List<ISequence> searchSeqs = new List<ISequence>();
            searchSeqs.Add(searchSeq);

            MUMmerAligner mummer = new MUMmerAligner();
            mummer.LengthOfMUM = 4;
            mummer.PairWiseAlgorithm = new NeedlemanWunschAligner();

            IList<IPairwiseSequenceAlignment> result = mummer.AlignSimple(referenceSeq, searchSeqs);

            // Check if output is not null
            Assert.AreNotEqual(null, result);
            IList<IPairwiseSequenceAlignment> expectedOutput = new List<IPairwiseSequenceAlignment>();
            IPairwiseSequenceAlignment align = new PairwiseSequenceAlignment();
            PairwiseAlignedSequence alignedSeq = new PairwiseAlignedSequence();
            alignedSeq.FirstSequence = new Sequence(Alphabets.DNA, "ATGCGCATCCCCTT");
            alignedSeq.SecondSequence = new Sequence(Alphabets.DNA, "--GCGC--CCCCTA");
            alignedSeq.Consensus = new Sequence(AmbiguousDnaAlphabet.Instance, "ATGCGCATCCCCTW");
            alignedSeq.Score = -11;
            alignedSeq.FirstOffset = 0;
            alignedSeq.SecondOffset = 2;
            align.PairwiseAlignedSequences.Add(alignedSeq);
            expectedOutput.Add(align);
            Assert.IsTrue(CompareAlignment(result, expectedOutput));
        }
示例#20
0
    //public Seq[] sequences;
    // Use this for initialization
    void Start()
    {
        var cz = GetComponent<CombatZone>();
        var wCount = 0;
        foreach (Wav wav in waves) {
            var w = new Wave();
            cz.spawnWaves.Add(w);
            cz.spawnWaves[wCount].delayNextSeq = wav.delaySeq;
            foreach (Seq seq in wav.sequences) {

                    var sq = new Sequence ();
                    cz.spawnWaves [wCount].spawnSeqs.Add (sq);
                    sq.delayNextEvent = seq.delay;
                    sq.pos = seq.pos;
                    for (int i=0; i<seq.amount; i ++) {
                            var e = new SpawnEvent ();//sq.spawnEvents[i];
                            e.enemyType = seq.eType;
                            e.equipped = seq.equipped;
                            e.paratrooper = seq.chute;
                            Vector2 p = transform.position;
                            e.offset = p + sq.pos + (seq.offset * i);
                            sq.spawnEvents.Add (e);
                    }

            }
            wCount++;
        }
    }
 public void FillAlignedSequencesTest2()
 {
     // AACGCTAG
     // ATCCTAGG
     var sequence1 = new Sequence
         {
             Nucleotide.A,
             Nucleotide.A,
             Nucleotide.C,
             Nucleotide.G,
             Nucleotide.C,
             Nucleotide.T,
             Nucleotide.A,
             Nucleotide.G
         };
     var sequence2 = new Sequence
         {
             Nucleotide.A,
             Nucleotide.T,
             Nucleotide.C,
             Nucleotide.C,
             Nucleotide.T,
             Nucleotide.A,
             Nucleotide.G,
             Nucleotide.G
         };
     var pairAlignment = new PairAlignment(sequence1, sequence2);
     var algorithm = new PairAlignmentAlgorithm(new OperationDistanceEstimator(4, 2, 0, 1));
     algorithm.FillAlignedSequences(pairAlignment);
 }
        public void FillAlignedSequencesWithDifferentCountTest()
        {
            // AACGCTAG
            // ATCCTAG
            var sequence1 =
                new Sequence(
                    new[]
                        {
                            Nucleotide.A, Nucleotide.A, Nucleotide.C, Nucleotide.G, Nucleotide.C, Nucleotide.T,
                            Nucleotide.A, Nucleotide.G
                        },
                    1);
            var sequence2 =
                new Sequence(
                    new[]
                        {
                            Nucleotide.A, Nucleotide.T, Nucleotide.C, Nucleotide.C, Nucleotide.T, Nucleotide.A,
                            Nucleotide.G
                        },
                    2);

            var estimator = new OperationDistanceEstimator(4, 2, 0, 1);
            var multipleAlignment1 = new MultipleAlignment(1, new[] { sequence1 }, estimator);
            var multipleAlignment2 = new MultipleAlignment(2, new[] { sequence2 }, estimator);
            var newMultipleAlignment = new MultipleAlignment(3, multipleAlignment1, multipleAlignment2);
            var algorithm = new MultipleAlignmentAlgorithm(estimator);
            var groupAlgorithm = new GroupAlignmentAlgorithm(estimator);
            algorithm.FillAlignedSequences(newMultipleAlignment, groupAlgorithm.GeneratePairAlignmentsMap(newMultipleAlignment));
        }
示例#23
0
        public void ValidateSingleCharDnaSequence()
        {
            // Gets the actual sequence and the alphabet from the Xml
            string alphabetName = this.utilityObj.xmlUtil.GetTextValue(
                Constants.SimpleDnaAlphabetNode, Constants.AlphabetNameNode);
            string actualSequence = this.utilityObj.xmlUtil.GetTextValue(
                Constants.SimpleDnaAlphabetNode, Constants.ExpectedSingleChar);

            // Logs information to the log file
            ApplicationLog.WriteLine(string.Concat(
                "Sequence BVT: Sequence is as expected."));

            Sequence createSequence = new Sequence(
                Utility.GetAlphabet(alphabetName), actualSequence);

            Assert.IsNotNull(createSequence);

            // Validate the createdSequence            
            string seqNew = new string(createSequence.Select(a => (char)a).ToArray());
            Assert.AreEqual(seqNew, actualSequence);

            ApplicationLog.WriteLine(string.Concat(
                "Sequence BVT: Sequence is as expected."));

            Assert.AreEqual(Utility.GetAlphabet(alphabetName), createSequence.Alphabet);
            ApplicationLog.WriteLine(string.Concat(
                "Sequence BVT: Sequence Alphabet is as expected."));

            ApplicationLog.WriteLine(
                "Sequence BVT: The DNA with single character Sequence is completed successfully.");
        }
示例#24
0
        static void Main(string[] args)
        {
            try
            {
                ProcessLauncher.Instance.StartLoop();

                LogManager.Instance.AddLogger(new ConsoleLogger());
                LogManager.Instance.Verbosity = LogVerbosity.Trace;

                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load("../../../../Test.xml");

                // TODO : how load NamedVariableList and Sequence
                // if the structure of the xml is not defined in the library ?
                // It is the user who build the xml
                XmlNode rootNode = xmlDoc.FirstChild.NextSibling;
                NamedVariableManager.Instance.Load(rootNode);
                GraphDataManager.Instance.Load(rootNode);

                Sequence seq = new Sequence("test");
                seq.Load(xmlDoc.SelectSingleNode("FlowSimulator/GraphList/Graph[@name='test']"));

                ProcessLauncher.Instance.LaunchSequence(seq, typeof(EventNodeTestStarted), 0, "test");
                ProcessLauncher.Instance.StopLoop();
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
            }

            Console.WriteLine("Press any keys...");
            Console.ReadKey();
        }
示例#25
0
        public void SequenceTestSerialize()
        {
            Sequence<int> before = new Sequence<int>(3);
            before.AddRange( new[] {1,2});
            before.Add(3);
            before.Add(4);

            Assert.Equal(4, before[0]);
            Assert.Equal(3, before[1]);
            Assert.Equal(2, before[2]);
            Assert.Equal(3, before.Capacity);
            Assert.Equal(4, before.CountOfAllObservedItems);

            //JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
            //serializerSettings.Converters.Add(new SequenceConverter());

            string serialized = JsonConvert.SerializeObject(before);
            Sequence<int> after = JsonConvert.DeserializeObject<Sequence<int>>(serialized);

            Assert.Equal(4, after[0]);
            Assert.Equal(3, after[1]);
            Assert.Equal(2,after[2]);
            Assert.Equal(3, after.Capacity);
            Assert.Equal(4, after.CountOfAllObservedItems);
            Assert.Equal(before, after);
        }
示例#26
0
    private void RotateData()
    {
        for (int i = 0; i < gameList.Count; i++)
        {
            //每一个Item对应一个序列,此序列是个无限循环序列,从开始位置循环
            Sequence sequence = new Sequence(new SequenceParms().Loops( 1000,LoopType.Restart));
            mySequences.Add(sequence);
        }
         
        for (int i = 0; i < mySequences.Count; i++)
        {
            for (int j = 0; j < gameList.Count - i; j++)
            {
                mySequences[i].Append(HOTween.To(gameList[i], 1, new TweenParms().Prop("position", vpos[j + i])));
            }

            if (i > 0)
            {
                for (int j = 0; j < i; j++)
                {
                    mySequences[i].Append(HOTween.To(gameList[i], 1, new TweenParms().Prop("position", vpos[j])));                  
                }
            }
            mySequences[i].Append(HOTween.To(gameList[i], 1, new TweenParms().Prop("position", vpos[i])));

        }
        
    }
示例#27
0
文件: SATSEQ.cs 项目: sadit/natix
 public void Build(SAT sat)
 {
     var n = sat.DB.Count;
     this.DB = sat.DB;
     var cov = new double[n];
     var seq = new int[n];
     this.root = sat.root.objID;
     int nonzeros = 0;
     var visit = new Action<SAT.Node,SAT.Node>((parent, child) => {
         seq[child.objID] = (parent == null) ? n : parent.objID;
         cov[child.objID] = child.cov;
         if (child.cov > 0) ++nonzeros;
     });
     visit (null, sat.root);
     this.Build_IterateSAT (sat.root, visit);
     var listibuilder = ListIBuilders.GetArray ();
     var permbuilder = PermutationBuilders.GetCyclicPerms (1, listibuilder, listibuilder);
     var seqbuilder = SequenceBuilders.GetSeqSinglePerm (permbuilder);
     this.SEQ = seqbuilder (seq, n + 1);
     this.COV = new List<double> (nonzeros);
     var cov_zero = new BitStream32 ();
     cov_zero.Write (true, n);
     for (int objID = 0; objID < n; ++objID) {
         if (cov[objID] > 0) {
             this.COV.Add(cov[objID]);
             cov_zero[objID] = false;
         }
     }
     this.COV_ZERO = new GGMN ();
     this.COV_ZERO.Build (cov_zero, 8);
 }
示例#28
0
 public Boolean checkCellWin(Cell c)
 {
     Sequence seq;
       if (c.type == goalMutation){
     //Support.SoundSystem.Instance.Play("blip.wav");
     goalSprite.Visible = false;
     var right = Support.TiledSpriteFromFile("/Application/assets/display_GOOD.png", 1, 1);
     GameScene.Instance.AddChild(right);
     right.CenterSprite();
     right.Quad.S = right.TextureInfo.TextureSizef/2;
     right.Position = goalSprite.Position;
     right.VertexZ = 1;
     seq = new Sequence();
     seq.Add(new DelayTime(2));
     seq.Add(new CallFunc(() => { GameScene.Instance.RemoveChild(right, true); goalSprite.Visible = true;}));
     GameScene.Instance.RunAction(seq);
     return true;
       }
       //Support.SoundSystem.Instance.Play("blip.wav");
       goalSprite.Visible = false;
       var wrong = Support.TiledSpriteFromFile("/Application/assets/display_BAD.png", 1, 1);
       wrong.CenterSprite();
       wrong.Quad.S = wrong.TextureInfo.TextureSizef/2;
       wrong.Position = goalSprite.Position;
       wrong.VertexZ = 1;
       GameScene.Instance.AddChild(wrong);
       seq = new Sequence();
       seq.Add(new DelayTime(2));
       seq.Add(new CallFunc(() => { GameScene.Instance.RemoveChild(wrong, true); goalSprite.Visible = true;;}));
       GameScene.Instance.RunAction(seq);
       return false;
 }
示例#29
0
        public void CreateSimpleStatsAndVerifyCount()
        {
            ISequence sequence = new Sequence(Alphabets.DNA, "ACGT--ACGT--ACGT--");
            SequenceStatistics stats = new SequenceStatistics(sequence);

            Assert.AreEqual(18, stats.TotalCount);
        }
示例#30
0
        public void CreateSimpleStatsAndVerifyAlphabetIsReturned()
        {
            ISequence sequence = new Sequence(Alphabets.DNA, "A");
            SequenceStatistics stats = new SequenceStatistics(sequence);

            Assert.AreEqual(Alphabets.DNA, stats.Alphabet);
        }
示例#31
0
    void Awake()
    {
        //DOTween.Init();
        //DOTween.defaultAutoPlay = AutoPlay.None;

        //初期位置設定
        Button.transform.localPosition = new Vector3(0, -100f, 0);
        Button.SetActive(false);
        TextSaved.gameObject.SetActive(true);
        TextSaved.localScale = new Vector3(0f, 0f, 1f);
        TextSavedColor.color = new Color(50f / 255f, 50f / 255f, 50f / 255f, 0f);
        ContinueCheck.gameObject.SetActive(true);
        ContinueCheck.localScale    = new Vector3(0f, 0f, 1f);
        ContinueCheckColor[0].color = new Color(50f / 255f, 50f / 255f, 50f / 255f, 0f);
        ContinueCheckColor[1].color = new Color(50f / 255f, 50f / 255f, 50f / 255f, 0f);
        ContinueCheckColor[1].text  = CountStartNumber.ToString();
        ThankyouMessage.color       = new Color(50f / 255f, 50f / 255f, 50f / 255f, 0f);


        //セーブ完了

        StartTween.Insert(3f, DOVirtual.DelayedCall(3f, () => {
            TextSaved.DOScale(new Vector3(1f, 1f, 1f), 0.5f).SetEase(Ease.OutQuint);
            DOTween.ToAlpha(() => TextSavedColor.color,
                            color => TextSavedColor.color = color, 1f, 0.5f
                            );
        }));

        StartTween.Insert(4f, DOVirtual.DelayedCall(5f, () => {
            TextSaved.DOScale(new Vector3(1.5f, 1.5f, 1f), 0.5f).SetEase(Ease.OutQuint);
            DOTween.ToAlpha(() => TextSavedColor.color,
                            color => TextSavedColor.color = color, 0f, 0.5f
                            );
        }));

        //コンティニュー確認
        StartTween.Insert(5f, DOVirtual.DelayedCall(6f, () => {
            DOTween.ToAlpha(() => ContinueCheckColor[0].color,
                            color => ContinueCheckColor[0].color = color, 1f, 1f
                            );
            DOTween.ToAlpha(() => ContinueCheckColor[1].color,
                            color => ContinueCheckColor[1].color = color, 1f, 1f
                            );
            ContinueCheck.DOScale(new Vector3(1f, 1f, 1f), 1f).SetEase(Ease.OutQuint);
        }));

        StartTween.Insert(9f, DOVirtual.DelayedCall(6f, () => {
            Button.SetActive(true);
        }));
        StartTween.Insert(9f, DOVirtual.DelayedCall(8f, () => {
            CountdownFlag = true;
        }));

        //ボタン
        StartTween.Insert(9f,
                          DOVirtual.DelayedCall(6f, () =>
        {
            Button.transform.DOLocalMoveY(0, 0.5f).SetEase(Ease.OutQuint);
        }
                                                )
                          );

        //BGM 設定
        string path = "Audio/endscreen.wav";

        StartCoroutine(GetAudioClip(path));

        if (!DebugMode)
        {
            //SceneChange
            SceneChange = GameObject.Find("SceneChangeEnd");

            float           timeDelay = 0.5f;
            GameObject[]    changer   = new GameObject[4];
            RectTransform[] rectTran  = new RectTransform[4];

            for (int i = 0; i < 4; i++)
            {
                changer[i]  = GameObject.Find("SceneChangeEnd").transform.Find(i.ToString()).gameObject;
                rectTran[i] = changer[i].GetComponent <RectTransform>();
            }

            sceneChangeTween = DOTween.Sequence();
            for (int i = 0; i < 4; i++)
            {
                sceneChangeTween.Insert(1 + 0.25f * (3 - i),
                                        rectTran[i].DOLocalMoveX(-1280, timeDelay).SetEase(Ease.OutQuint)
                                        );
            }

            sceneChangeTween.Join(
                DOVirtual.DelayedCall(6f, () =>
            {
                Destroy(SceneChange);
            })
                );
        }
    }
示例#32
0
 public override int GetHashCode()
 {
     return(base.GetHashCode() ^ Sequence.GetHashCode((object)this.Source, (object)this.Destination, (object)this.EtherType));
 }
示例#33
0
        public Sequence FlattenSequences()
        {
            List <Sequence> Run  = Sequences.ToList();
            Sequence        best = new Sequence();

            Console.WriteLine("Sequences to solve for: ");
            Run.ForEach(row => Console.WriteLine(row));
            Console.WriteLine();

            // Check if a sequence is wholly contained in another
            for (int seqNumber = 0; seqNumber < Run.Count; seqNumber++)
            {
                Sequence s = Run[seqNumber];
                for (int checkNumber = seqNumber + 1; checkNumber < Run.Count; checkNumber++)
                {
                    Sequence c = Run[checkNumber];

                    // Check them to see if either is contained in either
                    if (s.ToString().Contains(c.ToString()) || c.ToString().Contains(s.ToString()))
                    {
                        // One contains the other, elminate the shorter one (or first one)
                        if (s.Cells.Count > c.Cells.Count)
                        {
                            Run.Remove(c);
                        }
                        else
                        {
                            Run.Remove(s);
                        }
                    }
                }
            }

            Console.WriteLine("After removing whole matches:");
            Run.ForEach(row => Console.WriteLine(row));
            Console.WriteLine();

            // Check if this sequence starts/ends with another
            for (int seqNumber = 0; seqNumber < Run.Count; seqNumber++)
            {
                Sequence s = Run[seqNumber];
                for (int checkNumber = seqNumber + 1; checkNumber < Run.Count; checkNumber++)
                {
                    Sequence c = Run[checkNumber];

                    // Check them to see if either is contained in either
                    if (s.ToString().Contains(c.ToString()) || c.ToString().Contains(s.ToString()))
                    {
                        // One contains the other, elminate the shorter one (or first one)
                        if (s.Cells.Count > c.Cells.Count)
                        {
                            Run.Remove(c);
                        }
                        else
                        {
                            Run.Remove(s);
                        }
                    }
                }
            }



            return(best);
        }
 /// <summary>
 /// The hash code of an entry is a xor of the hash code of the address family, length, payload offset and payload.
 /// </summary>
 public sealed override int GetHashCode()
 {
     return(Sequence.GetHashCode(AddressFamily, Length, PayloadOffset) ^ PayloadHashCode);
 }
示例#35
0
        private static void WriteMums(IEnumerable <Match> mums, Sequence refSequence, Sequence querySequence, CommandLineOptions myArgs)
        {
            // write the QuerySequenceId
            string DisplayID = querySequence.ID;

            Console.Write("> {0}", DisplayID);
            if (myArgs.displayQueryLength)
            {
                Console.Write(" " + querySequence.Count);
            }
            Console.WriteLine();

            // DISCUSSION:
            //   If a ReverseComplement sequence, MUMmer has the option to print the index start point relative
            //   to the original sequence we tagged the reversed DisplayID with " Reverse" so _if_ we find a
            //   " Reverse" on the end of the ID, assume it is a ReverseComplement and reverse the index
            bool isReverseComplement = myArgs.c && querySequence.IsMarkedAsReverseComplement();

            // Start is 1 based in literature but in programming (e.g. MaxUniqueMatch) they are 0 based.
            // Add 1
            Stopwatch swInterval = new Stopwatch();

            swInterval.Start();

            foreach (Match match in mums)
            {
                swInterval.Stop();
                // Add time taken by GetMatches().
                mummerTime = mummerTime.Add(swInterval.Elapsed);


                swInterval.Restart();
                Console.WriteLine("{0,8}  {1,8}  {2,8}",
                                  match.ReferenceSequenceOffset + 1,
                                  !isReverseComplement ? match.QuerySequenceOffset + 1 : querySequence.Count - match.QuerySequenceOffset,
                                  match.Length);
                if (myArgs.showMatchingString)
                {
                    StringBuilder sb = new StringBuilder((int)match.Length);
                    for (int i = 0; i < match.Length; ++i)
                    {
                        sb.Append((char)querySequence[match.QuerySequenceOffset + i]);
                    }

                    Console.WriteLine(sb.ToString());
                }

                swInterval.Stop();
                writetime = writetime.Add(swInterval.Elapsed);
                swInterval.Restart();
            }
        }
示例#36
0
        public void PathPurger1()
        {
            const int         KmerLength      = 7;
            ISequence         sequence        = new Sequence(Alphabets.DNA, "GATTCAAGGGCTGGGGG");
            IList <ISequence> contigsSequence = SequenceToKmerBuilder.GetKmerSequences(sequence, KmerLength).ToList();
            ContigGraph       graph           = new ContigGraph();

            graph.BuildContigGraph(contigsSequence, KmerLength);
            List <Node>          contigs = graph.Nodes.ToList();
            IList <ScaffoldPath> paths   =
                new List <ScaffoldPath>();
            ScaffoldPath path = new ScaffoldPath();

            foreach (Node node in contigs)
            {
                path.Add(new KeyValuePair <Node, Edge>(node, null));
            }

            paths.Add(path);
            path = new ScaffoldPath();
            foreach (Node node in contigs.GetRange(2, 5))
            {
                path.Add(new KeyValuePair <Node, Edge>(node, null));
            }

            paths.Add(path);
            path = new ScaffoldPath();
            foreach (Node node in contigs.GetRange(3, 5))
            {
                path.Add(new KeyValuePair <Node, Edge>(node, null));
            }

            paths.Add(path);
            path = new ScaffoldPath();
            foreach (Node node in contigs.GetRange(6, 5))
            {
                path.Add(new KeyValuePair <Node, Edge>(node, null));
            }

            paths.Add(path);
            path = new ScaffoldPath();
            foreach (Node node in contigs.GetRange(0, 11))
            {
                path.Add(new KeyValuePair <Node, Edge>(node, null));
            }

            paths.Add(path);
            path = new ScaffoldPath();
            foreach (Node node in contigs.GetRange(7, 4))
            {
                path.Add(new KeyValuePair <Node, Edge>(node, null));
            }

            paths.Add(path);
            path = new ScaffoldPath();
            foreach (Node node in contigs.GetRange(11, 0))
            {
                path.Add(new KeyValuePair <Node, Edge>(node, null));
            }

            paths.Add(path);
            path = new ScaffoldPath();
            foreach (Node node in contigs.GetRange(2, 9))
            {
                path.Add(new KeyValuePair <Node, Edge>(node, null));
            }

            paths.Add(path);
            path = new ScaffoldPath();
            foreach (Node node in contigs.GetRange(1, 10))
            {
                path.Add(new KeyValuePair <Node, Edge>(node, null));
            }

            paths.Add(path);
            PathPurger assembler = new PathPurger();

            assembler.PurgePath(paths);
            Assert.AreEqual(paths.Count, 1);
            Assert.IsTrue(Compare(paths.First(), contigs));
        }
示例#37
0
 internal override int GetDataHashCode()
 {
     return(Sequence.GetHashCode(BitSequence.Merge((byte)Status, PrefixLength), HomeAddress));
 }
示例#38
0
        static void Main(string[] args)
        {
            try
            {
                //            DateTime dStart = DateTime.Now;
                Stopwatch swMumUtil  = Stopwatch.StartNew();
                Stopwatch swInterval = new Stopwatch();

                Console.Error.WriteLine(SplashString());
                if (args.Length > 0)
                {
                    CommandLineOptions myArgs = ProcessCommandLine(args);
                    if (myArgs.help)
                    {
                        Console.WriteLine(Resources.MumUtilHelp);
                    }
                    else
                    {
                        FileInfo refFileinfo   = new FileInfo(myArgs.fileList[0]);
                        long     refFileLength = refFileinfo.Length;
                        refFileinfo = null;

                        swInterval.Restart();
                        IEnumerable <ISequence> referenceSequences = ParseFastA(myArgs.fileList[0]);
                        Sequence referenceSequence = referenceSequences.First() as Sequence;
                        swInterval.Stop();
                        if (myArgs.verbose)
                        {
                            Console.Error.WriteLine();
                            Console.Error.WriteLine("  Processed Reference FastA file: {0}", Path.GetFullPath(myArgs.fileList[0]));
                            Console.Error.WriteLine("        Length of first Sequence: {0:#,000}", referenceSequence.Count);
                            Console.Error.WriteLine("            Read/Processing time: {0}", swInterval.Elapsed);
                            Console.Error.WriteLine("            File size           : {0:#,000} bytes", refFileLength);
                        }

                        FileInfo queryFileinfo   = new FileInfo(myArgs.fileList[1]);
                        long     queryFileLength = queryFileinfo.Length;
                        refFileinfo = null;

                        IEnumerable <ISequence> parsedQuerySequences = ParseFastA(myArgs.fileList[1]);

                        IEnumerable <ISequence> querySequences = parsedQuerySequences;

                        if (myArgs.reverseOnly)
                        {
                            // convert to reverse complement sequences
                            querySequences = ReverseComplementSequenceList(parsedQuerySequences);
                        }
                        else if (myArgs.both)
                        {
                            // add the reverse complement sequences along with query sequences.
                            querySequences = AddReverseComplementsToSequenceList(parsedQuerySequences);
                        }

                        // DISCUSSION:
                        // Three possible outputs desired.  Globally unique 'mum' (v1), unique in reference sequence (v2),
                        //   or get the maximum matches of length or greater.
                        //
                        mummerTime = new TimeSpan();
                        writetime  = new TimeSpan();
                        IEnumerable <Match> mums;
                        long memoryAtStart = 0;
                        long memoryAtEnd   = 0;
                        if (myArgs.verbose)
                        {
                            swMumUtil.Stop();
                            memoryAtStart = GC.GetTotalMemory(true);
                            swMumUtil.Start();
                        }

                        swInterval.Restart();
                        MultiWaySuffixTree suffixTreee = new MultiWaySuffixTree(referenceSequence);
                        swInterval.Stop();

                        if (myArgs.verbose)
                        {
                            swMumUtil.Stop();
                            memoryAtEnd = GC.GetTotalMemory(true);
                            swMumUtil.Start();
                        }

                        MUMmer mummer = new MUMmer(suffixTreee);

                        if (myArgs.verbose)
                        {
                            Console.Error.WriteLine();
                            Console.Error.WriteLine("Suffix tree construction time   : {0}", swInterval.Elapsed);
                            Console.Error.WriteLine("Memory consumed by Suffix tree  : {0:#,000}", memoryAtEnd - memoryAtStart);
                            Console.Error.WriteLine("Total edges created             : {0:#,000}", suffixTreee.EdgesCount);
                            Console.Error.WriteLine("Memory per edge                 : {0:#,000.00} bytes", (((double)(memoryAtEnd - memoryAtStart)) / suffixTreee.EdgesCount));
                            Console.Error.WriteLine();
                            Console.Error.WriteLine("      Processed Query FastA file: {0}", Path.GetFullPath(myArgs.fileList[1]));
                            Console.Error.WriteLine("            File Size           : {0:#,000} bytes", queryFileLength);
                        }

                        mummer.LengthOfMUM = myArgs.length;
                        mummer.NoAmbiguity = myArgs.noAmbiguity;

                        long     querySeqCount  = 0;
                        double   sumofSeqLength = 0;
                        TimeSpan totalTimetakenToProcessQuerySequences = new TimeSpan();
                        string   outputOption = string.Empty;

                        if (myArgs.maxmatch)
                        {
                            outputOption = "GetMumsMaxMatch()";
                            swInterval.Restart();
                            foreach (Sequence qSeq in querySequences)
                            {
                                // Stop the wath after each query sequence parsed.
                                swInterval.Stop();

                                // Add total time to process query sequence.
                                // if reverse complement option is set, includes reverse complement time also.
                                totalTimetakenToProcessQuerySequences = totalTimetakenToProcessQuerySequences.Add(swInterval.Elapsed);

                                mums = mummer.GetMatches(qSeq);

                                WriteMums(mums, referenceSequence, qSeq, myArgs);

                                querySeqCount++;
                                sumofSeqLength += qSeq.Count;

                                // Start the watch for next query sequence parse.
                                swInterval.Restart();
                            }

                            swInterval.Stop();
                        }
                        else if (myArgs.mum)
                        {
                            // mums = mum3.GetMumsMum( referenceSequences[0], querySequences);
                            outputOption = "GetMumsMum()";
                            swInterval.Restart();
                            foreach (Sequence qSeq in querySequences)
                            {
                                // Stop the wath after each query sequence parsed.
                                swInterval.Stop();

                                // Add total time to process query sequence.
                                // if reverse complement option is set, includes reverse complement time also.
                                totalTimetakenToProcessQuerySequences = totalTimetakenToProcessQuerySequences.Add(swInterval.Elapsed);

                                swInterval.Restart();
                                // TODO: After implementing GetMatchesUniqueInBothReferenceAndQuery() in MUMmer
                                ////       GetMatchesUniqueInReference() with GetMatchesUniqueInBothReferenceAndQuery() in the line below.
                                mums = mummer.GetMatchesUniqueInReference(qSeq);
                                swInterval.Stop();

                                // Add time taken by GetMatchesUniqueInBothReferenceAndQuery().
                                mummerTime = mummerTime.Add(swInterval.Elapsed);

                                swInterval.Restart();
                                WriteMums(mums, referenceSequence, qSeq, myArgs);
                                swInterval.Stop();

                                // Add time taken by write matches.
                                writetime = writetime.Add(swInterval.Elapsed);

                                querySeqCount++;
                                sumofSeqLength += qSeq.Count;

                                // Start the watch for next query sequence parse.
                                swInterval.Restart();
                            }

                            swInterval.Stop();
                        }
                        else if (myArgs.mumreference)
                        {
                            // NOTE:
                            //     mum3.GetMUMs() this really implements the GetMumReference() functionality
                            // mums = mum3.GetMumsReference( referenceSequences[0], querySequences);     // should be
                            //swInterval.Restart();
                            outputOption = "GetMumsReference()";
                            swInterval.Restart();
                            foreach (Sequence qSeq in querySequences)
                            {
                                // Stop the watch after each query sequence parsed.
                                swInterval.Stop();

                                // Add total time to process query sequence.
                                // if reverse complement option is set, includes reverse complement time also.
                                totalTimetakenToProcessQuerySequences = totalTimetakenToProcessQuerySequences.Add(swInterval.Elapsed);

                                swInterval.Restart();
                                mums = mummer.GetMatchesUniqueInReference(qSeq);
                                swInterval.Stop();

                                // Add time taken by GetMatchesUniqueInReference().
                                mummerTime = mummerTime.Add(swInterval.Elapsed);

                                swInterval.Restart();
                                WriteMums(mums, referenceSequence, qSeq, myArgs);
                                swInterval.Stop();

                                // Add time taken by write matches.
                                writetime = writetime.Add(swInterval.Elapsed);
                                querySeqCount++;
                                sumofSeqLength += qSeq.Count;

                                // Start the watch for next query sequence parse.
                                swInterval.Restart();
                            }

                            swInterval.Stop();
                        }
                        else
                        {
                            // cannot happen as argument processing already asserted one of the three options must be specified
                            Console.Error.WriteLine("\nError: one of /maxmatch, /mum, /mumreference options must be specified.");
                            Environment.Exit(-1);
                            // kill the error about unitialized use of 'mums' in the next block...the compiler does not recognize
                            //   Environment.Exit() as a no-return function
                            throw new Exception("Never hit this");
                        }

                        if (myArgs.verbose)
                        {
                            if (myArgs.reverseOnly || myArgs.both)
                            {
                                Console.Error.WriteLine("        Read/Processing time          : {0}", timeTakenToParseQuerySequences);
                                Console.Error.WriteLine("     Reverse Complement time          : {0}", timeTakenToGetReverseComplement);
                                Console.Error.WriteLine("     Total time taken to Process reads: {0}", totalTimetakenToProcessQuerySequences);
                            }
                            else
                            {
                                Console.Error.WriteLine("        Read/Processing time          : {0}", totalTimetakenToProcessQuerySequences);
                            }

                            Console.Error.WriteLine();
                            Console.Error.WriteLine("         Number of query Sequences        : {0:#,000}", querySeqCount);
                            Console.Error.WriteLine("         Average length of query Sequences: {0:#,000}", sumofSeqLength / querySeqCount);
                            Console.Error.WriteLine();
                            Console.Error.WriteLine("Compute {0,20} time              : {1}", outputOption, mummerTime);
                            Console.Error.WriteLine("                WriteMums() time          : {0}", writetime);
                        }

                        swMumUtil.Stop();
                        if (myArgs.verbose)
                        {
                            Console.Error.WriteLine("           Total MumUtil Runtime      : {0}", swMumUtil.Elapsed);
                        }
                    }
                }
                else
                {
                    Console.WriteLine(Resources.MumUtilHelp);
                }
            }
            catch (Exception ex)
            {
                DisplayException(ex);
            }
        }
示例#39
0
        internal static void Despawn(Tween t, bool modifyActiveLists = true)
        {
            // Callbacks
            if (t.onKill != null)
            {
                t.onKill();
            }

            if (modifyActiveLists)
            {
                // Remove tween from active list
                RemoveActiveTween(t);
            }
            if (t.isRecyclable)
            {
                // Put the tween inside a pool
                switch (t.tweenType)
                {
                case TweenType.Sequence:
                    _PooledSequences.Push(t);
                    totPooledSequences++;
                    // Despawn sequenced tweens
                    Sequence s   = (Sequence)t;
                    int      len = s.sequencedTweens.Count;
                    for (int i = 0; i < len; ++i)
                    {
                        Despawn(s.sequencedTweens[i], false);
                    }
                    break;

                case TweenType.Tweener:
                    if (_maxPooledTweenerId == -1)
                    {
                        _maxPooledTweenerId = maxTweeners - 1;
                        _minPooledTweenerId = maxTweeners - 1;
                    }
                    if (_maxPooledTweenerId < maxTweeners - 1)
                    {
                        _pooledTweeners[_maxPooledTweenerId + 1] = t;
                        _maxPooledTweenerId++;
                        if (_minPooledTweenerId > _maxPooledTweenerId)
                        {
                            _minPooledTweenerId = _maxPooledTweenerId;
                        }
                    }
                    else
                    {
                        for (int i = _maxPooledTweenerId; i > -1; --i)
                        {
                            if (_pooledTweeners[i] != null)
                            {
                                continue;
                            }
                            _pooledTweeners[i] = t;
                            if (i < _minPooledTweenerId)
                            {
                                _minPooledTweenerId = i;
                            }
                            if (_maxPooledTweenerId < _minPooledTweenerId)
                            {
                                _maxPooledTweenerId = _minPooledTweenerId;
                            }
                            break;
                        }
                    }
                    totPooledTweeners++;
                    break;
                }
            }
            else
            {
                // Remove
                switch (t.tweenType)
                {
                case TweenType.Sequence:
                    totSequences--;
                    // Despawn sequenced tweens
                    Sequence s   = (Sequence)t;
                    int      len = s.sequencedTweens.Count;
                    for (int i = 0; i < len; ++i)
                    {
                        Despawn(s.sequencedTweens[i], false);
                    }
                    break;

                case TweenType.Tweener:
                    totTweeners--;
                    break;
                }
            }
            t.active = false;
            t.Reset();
        }
 public ReadOnlyCollection <SequenceSegment> FindSequenceSegmentsBySequence(TrackSolution trackSolution, Sequence sequence)
 {
     if (_sequenceSegments.ContainsKey(trackSolution.ID))
     {
         List <SequenceSegment> result = new List <SequenceSegment>();
         foreach (SequenceSegment seqSeg in _sequenceSegments[trackSolution.ID].Values.ToList())
         {
             if (seqSeg.SequenceID == sequence.ID)
             {
                 result.Add(seqSeg);
             }
         }
         return(result.AsReadOnly());
     }
     else
     {
         return(new List <SequenceSegment>().AsReadOnly());
     }
 }
        public void IntegerRangeTest()
        {
            // Int16 can accepts UInt8
            // Int32 can accepts UInt16
            // Int64 can accepts UInt32
            {
                var small       = new Sequence <byte>();
                var smallWriter = new MessagePackWriter(small);
                smallWriter.Write(byte.MaxValue);
                smallWriter.Flush();
                var smallReader = new MessagePackReader(small.AsReadOnlySequence);
                smallReader.ReadInt16().Is(byte.MaxValue);

                var target       = new Sequence <byte>();
                var targetWriter = new MessagePackWriter(target);
                targetWriter.Write((short)byte.MaxValue);
                targetWriter.Flush();
                target.AsReadOnlySequence.ToArray().SequenceEqual(small.AsReadOnlySequence.ToArray()).IsTrue();
            }

            {
                var small       = new Sequence <byte>();
                var smallWriter = new MessagePackWriter(small);
                smallWriter.Write(byte.MaxValue);
                smallWriter.Flush();
                var smallReader = new MessagePackReader(small.AsReadOnlySequence);
                smallReader.ReadInt32().Is(byte.MaxValue);

                var target       = new Sequence <byte>();
                var targetWriter = new MessagePackWriter(target);
                targetWriter.Write((int)byte.MaxValue);
                targetWriter.Flush();
                target.AsReadOnlySequence.ToArray().SequenceEqual(small.AsReadOnlySequence.ToArray()).IsTrue();

                small.Reset();
                smallWriter = new MessagePackWriter(small);
                smallWriter.Write(ushort.MaxValue);
                smallWriter.Flush();
                smallReader = new MessagePackReader(small.AsReadOnlySequence);
                smallReader.ReadInt32().Is(ushort.MaxValue);

                target.Reset();
                targetWriter = new MessagePackWriter(target);
                targetWriter.Write((int)ushort.MaxValue);
                targetWriter.Flush();
                target.AsReadOnlySequence.ToArray().SequenceEqual(small.AsReadOnlySequence.ToArray()).IsTrue();
            }

            {
                var small       = new Sequence <byte>();
                var smallWriter = new MessagePackWriter(small);
                smallWriter.Write(byte.MaxValue);
                smallWriter.Flush();
                var smallReader = new MessagePackReader(small.AsReadOnlySequence);
                smallReader.ReadInt64().Is(byte.MaxValue);

                var target       = new Sequence <byte>();
                var targetWriter = new MessagePackWriter(target);
                targetWriter.Write((long)byte.MaxValue);
                targetWriter.Flush();
                target.AsReadOnlySequence.ToArray().SequenceEqual(small.AsReadOnlySequence.ToArray()).IsTrue();

                small.Reset();
                smallWriter = new MessagePackWriter(small);
                smallWriter.Write(ushort.MaxValue);
                smallWriter.Flush();
                smallReader = new MessagePackReader(small.AsReadOnlySequence);
                smallReader.ReadInt64().Is(ushort.MaxValue);

                target.Reset();
                targetWriter = new MessagePackWriter(target);
                targetWriter.Write((long)ushort.MaxValue);
                targetWriter.Flush();
                target.AsReadOnlySequence.ToArray().SequenceEqual(small.AsReadOnlySequence.ToArray()).IsTrue();

                small.Reset();
                smallWriter = new MessagePackWriter(small);
                smallWriter.Write(uint.MaxValue);
                smallWriter.Flush();
                smallReader = new MessagePackReader(small.AsReadOnlySequence);
                smallReader.ReadInt64().Is(uint.MaxValue);

                target.Reset();
                targetWriter = new MessagePackWriter(target);
                targetWriter.Write((long)uint.MaxValue);
                targetWriter.Flush();
                target.AsReadOnlySequence.ToArray().SequenceEqual(small.AsReadOnlySequence.ToArray()).IsTrue();
            }
        }
示例#42
0
    void Construct()
    {
        this.textResultTime        = this.gameObject.transform.Find("TextResultTime").GetComponent <TextMeshProUGUI>();
        this.textNewRecord         = this.gameObject.transform.Find("TextNewRecord").GetComponent <TextMeshProUGUI>();
        this.textNewRecord.enabled = false;

        this.OnEnableAsObservable()
        .Select(_ => (this.gameMain.time.Value < this.gameMain.shortestTime.Value ||
                      this.gameMain.shortestTime.Value < Mathf.Epsilon))
        .Subscribe(isShortest => {
            Debug.Log("UIFinishController.OnEnableAsObservable(): time=" + this.gameMain.time.Value +
                      ", shortestTime=" + this.gameMain.shortestTime.Value + ", isShortest=" + isShortest.ToString());

            this.rawImageResult.texture = this.screenShotController.textureScreenShot;

            this.textNewRecord.enabled = isShortest;
            if (isShortest)
            {
                this.gameMain.uiFadeIn(this.inputName);
                this.gameMain.uiFadeIn(this.buttonRegister);
                this.sequenceBlink.Play();
            }
            else
            {
                this.gameMain.uiFadeOut(this.inputName, 0.0f);
                this.gameMain.uiFadeOut(this.buttonRegister, 0.0f);
            }
        });

        this.buttonTwitter.OnClickAsObservable()
        .Subscribe(_ => {
            var t        = this.gameMain.time.Value;
            var hashTags = new string[] { "unity1week", };
            UnityRoomTweet.Tweet("landingspace", string.Format("こちら着陸スペース、{0:F2}秒で着陸しましたオーバー。", t), hashTags);
        });
        this.buttonRegister.OnClickAsObservable()
        .Subscribe(_ => {
            var typeInput       = PlayerPrefs.GetInt("PlayerInput", (int)(GameMain.InputType.RotateByLeftRight));
            var bytesScreenShot = this.screenShotController.textureScreenShot.EncodeToPNG();
            StartCoroutine(this.leaderBoardManager.SendScore(this.inputName.text, this.gameMain.time.Value, typeInput, bytesScreenShot, false));
            this.gameMain.uiFadeOut(this);
            this.gameMain.title();
        });

        this.buttonBack.OnClickAsObservable()
        .Subscribe(_ => {
            sequenceBlink.Pause();
            sequenceBlink.Rewind();
            this.textNewRecord.enabled = false;
            this.gameMain.uiFadeOut(this);
            this.gameMain.title();
        });

        this.gameMain.time.Subscribe(_ => {
            this.textResultTime.text = string.Format("{0:F2}", this.gameMain.time.Value);
        });

        this.sequenceBlink = DOTween.Sequence();
        sequenceBlink.Append(this.textNewRecord.DOFade(0.0f, 0.1f));
        sequenceBlink.Append(this.textNewRecord.DOFade(1.0f, 0.1f));
        sequenceBlink.SetLoops(-1);
    }
    void TakePicture()
    {
        //clear the list
        currentPlayerScores.Clear();

        RaycastHit hit;

        //populate the list with the players and their distance to the camera
        for (int i = 0; i < allPlayers.Length; i++)
        {
            allPlayers[i].canMove = false;

            Vector3     camPos    = cameraPivot.GetChild(2).position;
            Vector3     playerPos = allPlayers[i].transform.position;
            PlayerScore score     = new PlayerScore()
            {
                id = i
            };
            score.distance = Vector3.Distance(playerPos, camPos);
            score.position = playerPos;

            //raycast logic
            if (Physics.Raycast(camPos, (allPlayers[i].transform.position - camPos) + Vector3.up, out hit, 5, playerLayer))
            {
                if (hit.transform == allPlayers[i].transform)
                {
                    score.cameraVisible = true;
                }
            }

            if (!allPlayers[i].insideCameraTrigger)
            {
                score.cameraVisible = false;
            }

            if (score.cameraVisible)
            {
                currentPlayerScores.Add(score);
            }
        }

        //order the list based on the players distance to the camera
        currentPlayerScores = currentPlayerScores.OrderBy(s => s.distance).ToList();

        //add to the final score list based on the order of the current list
        for (int i = 0; i < currentPlayerScores.Count; i++)
        {
            PlayerScore player      = finalPlayerScores.Find(x => x.id == currentPlayerScores[i].id);
            int         playerIndex = finalPlayerScores.IndexOf(player);
            player.score += possibleScores[i];
            finalPlayerScores[playerIndex] = player;
        }

        //stop agents from moving
        SetAgentsDestination(Vector3.zero, true);

        cameraLight.DOIntensity(350, .02f).OnComplete(() => cameraLight.DOIntensity(0, .05f));
        cameraLight.transform.parent.DOPunchScale(Vector3.one / 3, .5f, 10, 1);

        WaitForSeconds    intervalWait = new WaitForSeconds(.1f);
        WaitForEndOfFrame frameWait    = new WaitForEndOfFrame();

        StartCoroutine(TakePhoto());

        IEnumerator TakePhoto()
        {
            yield return(intervalWait);

            renderTextureCamera.gameObject.SetActive(true);

            SetPhotoScorePosition(true);

            yield return(frameWait);

            renderTextureCamera.gameObject.SetActive(false);

            Sequence s = DOTween.Sequence();

            s.Append(pictureInterface.DOScale(1, .4f).SetEase(Ease.OutBounce));
            s.AppendInterval(1);
            for (int i = 0; i < currentPlayerScores.Count; i++)
            {
                if (i > 2)
                {
                    break;
                }
                s.Join(pictureScoreTextHolder.GetChild(i).DOScale(1, .2f).SetEase(Ease.OutBack));
            }
            s.AppendInterval(1);
            for (int i = 0; i < currentPlayerScores.Count; i++)
            {
                if (i > 2)
                {
                    break;
                }
                s.Join(pictureScoreTextHolder.GetChild(i).DOMove(playerScoreTextHolder.GetChild(currentPlayerScores[i].id).position, .4f)
                       .OnComplete(() => UpdateScore()));
            }
            s.Append(pictureInterface.DOScale(0, .4f).SetEase(Ease.InBack));
            s.AppendCallback(() => SetPhotoScorePosition(false));
        }
    }
    void BehaviorTree()
    {
        root = new Selector();

        //First two sequences
        Sequence sequenceLeft = new Sequence();

        sequenceLeft.parent = root;
        root.children.Add(sequenceLeft);

        Sequence sequenceRight = new Sequence();

        sequenceRight.parent = root;
        root.children.Add(sequenceRight);



        //Left sequence
        WalkToDoor walkToDoor = new WalkToDoor();

        walkToDoor.success = false;
        walkToDoor.parent  = sequenceLeft;
        sequenceLeft.children.Add(walkToDoor);

        Selector selectorLeft = new Selector();

        selectorLeft.parent = sequenceLeft;
        sequenceLeft.children.Add(selectorLeft);

        WalkThroughDoor walkThroughDoor = new WalkThroughDoor();

        walkThroughDoor.success = true;
        walkThroughDoor.parent  = sequenceLeft;
        sequenceLeft.children.Add(walkThroughDoor);

        CloseDoor closeDoor = new CloseDoor();

        closeDoor.success = true;
        closeDoor.parent  = sequenceLeft;
        sequenceLeft.children.Add(closeDoor);

        //Selector Left
        OpenDoor openDoor = new OpenDoor();

        openDoor.success = false;
        openDoor.parent  = selectorLeft;
        selectorLeft.children.Add(openDoor);

        Sequence sequenceLeftTwo = new Sequence();

        sequenceLeftTwo.parent = selectorLeft;
        selectorLeft.children.Add(sequenceLeftTwo);

        SmashDoor smashDoor = new SmashDoor();

        smashDoor.success = true;
        smashDoor.parent  = selectorLeft;
        selectorLeft.children.Add(smashDoor);

        //Sequence Left Two
        UnlockDoor unlockDoor = new UnlockDoor();

        unlockDoor.success = false;
        unlockDoor.parent  = sequenceLeftTwo;
        sequenceLeftTwo.children.Add(unlockDoor);

        OpenDoor openDoor2 = new OpenDoor();

        openDoor2.success = true;
        openDoor2.parent  = sequenceLeftTwo;
        sequenceLeftTwo.children.Add(openDoor2);



        //Right Sequence
        WalkToWindow walkToWindow = new WalkToWindow();

        walkToWindow.success = true;
        walkToWindow.parent  = sequenceRight;
        sequenceRight.children.Add(walkToWindow);

        Selector selectorRight = new Selector();

        selectorRight.parent = sequenceRight;
        sequenceRight.children.Add(selectorRight);

        ClimbThroughWindow climbThroughWindow = new ClimbThroughWindow();

        climbThroughWindow.success = true;
        climbThroughWindow.parent  = sequenceRight;
        sequenceRight.children.Add(climbThroughWindow);

        CloseWindow closeWindow = new CloseWindow();

        closeWindow.success = true;
        closeWindow.parent  = sequenceRight;
        sequenceRight.children.Add(closeWindow);


        //Selector Right
        OpenWindow openWindow = new OpenWindow();

        openWindow.success = false;
        openWindow.parent  = selectorRight;
        selectorRight.children.Add(openWindow);

        Sequence sequenceRightTwo = new Sequence();

        sequenceRightTwo.parent = selectorRight;
        selectorRight.children.Add(sequenceRightTwo);

        SmashWindow smashWindow = new SmashWindow();

        smashWindow.success = true;
        smashWindow.parent  = selectorRight;
        selectorRight.children.Add(smashWindow);


        //Sequence Right Two
        UnlockWindow unlockWindow = new UnlockWindow();

        unlockWindow.success = true;
        unlockWindow.parent  = sequenceRightTwo;
        sequenceRightTwo.children.Add(unlockWindow);

        OpenWindow openWindow2 = new OpenWindow();

        openWindow2.success = true;
        openWindow2.parent  = sequenceRightTwo;
        sequenceRightTwo.children.Add(openWindow2);
    }
 /// <summary>
 /// Adds a sequence to the sequence group after threads have started to publish to
 /// the Disruptor.It will set the sequences to cursor value of the ringBuffer
 /// just after adding them.  This should prevent any nasty rewind/wrapping effects.
 /// </summary>
 /// <param name="cursored">The data structure that the owner of this sequence group will be pulling it's events from</param>
 /// <param name="sequence">The sequence to add</param>
 public void AddWhileRunning(ICursored cursored, Sequence sequence)
 {
     SequenceGroups.AddSequences(ref _sequences, cursored, sequence);
 }
示例#46
0
 public void TestSequence1()
 {
     Sequence.Execute("Test sequence 1", Action1);
     Assert.IsTrue(Action1Executed);
 }