public void OnShowLegndCupPrizeWnd(long lLegendCupID) { cmd_legendcup_recv_cuplist_node cupBaseData = LogicDataCenter.legendCupDataManager.GetSingleLegendCupNode(lLegendCupID); if (cupBaseData.nLegendCupID == 0) { return; } TotalBonusCount.text = cupBaseData.nCompetitionBonus.ToString(); // 清空DetailPrizeFrame int nCount = DetailPrizeFrame.childCount; for (int j = nCount - 1; j >= 0; j--) { Transform childTrans = DetailPrizeFrame.GetChild(j); if (childTrans) { var temp = childTrans.gameObject; ResNode.DestroyRes(ref temp); } } SSchemeLegendCupConfig cupConfig = LegendCupConfig.Instance.GetCupConfig(cupBaseData.nCupConfigID); if (cupConfig == null) { return; } List <SSchemeLegendCupPrizeConfig> prizeConfigList = LegendCupConfig.Instance.GetCupPrizeConfig(cupConfig.nPrizeConfigID); if (prizeConfigList == null) { return; } m_DetailPrizeItems = new LegendCupDetailPrizeItem[prizeConfigList.Count]; for (int i = 0; i < prizeConfigList.Count; i++) { GameObject detailPrizeObj = ResNode.InstantiateRes(DetailPrizeTemplate); if (!detailPrizeObj) { return; } RectTransform rectTrans = detailPrizeObj.transform as RectTransform; rectTrans.SetParent(DetailPrizeFrame, false); m_DetailPrizeItems[i] = detailPrizeObj.GetComponent <LegendCupDetailPrizeItem>(); if (!m_DetailPrizeItems[i]) { return; } m_DetailPrizeItems[i].SetData(prizeConfigList[i], cupBaseData.nCompetitionBonus); } DetailPrizeTemplate.SetActive(false); }
public void OnChangedCupConfigDd(int nIndex) { DeadlineDd.options.Clear(); m_curCupConfig = LegendCupConfig.Instance.GetCupConfig(m_nCupIDList[nIndex]); for (int i = 0; i < m_curCupConfig.nDeadline.Length; i++) { DeadlineDd.options.Add(new Dropdown.OptionData(m_curCupConfig.nDeadline[i] + ULocalizationService.Instance.Get("UIView", "LegendCupCreate", "Day"))); } DeadlineDd.captionText.text = DeadlineDd.options.First().text; CreateGold.text = m_curCupConfig.nCreateNeedMoney.ToString(); }
public void OnLegendCupCreateWndOpen(cmd_legendcup_recv_create_cup_type_info typeInfo) { m_nCreateType = typeInfo.byLegendCupType; SSchemeLegendCupTypeConfig typeConfig = LegendCupConfig.Instance.GetCupTypeConfig((int)typeInfo.byLegendCupType); if (typeConfig == null) { return; } m_nCupIDList = typeInfo.bIsFreeCreate > 0 ? typeConfig.nFreeCupConfigIDList : typeConfig.nChargeCupconfigIDList; CupConfigNameDd.onValueChanged.RemoveListener(OnChangedCupConfigDd); CupConfigNameDd.options.Clear(); SSchemeLegendCupConfig cupConfig = null; for (int i = 0; i < m_nCupIDList.Length; i++) { cupConfig = LegendCupConfig.Instance.GetCupConfig(m_nCupIDList[i]); if (cupConfig == null) { continue; } CupConfigNameDd.options.Add(new Dropdown.OptionData(cupConfig.sCupConfigViewName)); } CupConfigNameDd.onValueChanged.AddListener(OnChangedCupConfigDd); // 默认选择要求:战队杯赛第一组第一个,联盟杯赛选符合人数限制(都不符合选最后一个) int nSelectIndex = 0; if (typeInfo.byLegendCupType == (int)ELegendCupType.emCupType_Clan) { int nClanMemberCount = LogicDataCenter.clanDataManager.ClanBaseData.nMemberCount; nSelectIndex = -1; for (int i = 0; i < m_nCupIDList.Length; i++) { cupConfig = LegendCupConfig.Instance.GetCupConfig(m_nCupIDList[i]); if (cupConfig == null) { continue; } SSchemeLegendCupLimitConfig limitConfig = LegendCupConfig.Instance.GetCupLimitConfig(cupConfig.nConfigID); if (limitConfig == null) { continue; } if (nClanMemberCount >= limitConfig.nCountLimit) { nSelectIndex = i; break; } } if (nSelectIndex < 0) { nSelectIndex = m_nCupIDList.Length - 1; } } // 设置下拉框默认选中项 if (nSelectIndex < 0 || nSelectIndex >= CupConfigNameDd.options.Count) { return; } CupConfigNameDd.captionText.text = CupConfigNameDd.options.ElementAt(nSelectIndex).text; m_curCupConfig = LegendCupConfig.Instance.GetCupConfig(m_nCupIDList[nSelectIndex]); DeadlineDd.options.Clear(); for (int i = 0; i < m_curCupConfig.nDeadline.Length; i++) { DeadlineDd.options.Add(new Dropdown.OptionData(m_curCupConfig.nDeadline[i] + ULocalizationService.Instance.Get("UIView", "LegendCupCreate", "Day"))); } DeadlineDd.captionText.text = DeadlineDd.options.First().text; CreateGold.text = m_curCupConfig.nCreateNeedMoney.ToString(); RegistGoldIF.placeholder.GetComponent <Text>().text = m_curCupConfig.nRegistNeedMoney.ToString(); // 联盟杯赛不设密码 if (typeInfo.byLegendCupType == (int)ELegendCupType.emCupType_Clan) { PassWordIF.DeactivateInputField(); } else { PassWordIF.ActivateInputField(); } // 免费杯赛不设费用 if (typeInfo.bIsFreeCreate > 0) { RegistGoldIF.DeactivateInputField(); } else { RegistGoldIF.ActivateInputField(); } }
public virtual void SetData(UListItemLegendCup item) { if (item.nIndex <= 0) { BgIcon.gameObject.SetActive(true); ItemView.SetActive(false); BgIcon.raycastTarget = false; return; } BgIcon.gameObject.SetActive(true); BgIcon.raycastTarget = true; ItemView.SetActive(true); m_lLegendCupID = item.data.nLegendCupID; string strHour = ULocalizationService.Instance.Get("UIView", "LegendCupRegist", "Hour"); string strMinute = ULocalizationService.Instance.Get("UIView", "LegendCupRegist", "Minute"); LockIconTip.SetText(UTooltipParamName.BodyText, ULocalizationService.Instance.Get("UIView", "LegendCupList", "LockIconTip")); ClanIconTip.SetText(UTooltipParamName.BodyText, ULocalizationService.Instance.Get("UIView", "LegendCupList", "ClanIconTip")); OnlineIconTip.SetText(UTooltipParamName.BodyText, ULocalizationService.Instance.Get("UIView", "LegendCupList", "OnlineIconTip")); ItemIndex.text = item.nIndex.ToString(); CupName.text = item.data.szCupName; CreaterName.text = item.data.szCreateActorName; SSchemeLegendCupConfig cupConfig = LegendCupConfig.Instance.GetCupConfig(item.data.nCupConfigID); CupConfigName.text = cupConfig.sCupConfigName; CompetitionBonus.text = item.data.nCompetitionBonus.ToString(); if (item.data.nIsEnd > 0) { Deadline.text = ULocalizationService.Instance.Get("UIView", "LegendCupList", "EndDesc"); } else if (item.data.nRegistLeftTime > 0) { int nDeadline = item.data.nRegistLeftTime / 60; int nDeadlineHour = nDeadline / 60; int nDeadlineMin = nDeadline % 60; Deadline.text = ULocalizationService.Instance.Get("UIView", "LegendCupList", "LeftTimeDesc") + nDeadlineHour + strHour + nDeadlineMin + strMinute; } else { Deadline.text = ULocalizationService.Instance.Get("UIView", "LegendCupList", "CompetitioningDesc"); } KinNum.text = item.data.nCurrentKinNum + "/" + item.data.nMaxKinNum; LockIcon.gameObject.SetActive(item.data.nIsLock > 0); ClanIcon.gameObject.SetActive(item.data.nIsClanLimit > 0); OnlineIcon.gameObject.SetActive(item.data.nIsOnline > 0); Color clr = new Color(); if (item.data.nIsSelfIn > 0) { ColorUtility.TryParseHtmlString("#d1ac63", out clr); } else { ColorUtility.TryParseHtmlString("#ffffff", out clr); } ItemIndex.color = clr; CupName.color = clr; CreaterName.color = clr; CupConfigName.color = clr; CompetitionBonus.color = clr; Deadline.color = clr; KinNum.color = clr; }
public void OnRecvKinList(long nCupID) { kinlist = LogicDataCenter.legendCupDataManager.GetSingleRegistKinInfo(nCupID); if (kinlist == null) { return; } nLegendCupID = nCupID; nSelfKinID = LogicDataCenter.kinDataManager.KinBaseData.nKinID; // 控制按钮状态 if (EntityFactory.MainHeroView != null) { nSelfPDBID = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_ID); } cmd_legendcup_recv_cuplist_node cupBaseData = LogicDataCenter.legendCupDataManager.GetSingleLegendCupNode(nLegendCupID); if (cupBaseData.nLegendCupID == 0) { return; } SysTitleDes.text = cupBaseData.szCupName; CreaterDes.gameObject.SetActive(!String.IsNullOrEmpty(cupBaseData.szCreateActorName)); CreaterDes.text = string.Format("举办人:{0}", cupBaseData.szCreateActorName); bIsCupCreater = (cupBaseData.nCreaterPDBID == nSelfPDBID); bIsSelfIn = (cupBaseData.nIsSelfIn > 0); bIsOnline = (cupBaseData.nIsOnline > 0); bIsRegistState = (kinlist.headInfo.nRegistLeftTime > 0); bIsKinShaikh = (LogicDataCenter.kinDataManager.KinBaseData.dwShaikhID == nSelfPDBID); RegistKinNum.text = kinlist.headInfo.nCurKinCount + "/" + kinlist.headInfo.nMaxKinNum; if (bIsRegistState) { // 设置报名阶段按钮、倒计时 SetRegistStateButtons(); } else { // 设置确认比赛名单阶段按钮、倒计时 SetReleaseStateButtons(); } LegendCupRegistList.onRightClick.RemoveListener(OnSelectCupItem); LegendCupRegistList.OnSelect.RemoveListener(OnSelectCupItem); LegendCupRegistList.DataSource.Clear(); ObservableList <UListItemLegendCupRegist> dataSource = new ObservableList <UListItemLegendCupRegist>(); int nIndex = 1; foreach (cmd_legendcup_recv_regist_kinlistnode node in kinlist.nodeInfo) { UListItemLegendCupRegist item = new UListItemLegendCupRegist(); item.nIndex = nIndex; item.data = node; dataSource.Add(item); nIndex++; } m_AllDataSource = new ObservableList <UListItemLegendCupRegist>(dataSource); LegendCupRegistList.DataSource = dataSource; LegendCupRegistList.OnSelect.AddListener(OnSelectCupItem); LegendCupRegistList.onRightClick.AddListener(OnSelectCupItem); //// 默认选择第一条 //ClearKinMemberFrame(); //if (dataSource.Count > 0) //{ // LegendCupRegistList.Select(0); //} TotalBonusCount.text = cupBaseData.nCompetitionBonus.ToString(); // 清空DetailPrizeFrame int nCount = DetailPrizeFrame.childCount; for (int j = nCount - 1; j >= 0; j--) { Transform childTrans = DetailPrizeFrame.GetChild(j); if (childTrans) { var temp = childTrans.gameObject; ResNode.DestroyRes(ref temp); } } SSchemeLegendCupConfig cupConfig = LegendCupConfig.Instance.GetCupConfig(cupBaseData.nCupConfigID); if (cupConfig == null) { return; } List <SSchemeLegendCupPrizeConfig> prizeConfigList = LegendCupConfig.Instance.GetCupPrizeConfig(cupConfig.nPrizeConfigID); if (prizeConfigList == null) { return; } DetailPrizeTemplate.SetActive(true); for (int i = 0; i < prizeConfigList.Count; i++) { GameObject detailPrizeObj = ResNode.InstantiateRes(DetailPrizeTemplate); if (!detailPrizeObj) { return; } RectTransform rectTrans = detailPrizeObj.transform as RectTransform; rectTrans.SetParent(DetailPrizeFrame, false); LegendCupDetailPrizeItem detailPrizeItems = detailPrizeObj.GetComponent <LegendCupDetailPrizeItem>(); if (!detailPrizeItems) { return; } detailPrizeItems.SetData(prizeConfigList[i], cupBaseData.nCompetitionBonus); } if (prizeConfigList.Count < SinglePagePrizeMaxCount) { for (int j = prizeConfigList.Count; j < SinglePagePrizeMaxCount; ++j) { GameObject detailPrizeObj = ResNode.InstantiateRes(DetailPrizeTemplate); if (!detailPrizeObj) { return; } RectTransform rectTrans = detailPrizeObj.transform as RectTransform; rectTrans.SetParent(DetailPrizeFrame, false); LegendCupDetailPrizeItem tempItems = detailPrizeObj.GetComponent <LegendCupDetailPrizeItem>(); if (!tempItems) { return; } tempItems.ClearData(); } } DetailPrizeTemplate.SetActive(false); CupConfigName.text = cupConfig.sCupConfigName; LockIconTip.SetText(UTooltipParamName.BodyText, ULocalizationService.Instance.Get("UIView", "LegendCupList", "LockIconTip")); OnlineIconTip.SetText(UTooltipParamName.BodyText, ULocalizationService.Instance.Get("UIView", "LegendCupList", "OnlineIconTip")); LockIcon.gameObject.SetActive(cupBaseData.nIsLock > 0); OnlineIcon.gameObject.SetActive(cupBaseData.nIsOnline > 0); }
public void SetKinGloryData() { cmd_kin_glory_head gloryHead = LogicDataCenter.kinDataManager.LegendGloryHead; GloryKinName.text = gloryHead.szKinName; int nTotalNum = gloryHead.nWinNum + gloryHead.nLoseNum; GloryTotalNum.text = nTotalNum.ToString(); GloryWinNum.text = gloryHead.nWinNum.ToString(); int nWinPro = nTotalNum > 0 ? (gloryHead.nWinNum * 100 / nTotalNum) : 0; GloryWinPro.text = String.Format("{0}%{1}", nWinPro, ULocalizationService.Instance.Get("UIView", "Common", "WinRate")); GloryWinSlider.value = (float)gloryHead.nWinNum / nTotalNum; GloryWinSlider.maxValue = 1; GloryGodNum.text = gloryHead.nGodNum.ToString(); Glory5KillNum.text = gloryHead.n5KillNum.ToString(); Glory4KillNum.text = gloryHead.n4KillNum.ToString(); Glory3KillNum.text = gloryHead.n3KillNum.ToString(); GloryDeathNum.text = gloryHead.nDeathNum.ToString(); GloryKillNum.text = gloryHead.nKillNum.ToString(); GloryAssistNum.text = gloryHead.nAssistNum.ToString(); ListKinGloryCup.DataSource.BeginUpdate(); ListKinGloryCup.DataSource.Clear(); ObservableList <UListItemKinGloryCup> dataSource = new ObservableList <UListItemKinGloryCup>(); List <cmd_kin_glory_node> gloryNodeList = LogicDataCenter.kinDataManager.LegendGloryNodeList; for (int i = 0; i < gloryNodeList.Count; i++) { cmd_kin_glory_node nodeData = gloryNodeList[i]; SSchemeLegendCupConfig cupConfig = LegendCupConfig.Instance.GetCupConfig(nodeData.nCupConfigID); if (cupConfig == null) { continue; } // 8强赛保留12名,16强赛保留123名,32强赛保留前8名 if (cupConfig.nMaxKinNum > 0 && cupConfig.nMaxKinNum <= 8 && nodeData.nCupRank > 2) { continue; } else if (cupConfig.nMaxKinNum > 8 && cupConfig.nMaxKinNum <= 16 && nodeData.nCupRank > 3) { continue; } else if (cupConfig.nMaxKinNum > 16 && cupConfig.nMaxKinNum <= 32 && nodeData.nCupRank > 8) { continue; } UListItemKinGloryCup item = new UListItemKinGloryCup(); item.nCupRank = nodeData.nCupRank; item.MatchName = nodeData.szCupName; item.llLegendCupID = nodeData.llLegendCupId; item.nCupConfigID = nodeData.nCupConfigID; item.nEndTime = nodeData.nEndTime; item.ConfigName = cupConfig.sCupConfigName; dataSource.Add(item); } ListKinGloryCup.DataSource = dataSource; ListKinGloryCup.DataSource.EndUpdate(); }