public void OnOfflineTogChanged(bool bSelect) { CurSelectItem = null; ListKinMember.DataSource.BeginUpdate(); ListKinMember.DataSource.Clear(); List <cmd_kin_membernode> KinMemberList = LogicDataCenter.kinDataManager.LegendKinMemberList; for (int i = 0; i < KinMemberList.Count; ++i) { cmd_kin_membernode cmdNodeData = KinMemberList[i]; UListItemKinMember item = new UListItemKinMember(); Toggle tOffLineTog = OffLineTog.GetComponent <Toggle>(); if (!tOffLineTog.isOn && cmdNodeData.bIsOnline == 0) { // 隐藏不在线玩家 continue; } item.IdentityID = cmdNodeData.nIdentity; item.PlayerID = cmdNodeData.dwPDBID; item.GradIcon += cmdNodeData.szGradeName; item.PersonIcon = cmdNodeData.nFaceID; item.PersonName += cmdNodeData.szName; item.Power = cmdNodeData.dwBattleVal; item.PowerRank += cmdNodeData.dwBVOrder; item.GameState = cmdNodeData.byGameState; item.Level += cmdNodeData.nLevel; item.isOnline = cmdNodeData.bIsOnline; item.nSex = cmdNodeData.nSex; item.nLastOrder = cmdNodeData.dwLastOrder; item.nBVOrder = cmdNodeData.dwBVOrder; PopupAction = new UPopupAction(); if (EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_ID) != item.PlayerID) { PopupAction.Add(UPopupItemDataGetPlayerDetail.GetDescString(), new UPopupItemDataGetPlayerDetail(item.PlayerID)); PopupAction.Add(UPopupItemDataTeamInvite.GetDescString(), new UPopupItemDataTeamInvite(item.PlayerID)); PopupAction.Add(UPopupItemDataTeamRequest.GetDescString(), new UPopupItemDataTeamRequest(item.PlayerID)); } item.PopupAction = PopupAction; ListKinMember.DataSource.Add(item); } // 排序 IEnumerable <UListItemKinMember> ListQuery = from item in ListKinMember.DataSource orderby item.isOnline descending, item.IdentityID descending, item.Power descending select item; UIWidgets.ObservableList <UListItemKinMember> dataSource = new UIWidgets.ObservableList <UListItemKinMember>(); foreach (UListItemKinMember Item in ListQuery) { dataSource.Add(Item); } ListKinMember.DataSource = dataSource; ListKinMember.DataSource.EndUpdate(); }
public virtual void SetData(UListItemClanMember item) { if (DefalutBGSprite == null) { DefalutBGSprite = ComponentBG.sprite; } if (item.data.nSex < (int)PERSON_SEX.SEX_MAX && item.data.nSex >= (int)PERSON_SEX.SEX_MALE) { SexIcon.enabled = true; // 这里使用战队那边的,重复资源没必要再弄一份 SexIcon.sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_KinSex, WndID.WND_ID_SOCIALCONTACT, item.data.nSex + 1); } else { SexIcon.enabled = false; } actorName.text = item.data.szName; if ((item.data.nIdentity == (int)EMClanIdentity.EMCLANIDENTITY_SHAIKH) && (LogicDataCenter.clanDataManager.ClanBaseData.nShaikhState == (int)EMClanShaikhState.ClanShaikhState_Outgoing)) { actorName.text += "(卸任)"; } job.text = LogicDataCenter.clanDataManager.GetClanIdentityName(item.data.nIdentity); level.text = item.data.nLevel.ToString(); gaveThisWeek.text = item.data.nDonateThisWeek.ToString() + "/" + item.data.nDonateTotal; power.text = item.data.dwBattleVal.ToString(); rank.text = item.data.dwBVOrder.ToString(); if (Convert.ToInt32(item.data.dwBVOrder) <= (int)EMClanOrderMax.EMCLANORDERMAX) { rank.enabled = false; rankImg.enabled = true; // 这里使用战队那边的,重复资源没必要再弄一份 rankImg.sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_KinBattleOrder, WndID.WND_ID_SOCIALCONTACT, item.data.dwBVOrder); } else { rank.enabled = true; rankImg.enabled = false; } int nChangeOrder = item.data.dwLastOrder - item.data.dwBVOrder; if (item.data.dwLastOrder == 0) { nChangeOrder = 0; } sortChange.text = nChangeOrder.ToString(); if (nChangeOrder >= 0) { changeImage.sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_ClanRankChange, WndID.WND_ID_SOCIALCONTACT, 1); Color clr; ColorUtility.TryParseHtmlString("#fb8507", out clr); sortChange.color = clr; } else { changeImage.sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_ClanRankChange, WndID.WND_ID_SOCIALCONTACT, 2); Color clr; ColorUtility.TryParseHtmlString("#71bf81", out clr); sortChange.color = clr; } grade.text = item.data.szGrade; kinName.text = item.data.szKinName; int nGameState = item.data.nIsOnline == 0 ? (int)ACTOR_GAME_STATE.GAME_STATE_OFFLINE : item.data.nGameStatus; string strStateColor = UDefines.GetGameStateColor(nGameState); string strStateDesc = UDefines.GetGameStateDesc(nGameState); status.text = String.Format("<color=#{0}>{1}</color>", strStateColor, ULocalizationService.Instance.Get("UIView", "Common", strStateDesc)); if (item.data.nIsOnline > 0) { Color clr; ColorUtility.TryParseHtmlString("#FFFFFF", out clr); actorName.color = clr; job.color = clr; level.color = clr; gaveThisWeek.color = clr; power.color = clr; rank.color = clr; grade.color = clr; kinName.color = clr; } else { Color clr; ColorUtility.TryParseHtmlString("#adadad", out clr); status.color = clr; actorName.color = clr; job.color = clr; level.color = clr; gaveThisWeek.color = clr; power.color = clr; rank.color = clr; grade.color = clr; kinName.color = clr; } m_nMemberID = item.data.nPDBID; if (popupMenuHandle == null) { popupMenuHandle = gameObject.AddComponent <UPopupMenuHandle>(); } int nHeroID = 0; int nHeroKinID = 0; if (EntityFactory.MainHeroView != null) { nHeroID = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_ID); nHeroKinID = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_KIN); m_bSelf = item.data.nPDBID == nHeroID ? true : false; // 设置显示图片 setComponentBG(0); } if (m_nMemberID != nHeroID) { UPopupAction popupAction = new UPopupAction(); popupAction.Add(UPopupItemDataTeamInvite.GetDescString(), new UPopupItemDataTeamInvite(m_nMemberID)); popupAction.Add(UPopupItemDataTeamRequest.GetDescString(), new UPopupItemDataTeamRequest(m_nMemberID)); popupAction.Add(UPopupItemDataGetPlayerDetail.GetDescString(), new UPopupItemDataGetPlayerDetail(m_nMemberID)); popupAction.Add(UPopupItemDataAddFriend.GetDescString(), new UPopupItemDataAddFriend(0, actorName.text)); popupAction.Add(UPopupItemDataCopyName.GetDescString(), new UPopupItemDataCopyName(item.data.szName)); if (item.data.nIsOnline > 0 && GameLogicAPI.isMainMap((int)item.data.dwSceneID)) { popupAction.Add(UPopupItemDataTransmitTo.GetDescString(), new UPopupItemDataTransmitTo((int)item.data.dwWorldID, (int)item.data.serverID, (int)item.data.dwSceneID)); } if (item.data.nIdentity == (int)EMClanIdentity.EMCLANIDENTITY_ELDER) { popupAction.Add(ULocalizationService.Instance.Get("UIView", "PopupMenu", "ClanSetLeader"), new UListComponentItemDataPopup(OnSetLeader)); } if (item.data.nKinID != nHeroKinID) { popupAction.Add(ULocalizationService.Instance.Get("UIView", "PopupMenu", "ClanKick"), new UListComponentItemDataPopup(OnKick)); } popupMenuHandle.HandlePopupAction = popupAction; } }
public virtual void SetData(UListItemTaskReply reply) { if (reply == null) { return; } // 楼层 ReplyIndex.text = String.Format("{0}楼", reply.nIndex); // 文字 ReplyName.text = reply.node.szReplyName; ReplyContent.text = reply.node.szReplyContent; // 性别 if (reply.node.byReplySex < (byte)PERSON_SEX.SEX_MAX && reply.node.byReplySex >= (byte)PERSON_SEX.SEX_MALE) { ReplySexIcon.gameObject.SetActive(true); ReplySexIcon.sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_KinSex, WndID.WND_ID_TASK_UNFOLD, reply.node.byReplySex + 1); HeadIcon.gameObject.SetActive(true); HeadIcon.sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_PlayerHead, WndID.WND_ID_TASK_UNFOLD, 1, reply.node.byReplySex + 1); } else { ReplySexIcon.gameObject.SetActive(false); HeadIcon.gameObject.SetActive(false); } // 时间 DateTime replyTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Unspecified).AddSeconds(reply.node.nReplyTime); replyTime = replyTime.ToLocalTime(); int nGapTime = reply.nServerTime - reply.node.nReplyTime; if (nGapTime < 60)//1分钟 { ReplyTime.text = String.Format("{0}秒前", nGapTime); } else if (nGapTime < 3600)//1小时 { ReplyTime.text = String.Format("{0}分钟前", nGapTime / 60); } else if (nGapTime < 24 * 3600)//1天 { ReplyTime.text = String.Format("{0}小时前", nGapTime / 3600); } else if (nGapTime < 2 * 24 * 3600)//2天 { ReplyTime.text = String.Format("昨天 {0:D2}:{1:D2}", replyTime.Hour, replyTime.Minute); } else if (nGapTime < 3 * 24 * 3600)//3天 { ReplyTime.text = String.Format("前天 {0:D2}:{1:D2}", replyTime.Hour, replyTime.Minute); } else { ReplyTime.text = String.Format("{0}-{1}-{2} {3:D2}:{4:D2}", replyTime.Year, replyTime.Month, replyTime.Day, replyTime.Hour, replyTime.Minute); } // 右键弹窗 int nSelfID = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_ID); int nTargetID = reply.node.nReplyPDBID; if (nTargetID > 0 && nTargetID != nSelfID) { UPopupAction PopupAction = new UPopupAction(); PopupAction.Add(UPopupItemDataAddFriend.GetDescString(), new UPopupItemDataAddFriend(reply.node.nReplyUserID, reply.node.szReplyName)); PopupAction.Add(UPopupItemDataGetPlayerDetail.GetDescString(), new UPopupItemDataGetPlayerDetail(nTargetID)); PopupAction.Add(UPopupItemDataTeamInvite.GetDescString(), new UPopupItemDataTeamInvite(nTargetID)); PopupAction.Add(UPopupItemDataTeamRequest.GetDescString(), new UPopupItemDataTeamRequest(nTargetID)); PopupAction.Add(UPopupItemDataBuddyChat.GetDescString(), new UPopupItemDataBuddyChat(nTargetID)); PopupAction.Add(UPopupItemDataPrivateChat.GetDescString(), new UPopupItemDataPrivateChat(reply.node.szReplyName)); ReplyMenuHandle.HandlePopupAction = PopupAction; } }
// 更新展开界面 public void UpdateUnfoldWndView() { ClearView(); // 解析数据(首胜奖励) bool bFirstWinType = m_unfoldTask.nTaskType == (int)ENTASK_TYPE.ENTASK_TYPE_FIRSTWIN; int nFirstWinState = 0; if (bFirstWinType && !String.IsNullOrEmpty(m_unfoldTask.szHit) && m_unfoldTask.szHit.Length > 1) { string strFirstWinState = m_unfoldTask.szHit.Substring(1, 1); nFirstWinState = Int32.Parse(strFirstWinState); } if (bFirstWinType) { m_unfoldTask.szDescription = ULocalizationService.Instance.Get("UIView", "Task", "FirstWinNormalDesc"); if (nFirstWinState == 1) { m_unfoldTask.szDescription = ULocalizationService.Instance.Get("UIView", "Task", "FirstWinHalfDesc"); } } // 设置显示 if (m_unfoldTask.llContactID <= 0) { InputFieldGo.SetActive(false); TaskReplyGo.SetActive(false); this.gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(774.0f, 240.0f); } else if (m_unfoldTask.listReply.Count <= 0) { InputFieldGo.SetActive(true); TaskReplyGo.SetActive(false); this.gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(774.0f, 370.0f); } else { InputFieldGo.SetActive(true); TaskReplyGo.SetActive(true); this.gameObject.GetComponent <RectTransform>().sizeDelta = new Vector2(774.0f, 586.0f); } WarRecordRT.gameObject.SetActive(m_unfoldTask.llTagID > 0); FinishRT.gameObject.SetActive(m_unfoldTask.nTaskState == (int)Task_State_Type.TaskStateType_Finish); GotoRT.gameObject.SetActive(m_unfoldTask.nClientLink > 0 && m_unfoldTask.nTaskState == (int)Task_State_Type.TaskStateType_Accept); // 设置任务 if (String.IsNullOrEmpty(m_unfoldTask.szName)) { TaskName.text = String.Format(ULocalizationService.Instance.Get("UIView", "Task", "UnfoldTitle"), m_unfoldTask.strPublishName); } else { TaskName.text = m_unfoldTask.szName; } TaskGo.SetActive(m_unfoldTask.nTaskID > 0); string strPoccess = ""; if (!String.IsNullOrEmpty(m_unfoldTask.szHit)) { strPoccess = m_unfoldTask.szHit; } else if (m_unfoldTask.nTaskState == (int)Task_State_Type.TaskStateType_Finish) { strPoccess = "(1/1)"; } else { strPoccess = "(0/1)"; } string strDesc = String.Format("{0},{1}{2}", m_unfoldTask.szDescription, ULocalizationService.Instance.Get("UIView", "Task", "NowPoccess"), strPoccess); UBB.toHtml(ref strDesc); Description.text = strDesc; if (TaskStarLevel.Length == (int)Task_Level.Level_3) { int nTaskLevel = TaskConfig.Instance.GetTaskLevel(m_unfoldTask.nTaskID, m_unfoldTask.nTaskType, m_unfoldTask.nTaskSubType, m_unfoldTask.nTaskSpecificType);; TaskStarLevel[0].gameObject.SetActive(nTaskLevel >= (int)Task_Level.Level_2); TaskStarLevel[1].gameObject.SetActive(nTaskLevel >= (int)Task_Level.Level_2); TaskStarLevel[2].gameObject.SetActive(nTaskLevel >= (int)Task_Level.Level_3); } // 设置首胜,特殊处理 if (m_unfoldTask.nTaskState == (int)Task_State_Type.TaskStateType_End) { Description.text = m_unfoldTask.szDescription; int nRemianTime = LogicDataCenter.taskDataManager.FirstWinRemainTime; int nHour = nRemianTime / 3600; int nMin = nRemianTime % 3600 / 60; FirstWinReflushTime.text = String.Format("{0}{1:D2}:{2:D2}", ULocalizationService.Instance.Get("UIView", "Task", "FirstWinRemainDesc"), nHour, nMin); FirstWinReflushTime.gameObject.SetActive(true); m_fFirstWinCoolTime = Time.unscaledTime; } else { FirstWinReflushTime.gameObject.SetActive(false); } // 设置发布者 PublisherGo.SetActive(m_unfoldTask.llContactID > 0); PublisherHead.sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_PlayerHead, WndID.WND_ID_TASK_UNFOLD, 1, 1); PublisherName.text = m_unfoldTask.strPublishName; EmotionWords.text = m_unfoldTask.strEmotionWords; if (m_unfoldTask.nPublishSex < (int)PERSON_SEX.SEX_MAX && m_unfoldTask.nPublishSex >= (int)PERSON_SEX.SEX_MALE) { PublisherSex.gameObject.SetActive(true); PublisherSex.sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_KinSex, WndID.WND_ID_TASK_UNFOLD, m_unfoldTask.nPublishSex + 1); PublisherHead.gameObject.SetActive(true); PublisherHead.sprite = USpriteManager.Instance.GetSprite(USpriteManager.ESpriteType.EST_PlayerHead, WndID.WND_ID_TASK_UNFOLD, 1, m_unfoldTask.nPublishSex + 1); } else { PublisherSex.gameObject.SetActive(false); PublisherHead.gameObject.SetActive(false); } int nSelfID = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_ID); int nTargetID = m_unfoldTask.nPublishPDBID; // 右键弹窗 if (nTargetID > 0 && nTargetID != nSelfID) { UPopupAction PopupAction = new UPopupAction(); PopupAction.Add(UPopupItemDataAddFriend.GetDescString(), new UPopupItemDataAddFriend(m_unfoldTask.nPublishUserID, m_unfoldTask.strPublishName)); PopupAction.Add(UPopupItemDataGetPlayerDetail.GetDescString(), new UPopupItemDataGetPlayerDetail(nTargetID)); PopupAction.Add(UPopupItemDataTeamInvite.GetDescString(), new UPopupItemDataTeamInvite(nTargetID)); PopupAction.Add(UPopupItemDataTeamRequest.GetDescString(), new UPopupItemDataTeamRequest(nTargetID)); PopupAction.Add(UPopupItemDataBuddyChat.GetDescString(), new UPopupItemDataBuddyChat(nTargetID)); PopupAction.Add(UPopupItemDataPrivateChat.GetDescString(), new UPopupItemDataPrivateChat(m_unfoldTask.strPublishName)); PublishMenuHandle.HandlePopupAction = PopupAction; } // 设置回复 int nReplyCount = m_unfoldTask.listReply.Count; TaskReplyList.DataSource.Clear(); ObservableList <UListItemTaskReply> dataSource = new ObservableList <UListItemTaskReply>(); foreach (var item in m_unfoldTask.listReply) { UListItemTaskReply node = new UListItemTaskReply(); node.nIndex = nReplyCount--; node.nServerTime = m_unfoldTask.nServerTime; node.node = item; dataSource.Add(node); } TaskReplyList.DataSource = dataSource; // 设置奖励 for (int i = 0; i < TASK_PRIZE_ITEM_COUNT; i++) { if (m_unfoldTask.arrayPrize != null && i < m_unfoldTask.arrayPrize.Length) { // 第二个首胜奖励 bool bShowClan = m_unfoldTask.nTaskType == (int)ENTASK_TYPE.ENTASK_TYPE_FIRSTWIN && i >= 1; // 第二个首胜奖励,且完成1态 bool bShowNoHave = bShowClan && m_unfoldTask.nTaskState == (int)Task_State_Type.TaskStateType_Finish && nFirstWinState == 1; m_arrTaskPrizeItem[i].SetData(m_unfoldTask.arrayPrize[i].nPrizeID, m_unfoldTask.arrayPrize[i].nCount, bFirstWinType, bShowClan, bShowNoHave); } else { m_arrTaskPrizeItem[i].Clear(); } } PrizePopupGo.SetActive(false); }
// 邀请组队 private void ProcessTeamInivite(int nEntityID) { uint nPDBID = GameLogicAPI.getPlayerPDBID(nEntityID); if (nPDBID == 0) { return; } EntityView ev = EntityFactory.getEntityViewByID(nEntityID); if (ev == null) { return; } // 对方已有队伍不能邀请 int nTeamID = ev.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_TEAMID); if (nTeamID > 0) { return; } UListComponentItemDataPopup item = new UPopupItemDataTeamInvite((int)nPDBID, _strItemTypeName: UPopupItemDataTeamInvite.GetDescString()); PopupMenuDataManager.Instance.SetPopupItemData(m_teamInviteRegistInfo, ref item); }
public void SetKinMemberData() { ListKinMember.DataSource.Clear(); ListKinMember.OnSelect.RemoveListener(OnSelectKinMember); ListKinMember.onRightClick.RemoveListener(OnSelectKinMember); cmd_kin_basedata cmdHead = LogicDataCenter.kinDataManager.LegendKinBaseData; List <cmd_kin_membernode> listData = LogicDataCenter.kinDataManager.LegendKinMemberList; UIWidgets.ObservableList <UListItemKinMember> dataSource = new UIWidgets.ObservableList <UListItemKinMember>(); ListKinMember.DataSource.Clear(); for (int i = 0; i < cmdHead.nMemberCount; ++i) { GameLogic.cmd_kin_membernode cmdNodeData = listData[i]; UListItemKinMember item = new UListItemKinMember(); Toggle tOffLineTog = OffLineTog.GetComponent <Toggle>(); if (!tOffLineTog.isOn && cmdNodeData.bIsOnline == 0) { // 隐藏不在线玩家 continue; } item.IdentityID = cmdNodeData.nIdentity; item.PlayerID = cmdNodeData.dwPDBID; item.GradIcon += cmdNodeData.szGradeName; item.PersonIcon = cmdNodeData.nFaceID; item.PersonName += cmdNodeData.szName; item.Power += cmdNodeData.dwBattleVal; item.PowerRank += cmdNodeData.dwBVOrder; item.GameState = cmdNodeData.byGameState; item.Level += cmdNodeData.nLevel; item.isOnline = cmdNodeData.bIsOnline; item.nSex = cmdNodeData.nSex; item.nLastOrder = cmdNodeData.dwLastOrder; item.nBVOrder = cmdNodeData.dwBVOrder; PopupAction = new UPopupAction(); if (EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_ID) != item.PlayerID) { PopupAction.Add(UPopupItemDataGetPlayerDetail.GetDescString(), new UPopupItemDataGetPlayerDetail(item.PlayerID)); PopupAction.Add(UPopupItemDataTeamInvite.GetDescString(), new UPopupItemDataTeamInvite(item.PlayerID)); PopupAction.Add(UPopupItemDataTeamRequest.GetDescString(), new UPopupItemDataTeamRequest(item.PlayerID)); } item.PopupAction = PopupAction; dataSource.Add(item); } // 排序 IEnumerable <UListItemKinMember> ListQuery = from item in dataSource orderby item.isOnline descending, item.IdentityID descending, item.Power descending select item; UIWidgets.ObservableList <UListItemKinMember> tDataSource = new UIWidgets.ObservableList <UListItemKinMember>(); foreach (UListItemKinMember Item in ListQuery) { tDataSource.Add(Item); } ListKinMember.DataSource = tDataSource; ListKinMember.OnSelect.AddListener(OnSelectKinMember); ListKinMember.onRightClick.AddListener(OnSelectKinMember); // 设置战队基本数据 KinName.text = cmdHead.szKinName; KinShaikhName.text = cmdHead.szShaikhName; KinLevel.text = cmdHead.nKinLevel.ToString(); TotalMemberInfo.text = cmdHead.nOnlineCount + " / " + cmdHead.nMemberCount + "( " + ULocalizationService.Instance.Get("UIView", "KinMember", "MaxCountDes") + cmdHead.nKinMaxMember + ")"; TotalFight.text = cmdHead.nTotalFight.ToString(); TotalOrder.text = cmdHead.nFightOrder.ToString(); KinLabel.text = cmdHead.szKinLabel; MatchResult.text = cmdHead.nMatchWinNum + " / " + cmdHead.nMatchTotalNum; GoldAward.SetData(cmdHead.nGoldNum); SilverAward.SetData(cmdHead.nSilverNum); KinNoticeDes.text = cmdHead.szNotice; }