public CensorCapability(ConsumedCapability interceptedCapability, IInterceptionPolicy policy) { InterceptedCapability = interceptedCapability; interceptedCapability.AddRef(); Policy = policy; MyVine = Vine.Create(this); }
public HttpResponseMessage GetVine(string url) { string htmlString = VineScopeHtmlRequester(url); if (htmlString == null) { return(this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Server is down")); } var htmlDocument = new HtmlDocument(); htmlDocument.LoadHtml(htmlString); var indexVideoNode = htmlDocument.GetElementbyId("container").SelectSingleNode("div"); Vine vine = null; try { vine = Vine.Parse(indexVideoNode); vine.Url = VineScopeUrl + url; } catch (Exception) { return(this.Request.CreateErrorResponse(HttpStatusCode.NotFound, "Item was not found")); } return(this.Request.CreateResponse(HttpStatusCode.OK, vine)); }
public override TileElement GenerateTileElement(params object[] vars) { Vine v = new Vine(vars); v.SetPhysics(true, false, true, false); return(v); }
public static void ExportAsSenderPromise <T>(this T cap, IRpcEndpoint endpoint, CapDescriptor.WRITER writer) where T : ConsumedCapability, IResolvingCapability { var vine = Vine.Create(cap); uint preliminaryId = endpoint.AllocateExport(vine, out bool first); writer.which = CapDescriptor.WHICH.SenderPromise; writer.SenderPromise = preliminaryId; if (first) { endpoint.RequestPostAction(async() => { try { var resolvedCap = await cap.WhenResolved; endpoint.Resolve(preliminaryId, vine, () => resolvedCap.ConsumedCap !); } catch (System.Exception exception) { endpoint.Resolve(preliminaryId, vine, () => throw exception); } }); } }
private void UpdateControls() { Vector2 velocity = _rigidBody.velocity; float ySpeed = velocity.y; var groundCheck = CapsuleCast(new Vector2(0.9f, 1), Vector2.down, 0.2f); Grounded = groundCheck.collider != null && ySpeed <= 0; if (!Grounded) { _animator.SetFloat("ySpeed", ySpeed); } else if (currentVine != null) { currentVine = null; //Allows gorilla to hold again on the same vine if he hit the ground canMove = true; } if (canMove) { velocity.x = _controls.inputX * movementSpeed; Vector2 pos = _capsuleCollider.offset + Vector2.up * 0.1f; if (velocity.x < 0) { pos.x *= -1; } if (Mathf.Abs(velocity.x) > 0) { var result = CapsuleCast(Vector2.one, Vector2.right * velocity.x, 0.2f); if (result.collider != null && !result.collider.isTrigger) { velocity.x = 0; } } } if ((velocity.x < 0 && FacingRight) || (velocity.x > 0 && !FacingRight)) { FacingRight = !FacingRight; transform.localScale = new Vector3(FacingRight ? 1 : -1, 1, 1); } _animator.SetBool("moving", velocity.x != 0); if (transform.position.y < dieY) { dead = true; velocity.x = 0; if (onDie != null) { onDie(); } } _rigidBody.velocity = velocity; }
public void HandleSpan(MessageSink messageSink, MessageActionSpan actionSpan) { var vineid = actionSpan.Match.Groups[2].ToString(); var vine = new Vine(vineid); messageSink("Vine: " + vine.Title + " By: " + vine.Author); }
void NextWave() { Vine.SetMaxSplits(10); if (WaveNumber < Fib.Length) { SpawnVineRoots(Fib[WaveNumber]); WaveNumber++; } }
public Vine RetrieveVine(string permalink, string submitter = null) { Vine vine = new Vine() { Permalink = permalink, Submitter = submitter }; // Get the vine code int startIndex = vine.Permalink.IndexOf("v/") + 2; int endIndex = vine.Permalink.Length; for (int i = startIndex; i < vine.Permalink.Length; i++) { char character = vine.Permalink[i]; if (!Char.IsLetterOrDigit(character)) { endIndex = i; break; } } string videoCode = vine.Permalink.Substring(startIndex, endIndex - startIndex); ScrapingBrowser browser = new ScrapingBrowser(); WebResource jsonResource = null; var task = Task.Run(() => { jsonResource = browser.DownloadWebResource(new Uri("https://archive.vine.co/posts/" + videoCode + ".json")); }); bool isSuccess; try { isSuccess = task.Wait(TimeSpan.FromMilliseconds(2000)); } catch (Exception e) { return(vine); } if (isSuccess) { JArray objects = JArray.Parse("[" + jsonResource.GetTextContent() + "]"); vine.Description = objects.First["description"].ToString(); vine.VideoUrl = objects.First["videoUrl"].ToString(); vine.ThumbnailUrl = objects.First["thumbnailUrl"].ToString(); vine.Created = DateTime.Parse(objects.First["created"].ToString()); vine.Loops = FormatNumber(Int32.Parse(objects.First["loops"].ToString())); vine.Likes = FormatNumber(Int32.Parse(objects.First["likes"].ToString())); vine.Username = objects.First["username"].ToString(); vine.Rating = 0; } return(vine); }
public PartialViewResult GetVine(Vine data) { VineViewModel viewModel = new VineViewModel() { Vine = RetrieveVine(data.Permalink, data.Submitter), Position = Position.None }; return(PartialView("_VineView", viewModel)); }
public static void AddVine(Vine vine) { using (IDbConnection connection = new SqlConnection(CnnStr)) { string sql = "INSERT INTO Vine (Description, VideoUrl, Created, Permalink, Loops, Likes, Username, Rating, Submitter, ThumbnailUrl) " + "VALUES (@Description, @VideoUrl, @Created, @Permalink, @Loops, @Likes, @Username, @Rating, @Submitter, @ThumbnailUrl)"; connection.Execute(sql, vine); } }
internal override void Export(IRpcEndpoint endpoint, CapDescriptor.WRITER capDesc) { if (endpoint == _ep) { capDesc.which = CapDescriptor.WHICH.ReceiverHosted; capDesc.ReceiverHosted = _remoteId; } else { capDesc.which = CapDescriptor.WHICH.SenderHosted; capDesc.SenderHosted = endpoint.AllocateExport(Vine.Create(this), out var _); } }
private void SpawnVine(Shade vineColor, Vector3Int stemCoords, Vector3Int vineCoords, Vector3Int direction) { TileElement[,,] board = WorldManager.current.board; TileElement tileAtPos = board[vineCoords.x, vineCoords.y, vineCoords.z]; Vine vine = (Vine)Constants.TILE_MODELS[(int)TileElementNames.Vine].GenerateTileElement(new object[] { vineCoords, vineColor, Constants.VectorToFacet(-direction) }); undoData.Push(new Stack <BoardStateChange>()); if (tileAtPos != null && tileAtPos.Pushable && !tileAtPos.Weedblocked && !(tileAtPos is IMonoSpacious)) { if (!tileAtPos.InitiatePush(board, Constants.VectorToFacet(direction), vine)) { undoData.Pop(); return; } } else if (tileAtPos == null) { tileAtPos = vine; } else { return; } board[vineCoords.x, vineCoords.y, vineCoords.z] = vine; tileAtPos.model = Instantiate(Resources.Load("Models/Vine")) as GameObject; tileAtPos.model.transform.GetChild(0).gameObject.GetComponent <MeshRenderer>().material.color = WorldManager.current.palette[(int)vine.GetColor()]; tileAtPos.BindDataToModel(); tileAtPos.AdjustRender(); tileAtPos.WarpToPos(); StartCoroutine(GrowVine((Vine)tileAtPos)); if (tracedVine.gameObject.GetComponent <ColoredMeshBridge>().data is Vine) { ((Vine)(board[stemCoords.x, stemCoords.y, stemCoords.z])).SetVine((Vine)tileAtPos); } tracedVine = tileAtPos.model.transform.GetChild(1); AddUndoData(new BoardCreationState(vine)); AdjustAvailableVinesUI(vineColor, -1); CameraManager.current.ShakeCamera(0.1f, 3f); }
public ActionResult AddVine(Vine model) { // check if there actually is a vine to add Vine vine = RetrieveVine(model.Permalink, model.Submitter); // Add the vine if a vine was retrieved and if it doesnt already exist if (vine.VideoUrl != null && !DataAccess.DataAccess.VineExists(vine.Permalink)) { DataAccess.DataAccess.AddVine(vine); } return(RedirectToAction("Index", "Home")); }
private static bool IsPossibleFromVine(Vine currentVine, long curDistance, long curLength, long distanceLove, List <Vine> vines) { if (curDistance + 2 * curLength >= distanceLove) { return(true); } foreach (var vine in vines.Where(n => n.Distance > currentVine.Distance && n.Distance <= curDistance + 2 * curLength)) { if (IsPossibleFromVine(vine, currentVine.Distance + Math.Max((vine.Distance - currentVine.Distance - vine.Length), 0), Math.Min(vine.Length, vine.Distance - currentVine.Distance), distanceLove, vines)) { return(true); } } return(false); }
void OnInspectorGUI() { Vine vine = target as Vine; vine.disablePhysics = GUILayout.Toggle(vine.disablePhysics, "Flag"); if (vine.disablePhysics) { //vine.segmentPrefab = EditorGUILayout. vine.segmentCount = EditorGUILayout.IntField(vine.segmentCount); vine.segmentSpacing = EditorGUILayout.FloatField(vine.segmentSpacing); //public GameObject segmentPrefab; //public int segmentCount; //public float segmentSpacing; } //vine.i = EditorGUILayout.IntSlider("I field:", vine.i, 1, 100); }
public HttpResponseMessage GetRandom() { string htmlString = VineScopeHtmlRequester("random.php"); if (htmlString == null) { return(this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Server is down")); } var htmlDocument = new HtmlDocument(); htmlDocument.LoadHtml(htmlString); var indexVideoNode = htmlDocument.GetElementbyId("container").SelectSingleNode("div"); Vine vine = Vine.Parse(indexVideoNode); vine.Url = Vine.GetUrl(vine); return(this.Request.CreateResponse(HttpStatusCode.OK, vine)); }
private IEnumerator GrowVine(Vine vine) { float t = Time.time; vine.model.transform.GetChild(0).localScale = new Vector3( Constants.VINE_STRETCHES[(int)vine.GetOrigin()].x == 1 ? 1 : 0, Constants.VINE_STRETCHES[(int)vine.GetOrigin()].y == 1 ? 1 : 0, Constants.VINE_STRETCHES[(int)vine.GetOrigin()].z == 1 ? 1 : 0); vine.model.transform.GetChild(0).localPosition = Constants.VINE_STARTS[(int)vine.GetOrigin()]; while (Time.time - t < 0.1f) { if (vine.model != null) { vine.model.transform.GetChild(0).localScale = Vector3.Lerp(vine.model.transform.GetChild(0).localScale, Constants.VINE_STRETCHES[(int)vine.GetOrigin()], 0.2f); vine.model.transform.GetChild(0).localPosition = Vector3.Lerp(vine.model.transform.GetChild(0).localPosition, Constants.VINE_ANCHORS[(int)vine.GetOrigin()], 0.2f); } yield return(null); } vine.model.transform.GetChild(0).localScale = Constants.VINE_STRETCHES[(int)vine.GetOrigin()]; vine.model.transform.GetChild(0).localPosition = Constants.VINE_ANCHORS[(int)vine.GetOrigin()]; }
public HttpResponseMessage Get() { string htmlString = VineScopeHtmlRequester(); if (htmlString == null) { return(this.Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Server is down")); } var htmlDocument = new HtmlDocument(); htmlDocument.LoadHtml(htmlString); var indexVideoNode = htmlDocument.GetElementbyId("container").SelectSingleNode("div"); VineThumbnail indexMainVine = Vine.Parse(indexVideoNode); indexMainVine.Url = Vine.GetUrl(indexMainVine); var vines = new List <VineThumbnail>(); vines.Add(indexMainVine); var featuredVinesNodes = htmlDocument.GetElementbyId("container") .SelectNodes("div/div/div") .Where(n => n.Attributes["class"] != null && n.Attributes["class"].Value == "thumb-list") .FirstOrDefault() .SelectNodes("article"); foreach (var node in featuredVinesNodes) { var vine = VineThumbnail.Parse(node); vine.Url = vine.Url.Substring(vine.Url.LastIndexOf("/") + 1); vines.Add(vine); } return(this.Request.CreateResponse(HttpStatusCode.OK, vines)); }
public bool SetOnVine(Vine v) { if (currentVine == v || onVine) { return(false); } transform.parent = v.transform; transform.localEulerAngles = Vector3.zero; Vector3 pos = transform.localPosition; pos.x = -_vinePosition.localPosition.x * (FacingRight ? 1 : -1); transform.localPosition = pos; _rigidBody.isKinematic = true; _rigidBody.velocity = Vector2.zero; currentVine = v; onVine = true; _animator.SetBool("vine", true); return(true); }
IEnumerator SpawnVine() { GameObject v = Instantiate(vineObject); Vine vine = v.GetComponentInChildren <Vine>(); spawnedVines.Add(v); GameObject vChild = vine.vine; int r = Random.Range(0, 2); if (r == 0) { v.transform.position = new Vector3(GameManager.gm.player.transform.position.x + (GameManager.gm.playerRB.velocity.normalized.x * 15), 0f, GameManager.gm.player.transform.position.z + (GameManager.gm.playerRB.velocity.normalized.z * 15)); } else { v.transform.position = new Vector3(GameManager.gm.player.transform.position.x, 0, GameManager.gm.player.transform.position.z); } vChild.transform.localPosition = new Vector3(0, -0.4f, 0); PlaySound(spawnVine, spawnVineVolume, vine.transform.position); yield return(new WaitForSeconds(Mathf.Max(0.5f, vineAttackSpeed * ((GetHealthPercentage() + 0.01f))))); PlaySound(vineGroundBreak, vineGroundBreakVolume, vine.transform.position); while (vChild.transform.position.y < 0f) { vChild.transform.localPosition = new Vector3(0, vChild.transform.localPosition.y + Mathf.Max(0.5f, vineAttackSpeed * ((GetHealthPercentage() + 0.01f))), 0); yield return(null); } vChild.transform.localPosition = new Vector3(0, 0f, 0); yield return(new WaitForSeconds(vineAttackSpeed * 0.1f)); vine.hasLift = false; yield return(new WaitForSeconds(vineAttackSpeed * 1.9f)); spawnedVines.Remove(v); Destroy(v); }
public void SetVine(Vine _next) { next = _next; }