public void UpdateData(GC_GUILD_RET_LIST list) { m_GuildInfoList.Clear(); for (int i = 0; i < list.guildGuidCount; ++i) { GuildPreviewInfo info = new GuildPreviewInfo(); info.GuildGuid = list.GetGuildGuid(i); if (info.GuildGuid == GlobeVar.INVALID_GUID) { continue; } if (i < list.guildNameCount) { info.GuildName = list.GetGuildName(i); } if (i < list.guildLevelCount) { info.GuildLevel = list.GetGuildLevel(i); } if (i < list.guildChiefNameCount) { info.GuildChiefName = list.GetGuildChiefName(i); } if (i < list.guildMemberNumCount) { info.GuildCurMemberNum = list.GetGuildMemberNum(i); } if (i < list.guildCombatCount) { info.GuildCombatValue = list.GetGuildCombat(i); } if (i < list.isEnemyGuildCount) { info.IsEnemyGuild = (list.GetIsEnemyGuild(i) == 1); } if (i < list.guildApplyNumCount) { info.GuildCurApplyNum = list.GetGuildApplyNum(i); } if (i < list.guildApplyMaxNumCount) { info.GuildMaxApplyNum = list.GetGuildApplyMaxNum(i); } if (i < list.GuildDeclarationCount) { info.GuildDeclaration = list.GetGuildDeclaration(i); } m_GuildInfoList.Add(info); } }
private void LoadGuildListItemPageChange(GameObject resItem, object param) { if (null == resItem) { return; } m_GuildPageLable.text = string.Format("{0}/{1}", m_nCurGuildListPage, m_nMaxGuildListPage); Utils.CleanGrid(m_GuildListGrid); List <GuildPreviewInfo> list = GameManager.gameManager.PlayerDataPool.guildList.GuildInfoList; if (null == list) { return; } //填充数据 int nGuildListStartIndex = (m_nCurGuildListPage - 1) * m_nGuildNumPerPage; int nSelectCount = 0; for (; nGuildListStartIndex < list.Count; ++nGuildListStartIndex) { if (nSelectCount >= m_nGuildNumPerPage) { break; } if (list.Count > nGuildListStartIndex) { GuildPreviewInfo info = list[nGuildListStartIndex]; //如果需要筛选 敌对帮会 则跳过非敌对的帮会 if (m_bIsOnlyShowEnemyGuild && info.IsEnemyGuild == false) { continue; } if (info.GuildGuid != GlobeVar.INVALID_GUID) { GameObject newGuildListItem = Utils.BindObjToParent(resItem, m_GuildListGrid, nGuildListStartIndex.ToString()); if (null != newGuildListItem && null != newGuildListItem.GetComponent <GuildListItemLogic>()) { newGuildListItem.GetComponent <GuildListItemLogic>().Init(info); } nSelectCount++; } } } m_GuildListGrid.GetComponent <UIGrid>().Reposition(); //m_GuildListGrid.GetComponent<UITopGrid>().Recenter(true); }
private bool m_applyListIsFull = false; // 帮会申请队列是否满 //根据数据初始化控件 public void Init(GuildPreviewInfo info) { //判断数据合法性 if (info.GuildGuid == GlobeVar.INVALID_GUID) { return; } if (m_GuildJoinButton == null || m_GuildChallengeButton == null || m_EnemyGuildSpirit == null) { return; } m_GuildGuid = info.GuildGuid; Obj_MainPlayer _mainPlayer = Singleton <ObjManager> .GetInstance().MainPlayer; if (_mainPlayer == null) { return; } int GuildJob = GameManager.gameManager.PlayerDataPool.GuildInfo.GetMemberJob(_mainPlayer.GUID); m_GuildChallengeButton.gameObject.SetActive(false); m_EnemyGuildSpirit.gameObject.SetActive(false); m_GuildJoinButton.gameObject.SetActive(false); //如果是敌对状态 则显示 if (info.IsEnemyGuild) { m_EnemyGuildSpirit.gameObject.SetActive(true); } //如果玩家自己没有帮会并且该帮会不是玩家已经提交申请的帮会,则显示加入帮会按钮 else if (GameManager.gameManager.PlayerDataPool.GuildInfo.GuildGuid == GlobeVar.INVALID_GUID) { if (GameManager.gameManager.PlayerDataPool.GuildInfo.PreserveGuildGuid.Contains(m_GuildGuid)) { m_GuildJoinButton.isEnabled = false; m_GuildJoinLabel.text = StrDictionary.GetClientDictionaryString("#{10360}"); m_canBeJoined = false; m_applyListIsFull = false; } else if (info.GuildCurMemberNum >= info.GuildMaxMemberNum || info.GuildCurApplyNum >= info.GuildMaxApplyNum) { m_GuildJoinButton.isEnabled = false; m_GuildJoinLabel.text = StrDictionary.GetClientDictionaryString("#{10359}"); m_canBeJoined = false; m_applyListIsFull = (info.GuildCurApplyNum >= info.GuildMaxApplyNum); } else { m_GuildJoinButton.isEnabled = true; m_GuildJoinLabel.text = StrDictionary.GetClientDictionaryString("#{10359}"); m_canBeJoined = true; m_applyListIsFull = false; } m_GuildJoinButton.gameObject.SetActive(true); } //会长或者副会长可以看到 约战按钮 else if (GameManager.gameManager.PlayerDataPool.GuildInfo.GuildGuid != GlobeVar.INVALID_GUID && GameManager.gameManager.PlayerDataPool.GuildInfo.GuildGuid != m_GuildGuid && //不是自己的帮会 (GuildJob == (int)(int)Games.GlobeDefine.GameDefine_Globe.GUILD_JOB.CHIEF || GuildJob == (int)(int)Games.GlobeDefine.GameDefine_Globe.GUILD_JOB.VICE_CHIEF)) { m_GuildChallengeButton.gameObject.SetActive(true); } //填充数据 if (null != m_GuildNameLabel) { m_GuildNameLabel.text = info.GuildName; } if (null != m_GuildChiefNameLabel) { m_GuildChiefNameLabel.text = info.GuildChiefName; } if (null != m_GuildLevelLabel) { m_GuildLevelLabel.text = info.GuildLevel.ToString(); } if (null != m_GuildMemberNumLabel) { m_GuildMemberNumLabel.text = info.GuildCurMemberNum.ToString() + "/" + info.GuildMaxMemberNum.ToString(); } if (null != m_GuildCombatLable) { if (info.GuildCombatValue < 10000) { m_GuildCombatLable.text = info.GuildCombatValue.ToString(); } else { m_GuildCombatLable.text = StrDictionary.GetClientDictionaryString("#{2972}", info.GuildCombatValue / 10000); } } if (null != m_DeclarationLabel) { m_DeclarationLabel.text = info.GuildDeclaration; } if (null != m_WholeDeclarationLabel) { m_WholeDeclarationLabel.text = info.GuildDeclaration; } }
//Bundle加载帮会列表结束 void OnLoadGuildListItem(GameObject resItem, object param) { if (null == resItem) { LogModule.ErrorLog("load Guild List item fail"); return; } Utils.CleanGrid(m_GuildListGrid); List <GuildPreviewInfo> list = GameManager.gameManager.PlayerDataPool.guildList.GuildInfoList; list = GuildList.GuildSort(list); if (null == list) { return; } //计算最大页数和当前页数 m_nCurGuildListPage = 1; if (m_bIsOnlyShowEnemyGuild) { int nEnemyCount = 0; for (int i = 0; i < list.Count; ++i) { if (list[i].IsEnemyGuild) { nEnemyCount++; } } m_nMaxGuildListPage = (int)(nEnemyCount / m_nGuildNumPerPage) + 1; } else { m_nMaxGuildListPage = (int)(list.Count / m_nGuildNumPerPage) + 1; } m_GuildPageLable.text = string.Format("{0}/{1}", m_nCurGuildListPage, m_nMaxGuildListPage); //填充数据 int nGuildListStartIndex = (m_nCurGuildListPage - 1) * m_nGuildNumPerPage; int nSelectCount = 0; for (; nGuildListStartIndex < list.Count; ++nGuildListStartIndex) { if (nSelectCount >= m_nGuildNumPerPage) { break; } if (list.Count > nGuildListStartIndex) { GuildPreviewInfo info = list[nGuildListStartIndex]; //如果需要筛选 敌对帮会 则跳过非敌对的帮会 if (m_bIsOnlyShowEnemyGuild && info.IsEnemyGuild == false) { continue; } if (info.GuildGuid != GlobeVar.INVALID_GUID) { GameObject newGuildListItem = Utils.BindObjToParent(resItem, m_GuildListGrid, nGuildListStartIndex.ToString()); if (null != newGuildListItem && null != newGuildListItem.GetComponent <GuildListItemLogic>()) { newGuildListItem.GetComponent <GuildListItemLogic>().Init(info); } nSelectCount++; } } } //Grid排序,防止列表异常 if (m_GuildListGrid.GetComponent <UIGrid>() != null) { m_GuildListGrid.GetComponent <UIGrid>().Reposition(); } if (m_GuildListGrid.GetComponent <UITopGrid>() != null) { //m_GuildListGrid.GetComponent<UITopGrid>().Recenter(true); } //根据等级处理创建帮会按钮 if (null != Singleton <ObjManager> .GetInstance().MainPlayer&& null != m_CreateGuildBtn) { if (Singleton <ObjManager> .GetInstance().MainPlayer.BaseAttr.Level >= GlobeVar.CREATE_GUILD_LEVEL) { m_CreateGuildBtn.gameObject.SetActive(true); } else { m_CreateGuildBtn.gameObject.SetActive(false); } } }
public void RefreshSearchResult(GC_GUILD_SEARCH pak) { if (pak.NoneResult == 1) { m_NoneResultLabel.SetActive(true); } else { m_NoneResultLabel.SetActive(false); for (int i = 0; i < pak.guildGuidCount; ++i) { GuildPreviewInfo info = new GuildPreviewInfo(); info.GuildGuid = pak.GetGuildGuid(i); if (info.GuildGuid == GlobeVar.INVALID_GUID) { continue; } if (i < pak.guildNameCount) { info.GuildName = pak.GetGuildName(i); } if (i < pak.guildLevelCount) { info.GuildLevel = pak.GetGuildLevel(i); } if (i < pak.guildChiefNameCount) { info.GuildChiefName = pak.GetGuildChiefName(i); } if (i < pak.guildMemberNumCount) { info.GuildCurMemberNum = pak.GetGuildMemberNum(i); } if (i < pak.guildCombatCount) { info.GuildCombatValue = pak.GetGuildCombat(i); } if (i < pak.isEnemyGuildCount) { info.IsEnemyGuild = (pak.GetIsEnemyGuild(i) == 1); } if (i < pak.guildApplyNumCount) { info.GuildCurApplyNum = pak.GetGuildApplyNum(i); } if (i < pak.guildApplyMaxNumCount) { info.GuildMaxApplyNum = pak.GetGuildApplyMaxNum(i); } if (i < pak.GuildDeclarationCount) { info.GuildDeclaration = pak.GetGuildDeclaration(i); } string szItemName = i < 10 ? "0" + i.ToString() : i.ToString(); GameObject GuildListItem = Utils.BindObjToParent(m_GuildListItem, m_GuildListGrid, szItemName); if (GuildListItem != null && GuildListItem.GetComponent <GuildListItemLogic>() != null) { GuildListItem.GetComponent <GuildListItemLogic>().Init(info); } } if (m_GuildListGrid.GetComponent <UIGrid>() != null) { m_GuildListGrid.GetComponent <UIGrid>().Reposition(); } } }