Beispiel #1
0
 void CreateObject(float randomTime, int randomPowerup)
 {
     GameObject instance = Instantiate((Object)power_up_prefabs[randomPowerup]) as GameObject;
     PositionHelper ph = new PositionHelper();
     Vector3 position = ph.GenerateStartingPosition();
     instance.transform.position = position;
     instance.transform.localScale += new Vector3(1, 1, 1);
     instance.AddComponent<Rigidbody2D>();
     instance.AddComponent<CircleCollider2D>();
     CircleCollider2D cc = instance.GetComponent<CircleCollider2D>();
     cc.isTrigger = true;
     Rigidbody2D rb = instance.GetComponent<Rigidbody2D>();
     rb.gravityScale = 0;
     rb.constraints = RigidbodyConstraints2D.FreezePositionX | RigidbodyConstraints2D.FreezeRotation;
     rb.AddForce(new Vector3(0f, 150f, 0f));
     power_ups.Add(instance);
     Invoke("InitializeObject", randomTime);
 }
        public override Task <CommandOrCodeActionContainer> Handle(CodeActionParams request, CancellationToken cancellationToken)
        {
            var documentUri        = request.TextDocument.Uri;
            var compilationContext = this.compilationManager.GetCompilation(documentUri);

            if (compilationContext == null)
            {
                return(Task.FromResult(new CommandOrCodeActionContainer()));
            }

            var requestStartOffset = PositionHelper.GetOffset(compilationContext.LineStarts, request.Range.Start);
            var requestEndOffset   = request.Range.Start != request.Range.End
                ? PositionHelper.GetOffset(compilationContext.LineStarts, request.Range.End)
                : requestStartOffset;

            var compilation = compilationContext.Compilation;
            var diagnostics = compilation.GetEntrypointSemanticModel().GetAllDiagnostics();

            var quickFixes = diagnostics
                             .Where(fixable =>
                                    fixable.Span.ContainsInclusive(requestStartOffset) ||
                                    fixable.Span.ContainsInclusive(requestEndOffset) ||
                                    (requestStartOffset <= fixable.Span.Position && fixable.GetEndPosition() <= requestEndOffset))
                             .OfType <IFixable>()
                             .SelectMany(fixable => fixable.Fixes.Select(fix => CreateQuickFix(request.TextDocument.Uri, compilationContext, fix)));

            List <CommandOrCodeAction> commandOrCodeActions = new();

            commandOrCodeActions.AddRange(quickFixes);

            var analyzerDiagnostics = diagnostics
                                      .Where(analyzerDiagnostic =>
                                             analyzerDiagnostic.Span.ContainsInclusive(requestStartOffset) ||
                                             analyzerDiagnostic.Span.ContainsInclusive(requestEndOffset) ||
                                             (requestStartOffset <= analyzerDiagnostic.Span.Position && analyzerDiagnostic.GetEndPosition() <= requestEndOffset))
                                      .OfType <AnalyzerDiagnostic>()
                                      .Select(analyzerDiagnostic => DisableLinterRule(documentUri, analyzerDiagnostic.Code, compilation.Configuration.ConfigurationPath));

            commandOrCodeActions.AddRange(analyzerDiagnostics);

            return(Task.FromResult(new CommandOrCodeActionContainer(commandOrCodeActions)));
        }
Beispiel #3
0
 void MoveWall()
 {
     foreach(GameObject wall_parent in wall_parents)
     {
         Wall wall = wall_parent.GetComponentInChildren<Wall>();
         if (!wall.IsMoving)
         {
             Rigidbody2D rb = wall_parent.GetComponent<Rigidbody2D>();
             PositionHelper ph = new PositionHelper();
             Vector3 position = ph.GenerateStartingPosition();
             wall_parent.transform.position = position;
             rb.velocity = new Vector3();
             wall.ScaleWall(position);
             wall.IsMoving = true;
             rb.AddForce(new Vector3(0f, 100f, 0f));
             GameObject instance = Instantiate(spike) as GameObject;
             instance.name = "SpikeBase";
             instance.transform.SetParent(wall_parent.transform, false);
             break;
         }
     }
 }
Beispiel #4
0
        private void GetTimes()
        {
            var sellerId   = GetInt("sellerId");
            var positionId = GetInt("positionId");
            var list       = PositionHelper.GetTimeLines(positionId);

            JsonTransfer jt      = new JsonTransfer();
            var          results = new List <object>();

            foreach (var item in list)
            {
                results.Add(new
                {
                    Id    = item.Id,
                    Title = item.Title,
                    Time  = item.BeginTime.ToString("HH:mm") + "--" + item.EndTime.ToString("HH:mm")
                });
            }
            jt.Add("data", results);
            Response.Write(DesEncrypt(jt));
            Response.End();
        }
Beispiel #5
0
        private string GetHtml()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(@"<div id=""");
            sb.Append(Id);
            sb.Append(@""" style=""");
            sb.Append(PositionHelper.CreateStyle(Position, -1, -1));
            sb.Append(@"""> <div> Enter some markup:<br/> <textarea id=""");
            sb.Append(Id);
            sb.Append(@"_DynamicMarkupInput"" rows=""10"" cols=""80""> <div style=""background-color: red""> <control type=""Saltarelle.UI.Label"" Text=""str:Label text""/> <div> Some text </div> </div> </textarea> <br/> <button type=""button"" id=""");
            sb.Append(Id);
            sb.Append(@"_InsertDynamicControlButton"">Insert Control</button> </div> <div id=""");
            sb.Append(Id);
            sb.Append(@"_DynamicControlContainer"">&nbsp;</div> <div> Number of rows: <input type=""text"" id=""");
            sb.Append(Id);
            sb.Append(@"_NumRowsInput"" value=""0"" style=""width: 50px""/> <button type=""button"" id=""");
            sb.Append(Id);
            sb.Append(@"_AjaxButton"">Create grid using Ajax</button> </div> <div id=""");
            sb.Append(Id);
            sb.Append(@"_AjaxControlContainer"">&nbsp;</div> </div>");
            return(sb.ToString());
        }