示例#1
0
        private VContentsChild CoroutineShowContent(App.Model.MContent content, Vector3 position)
        {
            GameObject obj = Instantiate(contentsChild);

            obj.transform.SetParent(contentPanel);
            obj.transform.SetAsFirstSibling();
            VContentsChild vContentsChild = obj.GetComponent <VContentsChild>(); vContentsChild.name = content.content_id.ToString();

            if (content.type == ContentType.character)
            {
                obj.transform.localPosition = position;
                obj.transform.localScale    = new Vector3(0.001f, 0.001f, 1f);
                obj.transform.eulerAngles   = Vector3.zero;
                MCharacter mCharacter = new MCharacter();
                mCharacter.CharacterId = content.content_id;
                vCard.gameObject.SetActive(true);
                vCard.transform.localPosition = Vector3.zero;
                vCard.transform.eulerAngles   = Vector3.zero;
                vCard.transform.localScale    = Vector3.zero;
                vCard.BindingContext          = mCharacter.ViewModel;
                vCard.UpdateView();

                seqCard = new Sequence();
                seqCard.Insert(0f, HOTween.To(vCard.transform, 0.5f, new TweenParms()
                                              .Prop("eulerAngles", new Vector3(0, 0, 360f))
                                              .Prop("localScale", Vector3.one, false).OnComplete(() => {
                    seqCard.Pause();
                })));
                seqCard.Insert(0.5f, HOTween.To(vCard.transform, 0.3f, new TweenParms()
                                                .Prop("localPosition", position)
                                                .Prop("eulerAngles", new Vector3(0.001f, 0.001f, 1f))
                                                .Prop("localScale", new Vector3(120f / 240f, 120f / 360f, 1f), false).OnComplete(() => {
                    vCard.gameObject.SetActive(false);
                    obj.transform.localScale = Vector3.one;
                    seqCard.Kill();
                    seqCard = null;
                    vContentsChild.showComplete = true;
                })));
                seqCard.Play();
            }
            else
            {
                obj.transform.localPosition = Vector3.zero;
                obj.transform.localScale    = Vector3.zero;
                obj.transform.eulerAngles   = Vector3.zero;
                HOTween.To(obj.transform, 0.6f, new TweenParms()
                           .Prop("eulerAngles", new Vector3(0, 0, 360f))
                           .Prop("localPosition", position)
                           .Prop("localScale", Vector3.one)
                           .OnComplete(() => {
                    vContentsChild.showComplete = true;
                }));
            }
            vContentsChild.showComplete = false;
            vContentsChild.UpdateView(content);
            return(vContentsChild);
        }
示例#2
0
        public override void UpdateView(App.Model.MBase model)
        {
            mShopItem = model as App.Model.Master.MShopItem;
            vContentsChild.UpdateView(mShopItem.shop_content);
            lblName.text    = vContentsChild.ContentName;
            lblMessage.text = mShopItem.shop_content.message;
            lblPrice.text   = mShopItem.price.ToString();
            string priceType = mShopItem.priceType;

            foreach (GameObject unit in units)
            {
                unit.SetActive(unit.name == priceType);
            }
        }
示例#3
0
 /*protected override void OnBindingContextChanged(VMBase oldViewModel, VMBase newViewModel)
  * {
  *
  *  base.OnBindingContextChanged(oldViewModel, newViewModel);
  *
  *  VMPresent oldVm = oldViewModel as VMItem;
  *  if (oldVm != null)
  *  {
  *      oldVm.Cnt.OnValueChanged -= CntChanged;
  *  }
  *  if (ViewModel!=null)
  *  {
  *      ViewModel.Cnt.OnValueChanged += CntChanged;
  *  }
  * }
  * private void CntChanged(int oldvalue, int newvalue)
  * {
  *  cnt.text = newvalue.ToString();
  * }*/
 public override void UpdateView()
 {
     vContentsChild.UpdateView(ViewModel.Content.Value);
     lblName.text    = vContentsChild.ContentName;
     lblMessage.text = ViewModel.Content.Value.message;
     System.TimeSpan timeSpan = ViewModel.LimitTime.Value - App.Service.HttpClient.Now;
     if (timeSpan.Days > 1000)
     {
         lblLimit.text = "无期限";
     }
     else if (timeSpan.Days > 1)
     {
         lblLimit.text = string.Format("{0}天{1}小时", timeSpan.Days, timeSpan.Hours);
     }
     else if (timeSpan.Hours > 1)
     {
         lblLimit.text = string.Format("{0}小时{1}分", timeSpan.Hours, timeSpan.Minutes);
     }
     else
     {
         lblLimit.text = string.Format("{0}分", timeSpan.Minutes);
     }
 }
示例#4
0
 public override void UpdateView()
 {
     vContentsChild.UpdateView(ViewModel.Contents.Value[0]);
     receivedIcon.gameObject.SetActive(ViewModel.Received.Value);
     day.text = string.Format("第{0}天", ViewModel.Day.Value);
 }
示例#5
0
 /*#region VM处理
  * public VMPresent ViewModel { get { return (VMPresent)BindingContext; } }
  * protected override void OnBindingContextChanged(VMBase oldViewModel, VMBase newViewModel)
  * {
  *
  *  base.OnBindingContextChanged(oldViewModel, newViewModel);
  *
  *  VMPresent oldVm = oldViewModel as VMItem;
  *  if (oldVm != null)
  *  {
  *      oldVm.Cnt.OnValueChanged -= CntChanged;
  *  }
  *  if (ViewModel!=null)
  *  {
  *      ViewModel.Cnt.OnValueChanged += CntChanged;
  *  }
  * }
  * private void CntChanged(int oldvalue, int newvalue)
  * {
  *  cnt.text = newvalue.ToString();
  * }
  #endregion*/
 public override void UpdateView(App.Model.MBase model)
 {
     //App.Model.MContent content = model as App.Model.MContent;
     vContentsChild.UpdateView(model);
 }