public override void SetData(VisitLevelVo vo) { base.SetData(vo); int index = 2;//奖励展示写死 string path = "Card/Image/MiddleCard/" + vo.Awards[index].ResourceId.ToString(); Debug.Log("VisitLevelCardItem " + path); RawImage propImage = transform.Find("CardMask/Card").GetComponent <RawImage>(); Texture tx = ResourceManager.Load <Texture>(path, ModuleConfig.MODULE_VISIT); if (tx == null) { tx = ResourceManager.Load <Texture>("Card/Image/MiddleCard/1420", ModuleConfig.MODULE_VISIT); } propImage.texture = tx; var card = GlobalData.CardModel.GetCardBase(vo.Awards[index].ResourceId); var credit = transform.GetImage("Credit"); credit.sprite = AssetManager.Instance.GetSpriteAtlas(CardUtil.GetNewCreditSpritePath(card.Credit)); //propImage.SetNativeSize(); if (vo.IsPass) { ExtraAni(); } }
public void Init(VisitLevelVo vo) { if (vo.levelFirstPassPB.Awards.Count == 0) { return; } _vo = vo; transform.Find("GetBtn").gameObject.SetActive(vo.IsPass); AwardPB aPb = vo.levelFirstPassPB.Awards[0]; if (aPb.Resource == ResourcePB.Puzzle) { _puzzle.gameObject.Show(); _props.gameObject.Hide(); SetShowPuzzle(aPb); } else if (aPb.Resource == ResourcePB.Item) { _props.gameObject.Show(); _puzzle.gameObject.Hide(); SetShowProps(aPb); } }
public void SetFansData(VisitLevelVo data, List <FansVo> list) { _funsPower = 0; transform.Find("Container/Title/Text").GetComponent <Text>().text = I18NManager.Get("Visit_FansSupport"); transform.Find("Container/DescBg/FansText").GetComponent <Text>().text = Util.GetNoBreakingString(data.FansDescription); var fansPref = GetPrefab("Battle/Prefabs/FansItem"); var fansContainer = transform.Find("Container/FansContainer"); int useTotal = 0; int maxTotal = 0; _fansDict = new Dictionary <int, int>(); foreach (var item in data.FansMax) { var itemObj = Instantiate(fansPref); if (itemObj == null) { continue; } itemObj.transform.SetParent(fansContainer, false); var itemData = list.Find((vo) => { return(vo.FansId == item.Key); }); var num = itemData.Num > item.Value ? item.Value : itemData.Num; itemObj.AddComponent <BattleFansItem>().SetData(num, item.Value, itemData); _funsPower += num * itemData.Power; _fansDict.Add(itemData.FansId, num); useTotal += num; maxTotal += item.Value; } _moreFans = (float)useTotal / maxTotal >= 0.5; }
private GameObject GetLevelItem(VisitLevelVo vo) { string path = GetLevelItemPath(vo); GameObject res = null; if (path == levelCardPath) { if (levelCard == null) { levelCard = GetPrefab(path); } res = levelCard; } else if (path == levelStoryPath) { if (storyCard == null) { storyCard = GetPrefab(path); } res = storyCard; } else if (path == levelPropsPath) { if (propsCard == null) { propsCard = GetPrefab(path); } res = propsCard; } return(res); }
public void InitMyData(MyVisitingRes res) { //关卡数据必须在前 _myVisitLevelVos = new List <MyVisitLevelVo>(); for (int i = 0; i < res.UserLevels.Count; i++) { MyVisitLevelVo vo = new MyVisitLevelVo(res.UserLevels[i]); _myVisitLevelVos.Add(vo); PlayerPB NpcId = (PlayerPB)((vo.LevelId / 1000) % 10); VisitLevelVo levelVo = GetVisitLevelVoById(vo.LevelId, NpcId); levelVo.MyVisitLevel = vo; } _listVo = new List <VisitVo>(); for (int i = 0; i < res.UserWeathers.Count; i++) { VisitVo vo = new VisitVo(res.UserWeathers[i], GetWeatherRulesById(res.UserWeathers[i].WeatherId), GetVisitedTimesById(res.UserWeathers[i].Player), this ); _listVo.Add(vo); } }
private void SetData(VisitingRuleRes res) { VisitChapterDir = new Dictionary <PlayerPB, List <VisitChapterVo> >(); VisitChapterDir[PlayerPB.TangYiChen] = new List <VisitChapterVo>(); VisitChapterDir[PlayerPB.QinYuZhe] = new List <VisitChapterVo>(); VisitChapterDir[PlayerPB.YanJi] = new List <VisitChapterVo>(); VisitChapterDir[PlayerPB.ChiYu] = new List <VisitChapterVo>(); //LevelPB pb = null; for (int i = 0; i < res.LevelRules.Count; i++) { VisitLevelVo level = new VisitLevelVo(res.LevelRules[i], _plotRule, _infoRule); VisitChapterVo visitChapterVo = VisitChapterDir[level.NpcId].Find((m) => { return(m.ChapterId == level.ChapterGroup); }); if (visitChapterVo == null) { visitChapterVo = new VisitChapterVo("123", level.ChapterGroup, true);//I provisionally do it; VisitChapterDir[level.NpcId].Add(visitChapterVo); } visitChapterVo.LevelList.Add(level); level.VisitChapter = visitChapterVo; foreach (var v in res.LevelFirstPassRules) { if (v.LevelId != level.LevelId) { continue; } level.levelFirstPassPB = v; break; } } }
public void SetData(PlayerPB npcId) { _npcId = npcId; curNpcId = npcId; Debug.Log("VisitLevelController SetData NpcId is " + npcId); _curVisitVo = GetData <VisitModel>().GetVisitVo(npcId); _visitChapterVoList = GetData <VisitModel>().GetVisitChapterVo(npcId); _curVisitChapterVo = _visitChapterVoList[0]; string mapId = _curVisitChapterVo.LevelList[0].ChapterBackdrop; //todo 坐标加载 List <MapPos> mapPos = LoadJson(mapId); VisitLevelView.SetData(_curVisitVo, _visitChapterVoList[0], mapPos); //通关第一关时弹出天气指引 if (_visitChapterVoList[0].LevelList.Count > 0) { VisitLevelVo vo = _visitChapterVoList[0].LevelList[0]; if (vo.IsPass) { Common.GuideManager.OpenGuide(Common.GuideEnumType.VISIT_BLESS); } } }
public void SetGoodsData(VisitLevelVo data) { var itemPref = GetPrefab("Battle/Prefabs/SupportItem"); var supportContainer = transform.Find("Container/SupportContainer"); var index = 0; foreach (var item in data.ItemMax) { var itemObj = Instantiate(itemPref) as GameObject; if (itemObj == null) { continue; } itemObj.transform.SetParent(supportContainer, false); UserPropVo propVo = GlobalData.PropModel.GetUserProp(item.Key); ItemPB itemPb = GlobalData.PropModel.GetPropBase(item.Key); int useNum = propVo.Num > item.Value ? item.Value : propVo.Num; var supportItem = itemObj.AddComponent <SupportItem>(); string iconPath = GlobalData.PropModel.GetPropPath(item.Key);; supportItem.SetData(itemPb, useNum, item.Value, iconPath); supportItem.GetComponent <ItemShowEffect>().OnShowEffect(index * 0.2f); index++; } }
private void OnEnterBattle(int num, int levelid) { Debug.Log("OnEnterBattle--------num:" + num); VisitLevelVo vo = _curVisitChapterVo.GetVisitLevelVoById(levelid); if (vo.LevelType == LevelTypePB.Story) { ModuleManager.Instance.EnterModule(ModuleConfig.MODULE_STORY, false, false, vo); } else { if (num == 0) { ModuleManager.Instance.EnterModule(ModuleConfig.MODULE_VISITBATTLE, false, true, vo, GetData <VisitModel>().CommentRule, GetData <VisitModel>().ChallengeCardNumRule); } else { byte[] data = NetWorkManager.GetByteData(new VisitingSweepReq() { LevelId = levelid, Num = num }); LoadingOverlay.Instance.Show(); NetWorkManager.Instance.Send <VisitingSweepRes>(CMD.VISITINGC_SWEEPRES, data, OnSweepHandler); } } }
public void Init(VisitLevelVo vo, VisitVo visitVo) { _levelVo = vo; _visitVo = visitVo; //_maxTime = VisitVo.MaxSingleVisitTime; transform.Find("DescBg/IntroductionTxt").GetComponent <Text>().text = vo.LevelDescription; transform.Find("ScoreTxt").GetComponent <Text>().text = I18NManager.Get("Visit_VisitScore") + vo.Score; transform.Find("Title/Text").GetComponent <Text>().text = vo.LevelName; //Text powerUseTxt = transform.Find("PowerUse/PowerUseTxt").GetComponent<Text>(); //powerUseTxt.text = "消耗体力:" + vo.CostEnergy; Image star1 = transform.Find("StarContainer/Star1").GetComponent <Image>(); Image star2 = transform.Find("StarContainer/Star2").GetComponent <Image>(); Image star3 = transform.Find("StarContainer/Star3").GetComponent <Image>(); Color lightColor = Color.white; Color grayColor = new Color(160 / 255.0f, 160 / 255.0f, 160 / 255.0f); _playOnceBtn.gameObject.SetActive(false); _playTimesBtn.gameObject.SetActive(false); _tipImage.gameObject.Hide(); if (vo.CurrentStar == 0) { _tipImage.gameObject.Show(); star1.color = grayColor; star2.color = grayColor; star3.color = grayColor; } else if (vo.CurrentStar == 1) { star1.color = lightColor; star2.color = grayColor; star3.color = grayColor; } else if (vo.CurrentStar == 2) { star1.color = lightColor; star2.color = lightColor; star3.color = grayColor; _tipImage.gameObject.Hide(); _playOnceBtn.gameObject.SetActive(true); _playTimesBtn.gameObject.SetActive(true); } else { _playOnceBtn.gameObject.SetActive(true); _playTimesBtn.gameObject.SetActive(true); _tipImage.gameObject.Hide(); } HandleDrops(); SetChanllangeTimes(); }
private void SelectFirstLevelItem() { VisitLevelVo vo = _visitChapterVoList[0].LevelList[0]; if (!vo.IsCanPass) { return; } Debug.Log("SelectFirstLevelItem"); EventDispatcher.TriggerEvent <int>(EventConst.VisitLevelItemClick, vo.LevelId); }
public override void SetData(VisitLevelVo vo) { base.SetData(vo); int index = 2;//奖励展示写死 string path = "Prop/" + vo.Awards[index].ResourceId.ToString(); Debug.Log("VisitLevelPropsItem " + path); Image propImage = transform.Find("Props").GetComponent <Image>(); propImage.sprite = ResourceManager.Load <Sprite>(path, ModuleConfig.MODULE_VISIT); propImage.SetNativeSize(); }
private string GetLevelItemPath(VisitLevelVo vo) { if (vo.LevelType == LevelTypePB.Story) { return(levelStoryPath); } if (vo.LevelAwardsType == ResourcePB.Puzzle) { return(levelCardPath); } return(levelPropsPath); }
public VisitLevelVo GetVisitLevelVoById(int levelId, PlayerPB NpcId) { List <VisitChapterVo> list = VisitChapterDir[NpcId]; for (int i = 0; i < list.Count; i++) { VisitLevelVo vo = list[i].LevelList.Find((m) => { return(levelId == m.LevelId); }); if (vo != null) { return(vo); } } return(null); }
private void OnGetFirstPassAwardHandler(GetVisitingFirstPassAwardsRes res) { Debug.Log("OnGetFirstPassAwardHandler"); if (visitFirstPassAwardWindow != null) { visitFirstPassAwardWindow.Close(); visitFirstPassAwardWindow = null; } VisitLevelVo vo = _curVisitChapterVo.GetVisitLevelVoById(res.UserLevel.LevelId); vo.MyVisitLevel.UpdateVisitLevelVo(res.UserLevel); VisitLevelView.UpdateFirstPassAward(); RewardUtil.AddReward(res.Awards); }
public override void SetData(params object[] paramsObjects) { StoryModel model = RegisterModel <StoryModel>(); model.Reset(); //这里还要赋值StoryType if (paramsObjects[0] is LevelVo) { model.Level = (LevelVo)paramsObjects[0]; _storyId = model.Level.StoryId; model.StoryType = StoryType.MainStory; } else if (paramsObjects[0] is AppointmentGateRuleVo) { //约会的关卡。 var gate = (AppointmentGateRuleVo)paramsObjects[0]; int appointmentid = (int)paramsObjects[1]; _storyId = gate.SceneId; Debug.Log(gate.Gate + " " + _storyId); _appointmentData = new[] { gate.Gate, appointmentid }; model.StoryType = StoryType.LoveAppointment; } else if (paramsObjects[0] is VisitLevelVo) { VisitLevelVo vo = (VisitLevelVo)paramsObjects[0]; model.VisitLevel = vo; _storyId = vo.StoryId; model.StoryType = StoryType.Visit; } else if (paramsObjects[0] is ActivityPlotRulePB) { ActivityPlotRulePB capsuleStoryRule = (ActivityPlotRulePB)paramsObjects[0]; _storyId = capsuleStoryRule.PlotId; //_storyId = "24-10"; model.StoryType = StoryType.ActivityCapsule; } else { _storyId = (string)paramsObjects[0]; if (_storyId == "0-1") { model.StoryType = StoryType.CreateUser; } } }
private void OnResetLevelTimeHandler(VisitingBuyCountRes res) { Debug.LogError("OnResetLevelTimeHandler"); GlobalData.PlayerModel.UpdateUserMoney(res.UserMoney); VisitLevelVo vo = _curVisitChapterVo.GetVisitLevelVoById(res.UserLevel.LevelId); //更新UI vo.MyVisitLevel.UpdateVisitLevelVo(res.UserLevel); //VisitLevelView.UpdateResetLevelTime(); if (_battleIntroductionPopup != null) { // _battleIntroductionPopup.Init(vo, _curVisitVo); _battleIntroductionPopup.Refresh(); } }
public void SetData(VisitLevelVo info, VisitBattleModel battleModel) { _info = info; _battleModel = battleModel; _battleModel.FilterCard(); ResetMiddleHeroCard(); transform.Find("BgTop/NeedStrengthText").GetComponent <Text>().text = I18NManager.Get("Visit_Hint1") + ViewUtil.AbilitiesToString(info.Abilitys); transform.Find("BgTop/Panel/Original/ValueText").GetComponent <Text>().text = "0"; transform.Find("BgTop/Panel/Glamour/ValueText").GetComponent <Text>().text = "0"; transform.Find("BgTop/Panel/Popularity/ValueText").GetComponent <Text>().text = "0"; transform.Find("BgTop/Panel/Sing/ValueText").GetComponent <Text>().text = "0"; transform.Find("BgTop/Panel/Dancing/ValueText").GetComponent <Text>().text = "0"; transform.Find("BgTop/Panel/Willpower/ValueText").GetComponent <Text>().text = "0"; _smallCardList.RefreshCells(); _smallCardList.totalCount = _battleModel.UserCardList.Count; }
public virtual void SetData(VisitLevelVo visitLevelVo) { Debug.Log("VisitLevelItem"); _visitLevelVo = visitLevelVo; //transform.Find("Text").GetComponent<Text>().text = visitLevelVo.ChapterGroup + "-" + (visitLevelVo.LevelId % 100).ToString(); //transform.Find("Lock").gameObject.SetActive(!visitLevelVo.IsCanPass); //bool isShowExtra = false; //if (visitLevelVo.levelFirstPassPB != null ) //{ // if(!visitLevelVo.IsPass) // { // isShowExtra = true; // } // else if(visitLevelVo.IsPass&&!visitLevelVo.MyVisitLevel.IsGetFirst) // { // isShowExtra = true; // } //} //transform.Find("Extra").gameObject.SetActive(isShowExtra); UpdateItem(); }
public void Init(VisitLevelVo vo) { SetShowPuzzle(vo.LevelExtra.CardId); }
public void Reset() { Level = null; VisitLevel = null; stringBuilder = new StringBuilder(); }
public void SetData(RepeatedField <GameResultPB> result, VisitLevelVo customerSelectedLevel, int exp) { _isVip = GlobalData.PlayerModel.PlayerVo.IsOnVip; _result = result; levelId = customerSelectedLevel.LevelId; transform.Find("Title/Text").GetComponent <Text>().text = customerSelectedLevel.LevelName; _total = 0; _drawActivityDropItemDict = new Dictionary <string, DrawActivityDropItemVo>(); for (int i = 0; i < result.Count; i++) { GameResultPB pb = result[i]; Dictionary <int, RewardVo> rewardDict = new Dictionary <int, RewardVo>(); for (int j = 0; j < pb.Awards.Count; j++) { RewardVo vo = new RewardVo(pb.Awards[j], true); if (rewardDict.ContainsKey(vo.Id)) { rewardDict[vo.Id].Num += vo.Num; } else { rewardDict.Add(vo.Id, vo); } } RectTransform listItem = _content.GetChild(i).GetComponent <RectTransform>(); var isOnVip = GlobalData.PlayerModel.PlayerVo.IsOnVip; if (isOnVip) { listItem.Find("Title/Text2").GetComponent <Text>().text = "+" + exp + I18NManager.Get("Common_VIPExp"); } else { listItem.Find("Title/Text2").GetComponent <Text>().text = "+" + exp + I18NManager.Get("Common_Exp"); } listItem.gameObject.Show(); List <RewardVo> arr = rewardDict.Values.ToList(); var prop = arr[arr.Count - 1]; if (prop.Resource == ResourcePB.Item && prop.Id >= PropConst.CardUpgradePropSmall && prop.Id <= PropConst.CardUpgradePropLarge) { arr.Insert(1, prop); arr.RemoveAt(arr.Count - 1); } if (pb.DroppingItem != null && pb.DroppingItem.Count > 0) { for (int k = 0; k < pb.DroppingItem.Count; k++) { DrawActivityDropItemVo vo = new DrawActivityDropItemVo(pb.DroppingItem[k], arr, HolidayModulePB.ActivityVisiting); _drawActivityDropItemDict.Add(i + "_" + vo.DisplayIndex, vo); _total = vo.TotalNum; } } SetItemReward(listItem, arr, _drawActivityDropItemDict); float height = 440; if (arr.Count > 3) { //2行的情况 height = 766; } float lineY = -height + 5; listItem.sizeDelta = new Vector2(listItem.sizeDelta.x, height); RectTransform linePos = listItem.Find("Line").GetComponent <RectTransform>(); linePos.anchoredPosition = new Vector2(linePos.anchoredPosition.x, lineY); } //显示最终值 foreach (var dropItemVo in _drawActivityDropItemDict) { dropItemVo.Value.TotalNum = _total; } }
public void SetData(VisitBattleResultData data, VisitLevelVo level) { transform.Find("Bg/StarAndGrade/Text/Text").GetComponent <Text>().text = data.Cap.ToString(); //transform.Find("TitleText").GetComponent<Text>().text = level.LevelName; }
public override void SetData(VisitLevelVo vo) { Debug.Log("VisitLevelStoryItem"); base.SetData(vo); }
private void OnShowBattleIntroduction(int arg0) { Debug.Log("OnShowBattleIntroduction:" + arg0); VisitLevelVo vo = _curVisitChapterVo.GetVisitLevelVoById(arg0); //检测星缘解锁条件 if (vo.LevelExtra.CardId != 0 && GlobalData.CardModel.GetUserCardById(vo.LevelExtra.CardId) == null) //星缘 { VisitLevelPreUnlockCardWindow window = PopupManager.ShowWindow <VisitLevelPreUnlockCardWindow>("Visit/Prefabs/VisitLevelPreUnlockCardWindow", Container); window.Init(vo); return; } //检测好感度等级 if (vo.LevelExtra.Favorability != 0) { UserFavorabilityVo favorabilityVo = GlobalData.FavorabilityMainModel.GetUserFavorabilityVo((int)vo.NpcId); if (favorabilityVo != null && favorabilityVo.Level < vo.LevelExtra.Favorability) { ConfirmWindow win = PopupManager.ShowConfirmWindow(I18NManager.Get("Visit_Favorability_NoEnough_Tips", vo.LevelExtra.Favorability), null, I18NManager.Get("Common_Goto")); win.WindowActionCallback = evt => { if (evt == WindowEvent.Ok) { //var isOpen = GuideManager.IsOpen(ModulePB.Favorability, FunctionIDPB.FavorabilityView); //if (!isOpen) //{ // var msg = GuideManager.GetOpenConditionDesc(ModulePB.Favorability, FunctionIDPB.FavorabilityView); // FlowText.ShowMessage(msg); // return; //} ModuleManager.Instance.EnterModule(ModuleConfig.MODULE_FAVORABILITYMAIN, false, false, "SendGift", vo.NpcId); } }; return; } } if (vo.LevelType == LevelTypePB.Story) { int npcId = (int)_curVisitVo.NpcId; bool isShowLoaddown = CacheManager.IsVisitStoryItemLoaddown(npcId); if (!isShowLoaddown) { ModuleManager.Instance.EnterModule(ModuleConfig.MODULE_STORY, false, false, vo); } else { CacheManager.ClickVisitStoryItem(npcId, () => { ModuleManager.Instance.EnterModule(ModuleConfig.MODULE_STORY, false, false, vo); }, () => { ModuleManager.Instance.EnterModule(ModuleConfig.MODULE_STORY, false, false, vo); }); } return; } if (!GlobalData.CardModel.ContainsCardByNpcId(vo.NpcId)) { string name = Util.GetPlayerName(vo.NpcId); PopupManager.ShowAlertWindow(I18NManager.Get("Visit_LevelNoConditionCard", name)); return; } _battleIntroductionPopup = PopupManager.ShowWindow <VisitBattleIntroductionPopup>("Visit/Prefabs/VisitBattleIntroductionPopup"); _battleIntroductionPopup.Init(vo, _curVisitVo); _battleIntroductionPopup.MaskColor = new Color(0, 0, 0, 0.5f); // ClientData.CustomerSelectedLevel = level; }
public void OnExtraPointerClick(VisitLevelVo vo) { Debug.Log("OnExtraPointerClick"); EventDispatcher.TriggerEvent <VisitLevelVo>(EventConst.VisitLevelItemExtraClick, vo); }
public void SetData(VisitLevelVo level) { transform.Find("Text").GetComponent <Text>().text = level.HeroDescription; }
private void OnShowLevelFirstPassItemExtra(VisitLevelVo vo) { visitFirstPassAwardWindow = PopupManager.ShowWindow <VisitFirstPassAwardWindow>("Visit/Prefabs/VisitFirstPassAwardWindow", Container); visitFirstPassAwardWindow.Init(vo); }