private void UpdateChildrenCallback(int index, Transform trans) { int count = _getServerCount(); if (index >= count) { trans.gameObject.SetActive(false); return; } cdnServerInfo serverInfo = _getServerInfo(index); if (serverInfo == null) { return; } Button button = trans.GetComponent <Button>(); button.onClick.RemoveAllListeners(); button.onClick.AddListener(() => { OnServerBtnClick(serverInfo.serverId, trans); }); Text txtServerName = trans.Find("ServerName").GetComponent <Text>(); txtServerName.text = "S" + serverInfo.serverId + "." + serverInfo.serverName; //Image itemIcon = trans.Find("ItemIcon").GetComponent<Image>(); //itemIcon.overrideSprite = Resources.Load(itemData.m_ItemCfg.m_Icon, typeof(Sprite)) as Sprite; }
private void _showSuggestServer() { cdnServerInfo info = LoginModel.Instance.GetShowServer(); if (info == null) { return; } m_txtSuggestServer.text = "S" + info.serverId + "." + info.serverName; m_btnSuggestServer.gameObject.SetActive(true); }
private uint _getNewestServerId() { uint maxId = 0; for (int i = 0; i < _cdnInfo.serverList.Count; ++i) { cdnServerInfo serverInfo = _cdnInfo.serverList[i]; _serverMap[serverInfo.serverId] = serverInfo; if (serverInfo.serverId > maxId) { maxId = serverInfo.serverId; } } return(maxId); }
private int _getServerCount() { if (m_serverTabType == EServerTabType.AllServer) { return(NoticeModel.Instance.GetServerCount()); } else if (m_serverTabType == EServerTabType.SuggetServer) { cdnServerInfo info = NoticeModel.Instance.GetNewServer(); if (info == null) { return(0); } return(1); } else if (m_serverTabType == EServerTabType.BelongServer) { // return(LoginModel.Instance.GetUserCount()); } return(0); }