/// <summary> /// A method to generate placard objects for each of the placards received. /// </summary> void GeneratePlacards() { int count = 0; foreach (Placard p in placards) { count++; Placard placard = p; //capture the iterator; otherwise you always get last placard if (!nonMovingPlacardIDs.Contains(placard.id)) { GameObject newPlacard = (GameObject)Instantiate(placardPrefab, Vector3.zero, Quaternion.identity); newPlacard.transform.position = GeographicManager.Instance.GetPosition(placard.location.latitude, placard.location.longitude, placard.location.elevation); newPlacard.transform.rotation.eulerAngles.Set(0f, (float)placard.location.orientation, 0f); newPlacard.GetComponent <RectTransform>().SetParent(transform, true); newPlacard.GetComponent <PlacardObject>().placard = placard; newPlacard.GetComponent <Text>().text = "#" + count; placardObjects.Add(newPlacard); EventTrigger trigger = newPlacard.GetComponent <EventTrigger>(); EventTrigger.Entry entry = new EventTrigger.Entry(); entry.eventID = EventTriggerType.PointerClick; entry.callback.AddListener((e) => { drupalUnityIO.SelectPlacard(placard); }); trigger.triggers.Add(entry); } } }
/// <summary> /// A callback called when the Drupal Unity Interface selects a placard. /// </summary> /// <param name="placard"> /// The selected placard. /// </param> void OnPlacardWasSelected(Placard placard) { if (OnPlacardSelected != null) { OnPlacardSelected.Invoke(placard); } }
// public dynamic GetModel(int Id) { try { dynamic model = null; StringBuilder strSql = new StringBuilder(); strSql.Append(" select Id,PlacardTitle,PlacardContent,Publisher,ReleaseTime,NumClicks,DepName from T_Placard "); strSql.Append(" where Id=@Id"); SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.Int, 4) }; parameters[0].Value = Id; using (dynamic read = DbHelperSQL.ExecuteReader(strSql.ToString(), parameters)) { if (read.Read()) { model = new Placard(); try { model.Id = int.Parse(read["Id"].ToString()); } catch { } model.PlacardTitle = read["PlacardTitle"].ToString(); model.PlacardContent = read["PlacardContent"].ToString(); model.Publisher = read["Publisher"].ToString(); try { model.ReleaseTime = DateTime.Parse(read["ReleaseTime"].ToString()); } catch { } try { model.NumClicks = int.Parse(read["NumClicks"].ToString()); } catch { } model.DepName = read["DepName"].ToString(); } read.Dispose(); } return(model); } catch { throw; } }
public async Task <IActionResult> Post([FromForm] PlacardResourse placardModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState.GetErrorMessages())); } if (placardModel == null) { return(BadRequest("Placard object is null")); } var placard = new Placard() { CreatedDate = DateTime.Now.ToLocalTime().ToString() }; if (placardModel.Picture != null) { placard.Picture = placardModel.Picture.ConvertToByteArray(); } var resources = _mapper.Map(placardModel, placard); await _placardService.AddPlacardAsync(resources); return(Ok()); }
/// <summary> /// A method to open a placard info window. /// </summary> /// <param name="placard"> /// The placard. /// </param> public void OpenPlacardInfoWindow(Placard placard) { placardWindow.SetActive(true); placardTitleText.text = placard.title; placardDescriptionText.text = placard.description; placardTeleportButton.interactable = placard.location != null; placardTeleportButton.onClick.AddListener(() => TeleportPlayerToPlacardLocation(placard)); }
/// <summary> /// A method to teleport the local player to the placard location. /// </summary> /// <param name="placard"> /// The placard. /// </param> public void TeleportPlayerToPlacardLocation(Placard placard) { //if (!GetComponent<PlacardManager>().nonMovingPlacardIDs.Contains(placard.id)) { Transform localPlayer = GameObject.FindGameObjectWithTag("LocalPlayer").transform; localPlayer.position = GeographicManager.Instance.GetPosition(placard.location.latitude, placard.location.longitude, placard.location.elevation); localPlayer.rotation = Quaternion.Euler(0f, (float)placard.location.orientation, 0f); //} }
/// <summary> /// A callback called when the Drupal Unity Interface selects a placard. /// </summary> /// <param name="placard"> /// The selected placard. /// </param> void OnPlacardSelected(Placard placard) { if (IsValidPlacardID(placard.id)) { OnValidPlacard.Invoke(); } else { OnInvalidPlacard.Invoke(); } }
/// <summary> /// A callback called when a placard is selected in the Drupal Unity Interface. /// </summary> /// <param name="placard"> /// The selected placard. /// </param> void OnPlacardSelected(Placard placard) { destination = GeographicManager.Instance.GetPosition(placard.location.latitude, placard.location.longitude, placard.location.elevation); orientation = (float)placard.location.orientation; if (!GameObject.FindWithTag("PlacardManager").GetComponent <PlacardManager>().nonMovingPlacardIDs.Contains(placard.id)) { if (!isMoving) { StartCoroutine(DoMove()); } } }
/// <summary> /// A method to create a placard. /// </summary> public void CreatePlacard() { Placard newPlacard = new Placard(); newPlacard.location = new Location(); newPlacard.title = titleInput.text; newPlacard.description = descriptionInput.text; newPlacard.location.latitude = float.Parse(latitudeInput.text); newPlacard.location.longitude = float.Parse(longitudeInput.text); newPlacard.location.elevation = float.Parse(elevationInput.text); newPlacard.location.orientation = (float.Parse(orientationInput.text)); drupalIO.AddPlacard(newPlacard); }
// private dynamic GetModels(HttpContext context) { dynamic model = new Placard(); try { model.Id = int.Parse(context.Request.Form["Id"].ToString()); } catch { } model.PlacardTitle = context.Request.Form["PlacardTitle"].ToString(); model.PlacardContent = context.Request.Form["PlacardContent"].ToString(); model.Publisher = adminUser.AdminName; try { model.ReleaseTime = DateTime.Parse(context.Request.Form["ReleaseTime"].ToString()); } catch { } try { model.NumClicks = int.Parse(context.Request.Form["NumClicks"].ToString()); } catch { } model.DepName = context.Request.Form["DepName"].ToString(); return(model); }
public bool Create(Placard model) { try { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into T_Placard("); strSql.Append("PlacardTitle,PlacardContent,Publisher,ReleaseTime,NumClicks,DepName)"); strSql.Append(" values ("); strSql.Append("@PlacardTitle,@PlacardContent,@Publisher,@ReleaseTime,@NumClicks,@DepName)"); if (DbHelperSQL.ExecuteSql(strSql.ToString(), GetSqlParameter(model)) > 0) { return(true); } else { return(false); } } catch { throw; } }
// public bool Update(Placard model) { try { StringBuilder strSql = new StringBuilder(); strSql.Append("update T_Placard set "); strSql.Append("PlacardTitle=@PlacardTitle,"); strSql.Append("PlacardContent=@PlacardContent,"); strSql.Append("Publisher=@Publisher,"); strSql.Append("ReleaseTime=@ReleaseTime,"); strSql.Append("NumClicks=@NumClicks,"); strSql.Append("DepName=@DepName"); strSql.Append(" where Id=@Id"); if (DbHelperSQL.ExecuteSql(strSql.ToString(), GetSqlParameter(model)) > 0) { return(true); } else { return(false); } } catch { throw; } }
/// <summary> /// A callback called when a placard is selected in the Drupal Unity Interface. /// </summary> /// <param name="placard"></param> void OnPlacardSelected(Placard placard) { destination = GeographicManager.Instance.GetPosition(placard.location.latitude, placard.location.longitude, placard.location.elevation); navMeshAgent.Resume(); }
public async Task AddPlacardAsync(Placard placard) { await placardRepository.AddPlacardAsync(placard); await unitOfWork.CompleteAsync(); }
public async Task AddPlacardAsync(Placard placard) { await context.Placards.AddAsync(placard); }
public async Task UpdatePlacardAsync(Placard placard) { placardRepository.UpdatePlacard(placard); await unitOfWork.CompleteAsync(); }
public void UpdatePlacard(Placard placard) { context.Entry(placard).State = EntityState.Modified; }