private void MakePosterUIObj(PosterData data) { Vector3 destPos = data.destination.transform.position; if (Vector3.Distance(Camera.main.transform.position, destPos) < 5.0f) { currentUI = Instantiate(uiPrefab);//, Vector3.zero, Quaternion.identity, data.destination.transform.parent.transform); currentUI.transform.position = destPos; currentUI.transform.SetParent(data.destination.transform.parent.transform); GameObject posterObj = currentUI.transform.GetChild(1).gameObject; Animation posterAnim = currentUI.GetComponent <Animation>(); Texture posterImage = currentPoster.transform.GetChild(0).gameObject.GetComponent <MeshRenderer>().material.GetTexture("_MainTex"); posterMat.SetTexture("_MainTex", posterImage); posterObj.transform.GetChild(0).gameObject.transform.GetChild(0).gameObject.GetComponent <MeshRenderer>().material = posterMat; posterObj.transform.GetChild(0).gameObject.transform.localScale = data.posterSize; posterAnim.Play("PosterClickAnim"); Vector3 lookTarget = new Vector3(posterObj.transform.position.x - Camera.main.transform.position.x, posterObj.transform.position.y, posterObj.transform.position.z - Camera.main.transform.position.z); posterObj.transform.rotation = Quaternion.LookRotation(lookTarget);//posterObj.transform.position - Camera.main.transform.position); for (int i = 1; i < posterObj.transform.childCount - 1; i++) { posterObj.transform.GetChild(i).gameObject.GetComponent <PosterUIController>().SetPosterObject(this.gameObject); //Debug.LogFormat("Set this Object in {0}", posterObj.transform.GetChild(i).gameObject.name); } currentInfo = posterObj.transform.GetChild(4).gameObject; currentInfo.SetActive(false); } else { //Destroy(currentUI); } }
/// <summary> /// Loads the content asynchronously. /// </summary> public override async Task LoadContentAsync() { var data = Data.FromJson <Rest.PosterList>(); // // If the menu content hasn't actually changed, then ignore. // if (data.ToJson().ComputeHash() == PosterData.ToJson().ComputeHash()) { return; } PosterData = data; PosterImages = new Bitmap[PosterData.Items.Count]; // // Load the background image and prepate the menu buttons. // BackgroundImage = await Utility.LoadImageFromUrlAsync(Crex.Application.Current.GetAbsoluteUrl(PosterData.BackgroundImage?.BestMatch)); if (BackgroundImage != null) { BackgroundImage = Utility.ScaleImageToWidth(BackgroundImage, ( int )(Crex.Application.Current.Resolution.Width / 2.0f)); BackgroundImage = Utility.CreateBlurredImage(BackgroundImage, 8); } if (Activity != null) { Activity.RunOnUiThread(UpdateUserInterfaceFromContent); } LastLoadedDate = DateTime.Now; }
public void ClickedCircleButton(PosterData data) { targetPoint = data.destination; targetPoster = data.posterObj; Debug.Log(targetPoint.name); StartCoroutine(CircleButtonEvent()); }
/// <summary> /// Loads the content asynchronously. /// </summary> public override async Task LoadContentAsync() { var data = Data.FromJson <Rest.PosterList>(); // // If the menu content hasn't actually changed, then ignore. // if (data.ToJson().ComputeHash() == PosterData.ToJson().ComputeHash()) { return; } PosterData = data; // // Load the background image. // try { BackgroundImage = await Utility.LoadImageFromUrlAsync(Crex.Application.Current.GetAbsoluteUrl(PosterData.BackgroundImage.BestMatch)); BackgroundImage = Utility.ScaleImageToWidth(BackgroundImage, ( int )(Crex.Application.Current.Resolution.Width / 2.0f)); BackgroundImage = Utility.CreateBlurredImage(BackgroundImage, 8); } catch { BackgroundImage = null; } ListViewImages = new UIImage[PosterData.Items.Count]; LastLoadedDate = DateTime.Now; InvokeOnMainThread(() => { EnsureView(); TitleView.Text = PosterData.Title; DetailLeftView.Text = string.Empty; DetailRightView.Text = string.Empty; DescriptionView.Text = string.Empty; BackgroundImageView.Image = BackgroundImage; ListView.ReloadData(); SetNeedsFocusUpdate(); }); }
private IEnumerator SetPosterUI(int layerNum, int posterNum, GameObject poster) { if (currentUI != null) { if (!currentPoster.Equals(poster)) { if (currentInfo != null) { currentInfo.GetComponent <Animation>().Play("InfoCloseAnim"); yield return(new WaitForSeconds(0.3f)); Destroy(currentInfo); yield return(new WaitUntil(() => !currentUI.GetComponent <Animation>().isPlaying)); currentUI.GetComponent <Animation>().Play("PosterCloseAnim"); yield return(new WaitForSeconds(1.3f)); Destroy(currentUI); } else if (currentCard == null) { yield return(new WaitUntil(() => !currentUI.GetComponent <Animation>().isPlaying)); currentUI.GetComponent <Animation>().Play("PosterCloseAnim"); yield return(new WaitForSeconds(1.3f)); Destroy(currentUI); } else if (currentCard != null) { //currentcard close anim currentCard.GetComponent <Animation>().Play("CardCloseAnim"); yield return(new WaitForSeconds(1.5f)); Destroy(currentCard); Destroy(currentUI); } } } switch (layerNum) { case 0: currentData = layer0[posterNum]; break; case 1: currentData = layer1[posterNum]; break; case 2: currentData = layer2[posterNum]; break; case 3: currentData = layer3[posterNum]; break; } if (currentUI == null || (currentPoster != null && !currentPoster.Equals(poster))) { currentPoster = poster; MakePosterUIObj(currentData); } }