Пример #1
0
        private void SetButtonGroupState(UButtonGroup group)
        {
            int nCount = group.transform.childCount;

            for (int i = nCount - 1; i >= 0; --i)
            {
                Transform childTrans = group.transform.GetChild(i);
                if (childTrans)
                {
                    DistrictInfo districtInfo = childTrans.GetComponent <DistrictInfo>();
                    if (districtInfo != null)
                    {
                        UButtonGroupItem item = childTrans.GetComponent <UButtonGroupItem>();
                        if (item != null)
                        {
                            if (districtInfo.CheckEqual(m_serverInfo.nGroup, m_serverInfo.nDistrict, m_serverInfo.nServer))
                            {
                                item.Selected = true;
                            }
                            else
                            {
                                item.Selected = false;
                            }
                        }
                    }
                }
            }
        }
Пример #2
0
        private void UpdateServerList(List <gamelogic_district_info> groupList)
        {
            int nCount = ServerList.transform.childCount;

            for (int i = nCount - 1; i >= 0; --i)
            {
                Transform childTrans = ServerList.transform.GetChild(i);
                if (childTrans)
                {
                    GameObject go = childTrans.gameObject;
                    // 销毁obj
                    ResNode.DestroyRes(ref go);
                }
            }

            for (int i = 0; i < groupList.Count; i++)
            {
                GameObject serverGo = ResNode.InstantiateRes(DefaultServerItem);
                if (serverGo != null)
                {
                    serverGo.transform.SetParent(ServerList.transform, false);
                    serverGo.GetComponent <UButtonGroupItem>().Group = ServerList;
                    serverGo.SetActive(true);

                    Text btnLabel = serverGo.GetComponentInChildren <Text>();
                    if (btnLabel)
                    {
                        btnLabel.text = groupList[i].szName;
                    }

                    //正常
                    if (groupList[i].nState < 2)
                    {
                        Transform icon_Green = serverGo.transform.FindChild("Icon_Green");
                        if (icon_Green)
                        {
                            icon_Green.gameObject.SetActive(true);
                        }
                    }
                    else//爆满
                    {
                        Transform icon_Red = serverGo.transform.FindChild("Icon_Red");
                        if (icon_Red)
                        {
                            icon_Red.gameObject.SetActive(true);
                        }
                    }

                    DistrictInfo districtInfo = serverGo.GetComponent <DistrictInfo>();
                    if (districtInfo != null)
                    {
                        districtInfo.SetData(i, groupList[i].nGroup, groupList[i].nDistrict, groupList[i].nServer);
                    }
                }
            }
        }
Пример #3
0
        private void OnselectedServerChanged(UButtonGroupItem oldItem, UButtonGroupItem newItem)
        {
            DistrictInfo districtInfo = newItem.GetComponent <DistrictInfo>();

            if (districtInfo != null)
            {
                tempServer.nGroup    = districtInfo.GetGroupID();
                tempServer.nDistrict = districtInfo.GetDistrictID();
                tempServer.nServer   = districtInfo.GetServerID();
            }
        }
Пример #4
0
        public void UpdateLastEnterDistrictList()
        {
            int nCount = LastEnterServerList.transform.childCount;

            for (int i = nCount - 1; i >= 0; --i)
            {
                Transform childTrans = LastEnterServerList.transform.GetChild(i);
                if (childTrans)
                {
                    GameObject go = childTrans.gameObject;
                    // 销毁obj
                    ResNode.DestroyRes(ref go);
                }
            }

            m_lastEnterDistrictList = DataCenter.LogicDataCenter.districtListDataManger.LastEnterDistrictInfoList;

            if (m_lastEnterDistrictList == null || m_lastEnterDistrictList.Count < 1)
            {
                return;
            }

            for (int i = 0; i < m_lastEnterDistrictList.Count; i++)
            {
                //最多列5个
                if (i > 5)
                {
                    break;
                }

                GameObject serverGo = ResNode.InstantiateRes(DefaultLastServerItem);
                if (serverGo != null)
                {
                    serverGo.transform.SetParent(LastEnterServerList.transform, false);
                    serverGo.GetComponent <UButtonGroupItem>().Group = LastEnterServerList;
                    serverGo.SetActive(true);

                    Text btnLabel = serverGo.GetComponentInChildren <Text>();
                    if (btnLabel)
                    {
                        btnLabel.text = m_lastEnterDistrictList[i].szName;
                    }

                    DistrictInfo districtInfo = serverGo.GetComponent <DistrictInfo>();
                    if (districtInfo != null)
                    {
                        districtInfo.SetData(i, m_lastEnterDistrictList[i].nGroup, m_lastEnterDistrictList[i].nDistrict, m_lastEnterDistrictList[i].nServer);
                    }
                }
            }
        }