public void OnRecvKinListData(IntPtr ptr, int nLen) { IntPtrVaArgParseHelper helper = new IntPtrVaArgParseHelper(ptr, nLen); m_KinListHead = helper.get <GameLogic.cmd_kin_list_head>(); for (int i = 0; i < m_KinListHead.nKinCount; ++i) { GameLogic.cmd_kin_list_node cmdNodeData = helper.get <GameLogic.cmd_kin_list_node>(); // 添加到数据管理中心 m_KinListNode[cmdNodeData.dwID] = cmdNodeData; } UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_KIN_REQUESTKINLIST, null); }
public void onRecvKinList() { // 有战队时只显示返回Btn if (LogicDataCenter.kinDataManager.IsKinBaseDataValid()) { KinCreateBtn.SetActive(false); KinApplyBtn.SetActive(false); KinDetailBtn.SetActive(true); } else { KinCreateBtn.SetActive(true); KinApplyBtn.SetActive(true); KinDetailBtn.SetActive(false); } ListKin.OnSelect.RemoveListener(onSelectKin); ListKin.DataSource.Clear(); AllDataSource.Clear(); cmd_kin_list_head listHead = LogicDataCenter.kinDataManager.KinListHead; Dictionary <int, cmd_kin_list_node> listData = LogicDataCenter.kinDataManager.KinListData; UIWidgets.ObservableList <UListItemKin> dataSource = new UIWidgets.ObservableList <UListItemKin>(); int nIndex = 1; ICollection <cmd_kin_list_node> kinList = LogicDataCenter.kinDataManager.SortKinList(listData.Values); if (kinList != null) { foreach (cmd_kin_list_node keyValue in kinList) { GameLogic.cmd_kin_list_node cmdNodeData = keyValue; UListItemKin item = new UListItemKin(); item.nIndex = nIndex; item.KinID = cmdNodeData.dwID; item.Name += cmdNodeData.szName; item.MasterName += cmdNodeData.szShaikhName; item.Count += cmdNodeData.nMemberCount; if (cmdNodeData.dwLeftMemberCount > 0) { item.KinDes = String.Format(ULocalizationService.Instance.Get("UIView", "KinList", "KinMemberLeftDes"), cmdNodeData.dwLeftMemberCount); } else { item.KinDes = ULocalizationService.Instance.Get("UIView", "KinList", "MemberFull"); } if (cmdNodeData.bIsApply > 0) { item.ApplyDes = ULocalizationService.Instance.Get("UIView", "KinList", "HaveApply"); item.ApplyDes = "<color=#18F00F>" + item.ApplyDes + "</color>"; } else { if (cmdNodeData.bAutoAccpet > 0) { string sexDes = string.Empty; if (((TKinAutoFlag)cmdNodeData.dwAcceptFlag & TKinAutoFlag.emKinAuto_AllSex) == TKinAutoFlag.emKinAuto_AllSex) { sexDes = ULocalizationService.Instance.Get("UIView", "KinList", "AcceptNoSexLimitDes"); } else { if (((TKinAutoFlag)cmdNodeData.dwAcceptFlag & TKinAutoFlag.emKinAuto_Male) == TKinAutoFlag.emKinAuto_Male) { sexDes = ULocalizationService.Instance.Get("UIView", "KinList", "AcceptMaleDes"); } else if (((TKinAutoFlag)cmdNodeData.dwAcceptFlag & TKinAutoFlag.emKinAuto_Female) == TKinAutoFlag.emKinAuto_Female) { sexDes = ULocalizationService.Instance.Get("UIView", "KinList", "AcceptFemleDes"); } } item.ApplyDes = String.Format(ULocalizationService.Instance.Get("UIView", "KinList", "AutoAcceptDes"), cmdNodeData.nLevelLimit, sexDes); } else { item.ApplyDes = ULocalizationService.Instance.Get("UIView", "KinList", "NotSetAcceptDes"); } item.ApplyDes = "<color=#C0A47B>" + item.ApplyDes + "</color>"; } dataSource.Add(item); nIndex++; } } m_nMaxPage = (dataSource.Count % pageMaxItemCount == 0) ? dataSource.Count / pageMaxItemCount : dataSource.Count / pageMaxItemCount + 1; // 保存全部数据 供还原查询数据用 UListItemKin[] temp = new UListItemKin[dataSource.Count]; dataSource.CopyTo(temp); foreach (UListItemKin Item in temp) { AllDataSource.Add(Item); } ListKin.DataSource = dataSource; ListKin.OnSelect.AddListener(onSelectKin); // 显示当前的页数数据 m_nCurPage = m_nMaxPage == 0 ? 0 : 1; ShowPageText(); }