Exemplo n.º 1
0
    /// <summary>
    /// 初始化状态
    /// </summary>
    public void Initialize()
    {
        if (!UIConfig.HasValue)
        {
            return;
        }

        CfgEternityProxy      cfg          = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy;
        GameLocalizationProxy localization = GameFacade.Instance.RetrieveProxy(ProxyName.GameLocalizationProxy) as GameLocalizationProxy;

        //主面板资源
        RootPerfabPath = UIConfig.Value.RootPrefab;
        //图标
        Icon = 0;
        if (UIConfig.Value.TitleLength > 0)
        {
            int icon = 0;
            if (int.TryParse(UIConfig.Value.Title(0), out icon))
            {
                Icon = icon;
            }
        }
        //主标题
        MainTitle = string.Empty;
        if (UIConfig.Value.TitleLength > 1)
        {
            MainTitle = localization.GetString(UIConfig.Value.Title(1));
        }
        //副标题
        SecondaryTitle = string.Empty;
        if (UIConfig.Value.TitleLength > 2)
        {
            SecondaryTitle = localization.GetString(UIConfig.Value.Title(2));
        }
        //背景资源
        BackgroundPath = UIConfig.Value.BgPic;
        //部件ID列表
        PartIDList = UIConfig.Value.GetUiModuleArray();
        //打开音效
        OpenSound = UIConfig.Value.OpenSound;
        //关闭音效
        CloseSound = UIConfig.Value.CloseSound;

        //所有页
        int count = UIConfig.Value.LabelIdLength;

        for (int i = 0; i < count; i++)
        {
            UiLabelConfig?pageCfg = cfg.GetUIPage((uint)(UIConfig.Value.LabelId(i)));
            if (!pageCfg.HasValue)
            {
                continue;
            }

            UIViewPage page = GetPage(i);

            //名称
            page.Name = !string.IsNullOrEmpty(pageCfg.Value.Name) ? localization.GetString(pageCfg.Value.Name) : string.Empty;
            //图标
            page.Icon = pageCfg.Value.Id;
            //布局
            page.ListLayoutMode = pageCfg.Value.ListType == 0 ? UIViewListLayout.Row : UIViewListLayout.Grid;
            //布局切换
            page.ListLayoutAllowChange = pageCfg.Value.ListExchange != 0;

            //排序方式列表
            List <UIViewSortItem> sorters = new List <UIViewSortItem>();
            int sortCount = pageCfg.Value.SortListLength;
            for (int j = 0; j < sortCount; j++)
            {
                UIViewSortKind kind  = (UIViewSortKind)pageCfg.Value.SortList(j);
                string         label = string.Empty;
                if (kind != UIViewSortKind.None)
                {
                    label = localization.GetString("package_title_" + (kind + 1022));
                }

                sorters.Add(new UIViewSortItem()
                {
                    Label = label, Kind = kind
                });
            }
            page.Sorters   = sorters.ToArray();
            page.SortIndex = 0;

            //分类列表
            bool isFilterMode = pageCfg.Value.AssistFunc == 1;
            List <UIViewCategory> categorys    = new List <UIViewCategory>();
            List <ItemType>       allItemTypes = new List <ItemType>();
            int length = pageCfg.Value.CategoryLength;
            for (int j = 0; j < length; j++)
            {
                UiCategoryConfig?categoryCfg = cfg.GetUICategory((uint)pageCfg.Value.Category(j));
                if (categoryCfg.HasValue)
                {
                    UIViewCategory category = new UIViewCategory();

                    if (categoryCfg.Value.Type == 1)
                    {
                        category.Label    = localization.GetString(categoryCfg.Value.LabelName);
                        category.ItemType = new ItemType[] { };
                    }
                    else
                    {
                        ItemType itemType = ItemTypeUtil.GetItemType(categoryCfg.Value.Args);

                        category.Label    = TableUtil.GetLanguageString(itemType.EnumList[itemType.EnumList.Length - 1] as System.Enum);
                        category.ItemType = new ItemType[] { itemType };

                        allItemTypes.Add(itemType);
                    }

                    category.Arguments = categoryCfg.Value.GetOtherArgsArray();

                    categorys.Add(category);
                }
            }

            //附加All
            if (isFilterMode && !string.IsNullOrEmpty(pageCfg.Value.AllLabel))
            {
                UIViewCategory category = new UIViewCategory();
                category.IsAll     = true;
                category.Label     = localization.GetString(pageCfg.Value.AllLabel);
                category.ItemType  = allItemTypes.ToArray();
                category.Arguments = new int[] { };
                categorys.Insert(0, category);
            }

            //
            page.CategoryIndex        = 0;
            page.CategoryIsFilterMode = isFilterMode;
            page.Categorys            = categorys.ToArray();
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// 更新数据
    /// </summary>
    private void UpdateData()
    {
        PackageProxy packageProxy = GameFacade.Instance.RetrieveProxy(ProxyName.PackageProxy) as PackageProxy;

        ClearData();

        UIViewCategory category = State.GetPageCategoryData();

        if (category.ItemType != null)
        {
            if (category.IsAll)
            {
                UIViewPage page = State.GetPage();

                for (int i = 0; i < page.Categorys.Length; i++)
                {
                    if (page.Categorys[i].IsAll)
                    {
                        continue;
                    }

                    category = page.Categorys[i];

                    m_ItemBaseCache.Clear();
                    for (int j = 0; j < category.ItemType.Length; j++)
                    {
                        ItemType itemType = category.ItemType[j];
                        if (itemType == null)
                        {
                            continue;
                        }

                        m_ItemBaseCache.AddRange(packageProxy.FindItemArrayByItemType(itemType, true));
                    }

                    AddDatas(category.Label, m_ItemBaseCache.ToArray());

                    m_ItemBaseCache.Clear();
                }
            }
            else
            {
                m_ItemBaseCache.Clear();

                for (int i = 0; i < category.ItemType.Length; i++)
                {
                    ItemType itemType = category.ItemType[i];
                    if (itemType == null)
                    {
                        continue;
                    }

                    m_ItemBaseCache.AddRange(packageProxy.FindItemArrayByItemType(itemType, true));
                }

                AddDatas(category.Label, m_ItemBaseCache.ToArray());

                m_ItemBaseCache.Clear();
            }
        }

        UpdatePackSize();
    }
Exemplo n.º 3
0
    /// <summary>
    /// 填充面板
    /// </summary>
    private void FillPanel()
    {
        //Debug.Log("刷新界面.................." + m_TeamProxy.GetMembersList().Count);
        int pageIndex   = State.GetPageIndex();
        int filterIndex = State.GetPageCategoryIndex(State.GetPageIndex());

        m_SocialSubClass = (SocialSubClass)filterIndex;
        m_SocialType     = (SocialType)pageIndex;
        List <FriendInfoVO> list         = new List <FriendInfoVO>();
        List <FriendInfoVO> volistNearby = new List <FriendInfoVO>();

        ClearData();
        UIViewCategory category = State.GetPageCategoryData();

        switch (m_SocialType)
        {
        case SocialType.Team:
            m_TeamProxy.SortMembers();
            AddTeamDataToView(m_TeamProxy.GetMembersList());
            // SetRightLabelCapacity(0, m_TeamProxy.GetMembersList().Count, m_TeamProxy.MEMBERCOUNTLIMIT);
            break;

        case SocialType.Friend:
            if (category.IsAll)
            {
                list.Clear();
                UIViewPage page = State.GetPage();
                for (int i = 0; i < page.Categorys.Length; i++)
                {
                    if (page.Categorys[i].IsAll)
                    {
                        continue;
                    }
                    category = page.Categorys[i];
                    if ((SocialSubClass)category.Arguments[0] == SocialSubClass.First)
                    {
                        for (int j = 0; j < m_FriendProxy.GetFriendList().Count; j++)
                        {
                            if (m_FriendProxy.GetFriendList()[j].Status == FriendState.ONLINE)
                            {
                                list.Add(m_FriendProxy.GetFriendList()[j]);
                            }
                        }
                        AddFriendDataToView(list, category.Label);
                        list.Clear();
                    }
                    else if ((SocialSubClass)category.Arguments[0] == SocialSubClass.Second)
                    {
                        for (int k = 0; k < m_FriendProxy.GetFriendList().Count; k++)
                        {
                            if (m_FriendProxy.GetFriendList()[k].Status == FriendState.LEAVE)
                            {
                                list.Add(m_FriendProxy.GetFriendList()[k]);
                            }
                        }
                        AddFriendDataToView(list, category.Label);
                        list.Clear();
                    }
                }
            }
            else
            {
                list.Clear();
                switch ((SocialSubClass)category.Arguments[0])
                {
                case SocialSubClass.First:
                    for (int i = 0; i < m_FriendProxy.GetFriendList().Count; i++)
                    {
                        if (m_FriendProxy.GetFriendList()[i].Status == FriendState.ONLINE)
                        {
                            list.Add(m_FriendProxy.GetFriendList()[i]);
                        }
                    }
                    break;

                case SocialSubClass.Second:
                    list.Clear();
                    for (int i = 0; i < m_FriendProxy.GetFriendList().Count; i++)
                    {
                        if (m_FriendProxy.GetFriendList()[i].Status == FriendState.LEAVE)
                        {
                            list.Add(m_FriendProxy.GetFriendList()[i]);
                        }
                    }
                    break;

                case SocialSubClass.Blacklist:
                    for (int i = 0; i < m_FriendProxy.GetBlackList().Count; i++)
                    {
                        list.Add(m_FriendProxy.GetBlackList()[i]);
                    }
                    break;

                default:
                    break;
                }
                AddFriendDataToView(list, category.Label);
            }
            break;

        case SocialType.Ship:
            list.Clear();
            //SetRightLabelCapacity(2, 0, 0);
            //m_IsOpenTips = false;
            List <FriendInfoVO> listShip = new List <FriendInfoVO>();
            list = listShip;
            AddFriendDataToView(list, null);
            // UIManager.Instance.ClosePanel(PanelName.TipsFriendPanel);
            // SetActiveNullTips(true);
            break;

        case SocialType.Other:
            if (category.IsAll)
            {
                list.Clear();
                UIViewPage page = State.GetPage();
                for (int i = 0; i < page.Categorys.Length; i++)
                {
                    if (page.Categorys[i].IsAll)
                    {
                        continue;
                    }
                    category = page.Categorys[i];
                    if ((SocialSubClass)category.Arguments[0] == SocialSubClass.First)
                    {
                        volistNearby = m_FriendProxy.GetNearbyList();
                        for (int j = 0; j < volistNearby.Count; j++)
                        {
                            list.Add(volistNearby[j]);
                        }
                    }
                    else if ((SocialSubClass)category.Arguments[0] == SocialSubClass.Second)
                    {
                        for (int k = 0; k < m_FriendProxy.GetRecentList().Count; k++)
                        {
                            list.Add(m_FriendProxy.GetRecentList()[k]);
                        }
                    }
                    AddFriendDataToView(list, category.Label);
                    list.Clear();
                }
            }
            else
            {
                list.Clear();
                switch ((SocialSubClass)category.Arguments[0])
                {
                case SocialSubClass.First:
                    volistNearby = m_FriendProxy.GetNearbyList();
                    for (int i = 0; i < volistNearby.Count; i++)
                    {
                        list.Add(volistNearby[i]);
                    }
                    break;

                case SocialSubClass.Second:
                    list.Clear();
                    for (int i = 0; i < m_FriendProxy.GetRecentList().Count; i++)
                    {
                        list.Add(m_FriendProxy.GetRecentList()[i]);
                    }
                    break;

                default:
                    break;
                }
                AddFriendDataToView(list, category.Label);
            }
            break;

        default:
            break;
        }
        //State.SetPageLabel(string.Format(GetLocalization("package_title_1008"), 0, 100));
        RefreshHotKey();
    }
Exemplo n.º 4
0
    /// <summary>
    /// 通过表格获取数据
    /// </summary>
    protected void GetDataByTable(bool includeT = true)
    {
        UIViewCategory category = State.GetPageCategoryData();

        if (category.ItemType != null)
        {
            if (category.IsAll)
            {
                UIViewPage page = State.GetPage();

                for (int i = 0; i < page.Categorys.Length; i++)
                {
                    m_FoundryProxy.GetBluePrintDic().Clear();
                    if (page.Categorys[i].IsAll)
                    {
                        continue;
                    }

                    category = page.Categorys[i];

                    for (int j = 0; j < category.ItemType.Length; j++)
                    {
                        ItemType itemType = category.ItemType[j];
                        if (itemType == null)
                        {
                            continue;
                        }

                        if (includeT)
                        {
                            m_FoundryProxy.FindItemArrayByItemType(itemType, true, m_Grad);
                        }
                        else
                        {
                            m_FoundryProxy.FindItemArrayByItemType(itemType, true, m_Grad, false);
                        }
                    }
                    m_ListTemp = m_FoundryProxy.GetBluePrintDic().Values.ToList();
                    m_GridList = m_ListTemp;
                    AddDatas(category.Label, m_GridList);
                }
            }
            else
            {
                m_FoundryProxy.GetBluePrintDic().Clear();
                for (int i = 0; i < category.ItemType.Length; i++)
                {
                    ItemType itemType = category.ItemType[i];
                    if (itemType == null)
                    {
                        continue;
                    }
                    if (includeT)
                    {
                        m_FoundryProxy.FindItemArrayByItemType(itemType, true, m_Grad);
                    }
                    else
                    {
                        m_FoundryProxy.FindItemArrayByItemType(itemType, true, m_Grad, false);
                    }
                }
                m_ListTemp = m_FoundryProxy.GetBluePrintDic().Values.ToList();
                m_GridList = m_ListTemp;
                AddDatas(category.Label, m_GridList);
            }
        }
    }