public void SetData(UserCardVo userCardVo, AdditionType type) { Debug.LogError(type); if (userCardVo == null) { return; } _isOther = _cardId != userCardVo.CardId; _cardId = userCardVo.CardId; _cardNameText.text = userCardVo.CardVo.CardName; var rect = _cardNameText.GetComponent <RectTransform>(); rect.sizeDelta = new Vector2(_cardNameText.preferredWidth, rect.sizeDelta.y); SetCredit(userCardVo.CardVo); SetProperties(userCardVo, type); SetStars(userCardVo); //这个组件必须要在UI全部渲染完后的第二帧后才能激活使用,第一帧就使用的话会不生效。 // if (_horizontalLayoutGroup.enabled == false) // { // ClientTimer.Instance.DelayCall(() => // { // _horizontalLayoutGroup.enabled=true; // },0.1f); // // } }
private void SetStars(UserCardVo userCardVo) { //先播放特效后打开试试! for (int i = 0; i < _heartContainer.childCount; i++) { var heartroot = _heartContainer.GetChild(i); heartroot.gameObject.SetActive(i < userCardVo.MaxStars); GameObject redheart = heartroot.Find("Light").gameObject; redheart.SetActive(i < userCardVo.Star); // Image img = _heartContainer.GetChild(i).GetComponent<Image>(); // //float alpha = 0.5f; // img.sprite = AssetManager.Instance.GetSpriteAtlas("UIAtlas_Card_whiteHeart"); // if (i < userCardVo.Star) // { // // alpha = 1.0f; // img.sprite = AssetManager.Instance.GetSpriteAtlas("UIAtlas_Card_redHeart"); // } // //img.color = new Color(img.color.r, img.color.g, img.color.b, alpha); // img.gameObject.SetActive(i < userCardVo.MaxStars); } }
public ResolveCardVo(UserCardVo vo) { Num = vo.Num - 1; CardId = vo.CardId; Credit = vo.CardVo.Credit; Name = vo.CardVo.CardName; Player = vo.CardVo.Player; CardPath = vo.CardVo.MiddleCardPath(vo.UserNeedShowEvoCard()&&vo.Level>60);//注意R卡!vo.UserNeedShowEvoCard() //ResolveItem = GlobalData.CardModel.GetCardEvoRule(Credit, Player)?.Resolve; ResolveItem = GlobalData.CardModel.GetCardResolveRule(Credit, Player).Resolve; }
private void SetFitPage(int maxevoTime, UserCardVo vo) { for (int i = 1; i < maxevoTime + 1; i++) { var cardevorulepb = GlobalData.CardModel.GetCardEvoRule(vo.CardVo.Credit, vo.CardVo.Player, (EvolutionPB)(i)); if (vo.Evolution == cardevorulepb.Evo - 1 && vo.Star >= (int)cardevorulepb.StarNeed) { _curPageIndex = i; break; } } }
public void SetData(VisitBattleUserCardVo battleUserCardVo) { if (battleUserCardVo == null) { _data = null; _container.gameObject.Hide(); _emptyBg.gameObject.Show(); return; } UserCardVo vo = battleUserCardVo.UserCardVo; _emptyBg.gameObject.Hide(); _container.gameObject.Show(); _data = battleUserCardVo; transform.Find("Container/QualityBg/LevelText").GetComponent <Text>().text = "Lv." + vo.Level; Transform heartBar = transform.Find("Container/QualityBg/HeartBar"); _cardQualityImage.sprite = AssetManager.Instance.GetSpriteAtlas(CardUtil.GetNewCreditSpritePath(vo.CardVo.Credit)); //_cardQualityImage.SetNativeSize(); for (int i = 1; i < 6; i++) { // RawImage item = heartBar.GetChild(4 - i).GetComponent<RawImage>(); // float alpha = 0.5f; // if (vo.Star > i) // { // alpha = 1.0f; // } // // item.color = new Color(item.color.r, item.color.g, item.color.b, alpha); // item.gameObject.SetActive(i < vo.MaxStars); var heartroot = heartBar.GetChild(i); heartroot.gameObject.SetActive(i - 1 < vo.MaxStars); GameObject redheart = heartroot.Find("redHeart").gameObject; redheart.SetActive(i - 1 < vo.Star); } Texture texture = ResourceManager.Load <Texture>(vo.CardVo.MiddleCardPath(vo.UserNeedShowEvoCard()), ModuleConfig.MODULE_VISITBATTLE); if (texture == null) { Debug.LogError(vo.CardVo.MiddleCardPath(vo.UseEvo == EvolutionPB.Evo1)); texture = ResourceManager.Load <Texture>(vo.CardVo.MiddleCardPath(), ModuleConfig.MODULE_VISITBATTLE); } _cardImage.texture = texture; }
public void SetData(UserCardVo vo, int expAdd) { ProgressBar progressBar = transform.Find("ProgressBar").GetComponent <ProgressBar>(); progressBar.Progress = (int)(((float)vo.CurrentLevelExp / vo.NeedExp) * 100); _cardImage.texture = ResourceManager.Load <Texture>(vo.CardVo.SmallCardPath(vo.UserNeedShowEvoCard()), ModuleConfig.MODULE_BATTLE); if (_cardImage.texture == null) { Debug.LogError(vo.CardVo.SmallCardPath(vo.UseEvo == EvolutionPB.Evo1)); _cardImage.texture = ResourceManager.Load <Texture>(vo.CardVo.SmallCardPath(), ModuleConfig.MODULE_BATTLE); } _levelText.text = "Lv." + vo.Level; if (vo.Level >= 100) { transform.Find("ExpAddText").GetComponent <Text>().text = "MAX"; } else { transform.Find("ExpAddText").GetComponent <Text>().text = "+" + expAdd + " exp"; } for (int i = 1; i < _heartBar.childCount; i++) { // RawImage star = _heartBar.GetChild(i).GetComponent<RawImage>(); // // star.gameObject.SetActive(i < vo.MaxStars); // // if (vo.Star > i) // { // star.color = new Color(star.color.r, star.color.g, star.color.b, 1.0f); // } // else // { // star.color = new Color(star.color.r, star.color.g, star.color.b, 0.5f); // } var heartroot = _heartBar.GetChild(i); heartroot.gameObject.SetActive(i - 1 < vo.MaxStars); GameObject redheart = heartroot.Find("redHeart").gameObject; redheart.SetActive(i - 1 < vo.Star); } _cardQualityImage.sprite = HeroCardUtil.GetQualityImage(vo.CardVo.Credit); //_cardQualityImage.SetNativeSize(); }
public void SetData(UserCardVo userCardVo, LevelModel levelmodel) { _levelModel = levelmodel; _cardId = userCardVo.CardId; CardStarUpRulePB rule = GlobalData.CardModel.GetCardStarUpRule(userCardVo.CardId, (StarPB)userCardVo.Star); if (rule != null) { foreach (KeyValuePair <int, int> pair in rule.Consume) { //需要刷选出不重复的list if (!upgradeStarRequireVos.ContainsKey(pair.Key)) { UpgradeStarRequireVo vo = new UpgradeStarRequireVo(); vo.PropId = pair.Key; vo.NeedNum = pair.Value; vo.PropName = GlobalData.PropModel.GetPropBase(vo.PropId).Name; UserPropVo userProp = GlobalData.PropModel.GetUserProp(vo.PropId); vo.CurrentNum = 0; if (userProp != null) { vo.CurrentNum = userProp.Num; } upgradeStarRequireVos.Add(vo.PropId, vo); } } } // for (int i = 0; i < userCardVo.CardVo.MaxStar; i++) // { // // } foreach (var v in upgradeStarRequireVos) { _starUpList.Add(v.Value); } SetPropDropList(); upgradeStarRequireVos.Clear(); }
public void SetData(UserCardVo vo) { if (_coroutine != null) { StopCoroutine(_coroutine); } _vo = vo; //最多进化几次的限制!圆点的限制 _maxevotimes = vo.CardVo.GetMaxEvoTimes(); for (int i = 0; i < _maxevotimes; i++) { _pointGroup.GetChild(i).gameObject.Show(); } _isTrigger = false; SetFitPage(_maxevotimes, vo); SetPageData(vo); }
private void SetPageData(UserCardVo vo) { // _tips.gameObject.Hide(); var cardevorulepb = GlobalData.CardModel.GetCardEvoRule(vo.CardVo.Credit, vo.CardVo.Player, (EvolutionPB)(_curPageIndex)); // _ruleTran.gameObject.SetActive(_curPageIndex==1&&vo.CardVo.Credit!=CreditPB.R); _cardEvoRulePb = cardevorulepb; _title.text = I18NManager.Get("Card_EvolutionTo") + ShowIndex(_curPageIndex); SetArrowShow((int)cardevorulepb.Evo); var costReduceNum = GlobalData.CardModel.GetCardResolveRule(vo.CardVo.Credit, vo.CardVo.Player).EvoResolve[10000 + (int)vo.CardVo.Player]; _resolveRule.text = I18NManager.Get("Card_GetResolveItem", costReduceNum); //$"一张相同星缘可抵扣<color=#9769AC>{costReduceNum}</color>"; _ruleImage.texture = ResourceManager.Load <Texture>(GlobalData.PropModel.GetPropStrPath(vo.EvolutionRequirePropId().ToString()), ModuleConfig.MODULE_CARD); _smallCard.texture = ResourceManager.Load <Texture>(vo.CardVo.MiddleCardPath(true), ModuleConfig.MODULE_CARD); CostNum.text = (vo.Num - 1) + "/" + cardevorulepb.UseCardNum;//可抵消星缘的数量 _costGoldNum.text = I18NManager.Get("Card_CostEvoGoldNeed", cardevorulepb.GoldNeed); int reduceCardNum = 0; if (vo.Num - 1 >= cardevorulepb.UseCardNum) { reduceCardNum = cardevorulepb.UseCardNum; } else { reduceCardNum = vo.Num - 1; } SetEffectRule(cardevorulepb); //SetRuleInfo(); SetCardEvoInfoState(_curPageIndex); for (int j = 0; j < _propGroup.childCount; j++) { _propGroup.GetChild(j).gameObject.Hide(); } bool isCrystalSatisfy = false; bool isPropSatisfy = false; int i = 0; int propIndex = 0; bool enableAni = false; foreach (var v in cardevorulepb.Consume) { var propitem = GlobalData.PropModel.GetUserProp(v.Key); if (propitem == null) { continue; } else { _propGroup.GetChild(i).GetChild(0).GetComponent <RawImage>().texture = ResourceManager.Load <Texture>(GlobalData.PropModel.GetPropStrPath(v.Key.ToString()), ModuleConfig.MODULE_CARD); } _propGroup.GetChild(i).gameObject.Show(); //要扣去可抵消的卡牌数量,要先确定这个是不是卡牌 if (propitem.ItemId >= 10001 && propitem.ItemId <= 10004) { _propGroup.GetChild(i).GetChild(0).Find("Text").GetComponent <Text>().text = propitem.Num + "/" + v.Value;// (v.Value-costReduceNum*reduceCardNum) isCrystalSatisfy = propitem.Num >= v.Value - costReduceNum * reduceCardNum; _propGroup.GetChild(0).GetChild(1).GetComponent <RawImage>().texture = ResourceManager.Load <Texture>(_vo.CardAppointmentRuleVo.SmallPicPath, ModuleConfig.MODULE_CARD); //开始dotween动画! enableAni = true; } else { propIndex++; _propGroup.GetChild(i).GetChild(0).Find("Text").GetComponent <Text>().text = propitem.Num + "/" + v.Value; if (propIndex == 1) { isPropSatisfy = propitem.Num >= v.Value; } else if (propIndex == 2) { isPropSatisfy = propitem.Num >= v.Value & isPropSatisfy; } } PointerClickListener.Get(_propGroup.GetChild(i).gameObject).onClick = go => { //道具来源 //BUG,道具来源不值一种啊! if (propitem.ItemId >= 10001 && propitem.ItemId <= 10004) { // FlowText.ShowMessage(I18NManager.Get("Card_GetByResolve")); SetToggleState(vo.Num - 1 > 0); SetTogglePropData(propitem.Num + "/" + v.Value, (vo.Num - 1) + "/" + cardevorulepb.UseCardNum, GlobalData.PropModel.GetPropStrPath(v.Key.ToString()), _vo.CardAppointmentRuleVo.SmallPicPath); _chooseWindowBG.gameObject.Show(); } else { FlowText.ShowMessage(I18NManager.Get("Card_GetByVisit")); } }; i++; } if (enableAni) { if (!canPlayAni) { canPlayAni = true; ChangePropAni(); } } else { tween.Kill(); ResetPropBg(); } if (_isTrigger == false && vo.Evolution == cardevorulepb.Evo - 1 && vo.Star >= (int)cardevorulepb.StarNeed) { _isTrigger = true; _coroutine = ClientTimer.Instance.DelayCall(() => { if (_curPageIndex == 3) { //结晶满足, 进化道具不满足 int id = (7014 + (int)vo.CardVo.Player - 1); if (isCrystalSatisfy && isPropSatisfy == false && GlobalData.RandomEventModel.CheckTrigger(id)) { new TriggerService().Request(id).ShowNewGiftWindow().Execute(); } } else if (_curPageIndex == 2) { int id2 = (7010 + (int)vo.CardVo.Player - 1); //道具满足,但是结晶不满足 if (isCrystalSatisfy == false && isPropSatisfy && GlobalData.RandomEventModel.CheckTrigger(id2)) { new TriggerService().Request(id2).ShowNewGiftWindow().Execute(); } } }, 3); } SetUnLockTextInfo(cardevorulepb); SetEvoState(cardevorulepb); if (vo.Num > 1) { ChooseCardResolve = 1; } else { ChooseCardResolve = 0; } }
public void SetProperties(UserCardVo userCardVo, AdditionType type) { CardVo vo = userCardVo.CardVo; CardAdditionVo curAdditionVo = userCardVo.CurLevelInfo; CardAdditionVo additionVo = userCardVo.NextLevelInfo; int addsing = 0; int adddance = 0; int addoriginal = 0; int addpopularity = 0; int addglamour = 0; int addwillpower = 0; if (type == AdditionType.Level) { addsing = (additionVo.SingingAdditon - curAdditionVo.SingingAdditon); adddance = (additionVo.DancingAdditon - curAdditionVo.DancingAdditon); addoriginal = (additionVo.OriginalAdditon - curAdditionVo.OriginalAdditon); addpopularity = (additionVo.PopularityAdditon - curAdditionVo.PopularityAdditon); addglamour = (additionVo.GlamourAdditon - curAdditionVo.GlamourAdditon); addwillpower = (additionVo.WillpowerAdditon - curAdditionVo.WillpowerAdditon); } if (type == AdditionType.Star) { addsing = userCardVo.NextStarInfo.SingingAdditon - userCardVo.CurStarInfo.SingingAdditon; adddance = userCardVo.NextStarInfo.DancingAdditon - userCardVo.CurStarInfo.DancingAdditon; addoriginal = userCardVo.NextStarInfo.OriginalAdditon - userCardVo.CurStarInfo.OriginalAdditon; addpopularity = userCardVo.NextStarInfo.PopularityAdditon - userCardVo.CurStarInfo.PopularityAdditon; addglamour = userCardVo.NextStarInfo.GlamourAdditon - userCardVo.CurStarInfo.GlamourAdditon; addwillpower = userCardVo.NextStarInfo.WillpowerAdditon - userCardVo.CurStarInfo.WillpowerAdditon; } else if (type == AdditionType.Evolution) { addsing = userCardVo.EvoInfoAddition.SingingAdditon - userCardVo.CurEvolutionInfo.SingingAdditon; adddance = userCardVo.EvoInfoAddition.DancingAdditon - userCardVo.CurEvolutionInfo.DancingAdditon; addoriginal = userCardVo.EvoInfoAddition.OriginalAdditon - userCardVo.CurEvolutionInfo.OriginalAdditon; addpopularity = userCardVo.EvoInfoAddition.PopularityAdditon - userCardVo.CurEvolutionInfo.PopularityAdditon; addglamour = userCardVo.EvoInfoAddition.GlamourAdditon - userCardVo.CurEvolutionInfo.GlamourAdditon; addwillpower = userCardVo.EvoInfoAddition.WillpowerAdditon - userCardVo.CurEvolutionInfo.WillpowerAdditon; } //正确公式应该是vo.sing*groth+pb.power //进化3之前都要显示加号! if (addsing > 0 && (int)userCardVo.Evolution < vo.GetMaxEvoTimes())//userCardVo.Level<=userCardVo.CardVo.MaxLevel&&userCardVo.Evolution!=EvolutionPB.Evo1&& { //Debug.LogError(type+" vo.singing "+vo.Singing+" curAdditionVo "+curAdditionVo.SingingAdditon+" additionVo "+additionVo.SingingAdditon); _singText.text = userCardVo.Singing + " +" + addsing; _danceText.text = userCardVo.Dancing + " +" + adddance; _originalText.text = userCardVo.Original + " +" + addoriginal; //-curAdditionVo.OriginalAdditon); _popularityText.text = userCardVo.Popularity + " +" + addpopularity; //-curAdditionVo.PopularityAdditon); _glamourText.text = userCardVo.Glamour + " +" + addglamour; //-curAdditionVo.GlamourAdditon); _willpowerText.text = userCardVo.Willpower + " +" + addwillpower; //-curAdditionVo.WillpowerAdditon); } else { //Debug.LogError(type+" vo.singing "+vo.Singing+" curAdditionVo "+curAdditionVo.SingingAdditon+" additionVo "+additionVo.SingingAdditon); _singText.text = userCardVo.Singing.ToString(); //+" +"+additionVo.SingingAdditon;//(vo.Singing+ curAdditionVo.SingingAdditon )+ " +" + (additionVo.SingingAdditon-curAdditionVo.SingingAdditon); _danceText.text = userCardVo.Dancing.ToString(); // + " +" + additionVo.DancingAdditon; //(vo.Dancing + curAdditionVo.DancingAdditon)+" +" + (additionVo.DancingAdditon-curAdditionVo.DancingAdditon); _originalText.text = userCardVo.Original.ToString(); //+ " +" + additionVo.OriginalAdditon;//-curAdditionVo.OriginalAdditon); _popularityText.text = userCardVo.Popularity.ToString(); // + " +" + additionVo.PopularityAdditon;//-curAdditionVo.PopularityAdditon); _glamourText.text = userCardVo.Glamour.ToString(); // + " +" + additionVo.GlamourAdditon;//-curAdditionVo.GlamourAdditon); _willpowerText.text = userCardVo.Willpower.ToString(); // + " +" + additionVo.WillpowerAdditon; //-curAdditionVo.WillpowerAdditon); } int cur = userCardVo.Singing + userCardVo.Dancing + userCardVo.Original + userCardVo.Popularity + userCardVo.Glamour + userCardVo.Willpower; if (_isOther) { oldNum = cur; newNum = cur; setTotal(cur); } newNum = cur; setTotal(newNum); if (newNum > oldNum) { ShowUpgradeEffect(); } }