public override void UpdateView(App.Model.MBase model) { App.Model.Master.MGachaPrice gachaPrice = model as App.Model.Master.MGachaPrice; this.gachaPrice = gachaPrice; buttonName.text = string.Format(Language.Get("gacha_button_label"), gachaPrice.cnt); price.gameObject.SetActive(true); price.text = gachaPrice.price.ToString(); Image[] icons = price.GetComponentsInChildren <Image>(); foreach (Image icon in icons) { icon.gameObject.SetActive(icon.gameObject.name == gachaPrice.price_type.ToString()); } if (labelFree == null) { return; } App.Model.MGacha mGacha = System.Array.Find(Global.SGacha.gachas, _ => _.GachaId == gachaPrice.id); if (gachaPrice.free_count == 0 || mGacha.LimitCount == 0) { labelFree.gameObject.SetActive(false); timeFree.gameObject.SetActive(false); return; } price.gameObject.SetActive(false); App.Model.Master.MGacha gachaMaster = GachaCacher.Instance.Get(gachaPrice.id); this.StopAllCoroutines(); this.StartCoroutine(UpdateFreetime(gachaMaster, mGacha)); }
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); } }
public override void UpdateView(App.Model.MBase model) { levelUp.gameObject.SetActive(false); MExpCharacter mExpCharacter = model as MExpCharacter; characterIcon.BindingContext = System.Array.Find(Global.SUser.self.characters, c => c.CharacterId == mExpCharacter.id).ViewModel; characterIcon.UpdateView(); int fromExp = ExpCacher.Instance.MaxExp(mExpCharacter.toLevel); int toExp = ExpCacher.Instance.MaxExp(mExpCharacter.toLevel + 1); int exp = mExpCharacter.toExp - fromExp; int maxExp = toExp - fromExp; txtExp.text = string.Format("{0}/{1}", exp, maxExp); if (mExpCharacter.toLevel > mExpCharacter.fromLevel) { ShowLevelUp(); } imgExp.rectTransform.sizeDelta = new Vector2(-120f * exp / maxExp, imgExp.rectTransform.sizeDelta.y); imgExp.rectTransform.anchoredPosition = new Vector2(imgExp.rectTransform.sizeDelta.x * 0.5f, imgExp.rectTransform.anchoredPosition.y); }
public GameObject ScrollViewSetChild(Transform parentContent, GameObject content, App.Model.MBase model) { GameObject obj = Instantiate(content); obj.transform.SetParent(parentContent); obj.SetActive(true); obj.transform.localScale = Vector3.one; App.View.VBase view = obj.GetComponent <App.View.VBase>(); if (model.VM == null) { view.UpdateView(model); } else { view.BindingContext = model.VM; view.UpdateView(); } return(obj); }
/*#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); }
public virtual void UpdateView(App.Model.MBase model) { }