コード例 #1
0
 public void SetData(MainMenuIconItemInfo info, Action <string> callBack)
 {
     Row   = info.Row;
     Index = info.Index;
     m_Icon.SetSprite(info.AtlasName, info.IconName);
     m_Lock.gameObject.SetActive(info.IsLockActive);
     m_RedDot.gameObject.SetActive(info.IsRedDotActive);
     m_Text.text           = info.ActivityName;
     m_OpenWinName         = info.OpenWinName;
     m_OnIconClickCallBack = callBack;
     m_Trans.DOLocalMove(new Vector3(81, 35, 0), 0.1f * Index).SetAutoKill(false).Pause().OnComplete(() =>
     {
         gameObject.SetActive(false);
         IsPlaying = false;
     }).OnRewind(() =>
     {
         IsPlaying = false;
     });
 }
コード例 #2
0
    public void UpdateMainMenuIcon(bool isHide = false)
    {
        //加载图标

        List <MainMenuIcon1Entity> menuIcon1List = MainMenuIcon1DBModel.Instance.GetList();

        SortUtil.Sort(menuIcon1List, "Weight", true);
        List <MainMenuIcon2Entity> menuIcon2List = MainMenuIcon2DBModel.Instance.GetList();

        SortUtil.Sort(menuIcon2List, "Weight", true);
        GameObject obj = ResourcesManager.Instance.LoadItem("MainCity/MainMenuIconItem");

        for (int i = 0; i < menuIcon1List.Count; i++)
        {
            if (menuIcon1List[i].ShowLevel > GlobalInit.Instance.CurrPlayer.CurrRoleInfo.Level)
            {
                continue;
            }
            GameObject           itemObj = Instantiate(obj);
            MainMenuIconItem     item    = itemObj.GetComponent <MainMenuIconItem>();
            MainMenuIconItemInfo info    = new MainMenuIconItemInfo();
            bool isLockIcon = false;
            if (menuIcon1List[i].LimitLevel > GlobalInit.Instance.CurrPlayer.CurrRoleInfo.Level)
            {
                isLockIcon = true;
            }
            else
            {
                isLockIcon = false;
            }
            info.Row            = 1;
            info.Index          = i + 1;
            info.AtlasName      = menuIcon1List[i].AtlasName;
            info.IconName       = menuIcon1List[i].IconName;
            info.IsLockActive   = isLockIcon;
            info.IsRedDotActive = UnityEngine.Random.Range(1, 10) > 5;
            info.ActivityName   = menuIcon1List[i].Name;
            info.OpenWinName    = menuIcon1List[i].OpenWindowName;
            item.SetData(info, OnMenuIconClickCallBack);
            m_MenuIconItemList.Add(item);
            if (i == menuIcon1List.Count - 1)
            {
                m_LastPlayOverItem = item;
            }
        }
        for (int i = 0; i < menuIcon2List.Count; i++)
        {
            if (menuIcon2List[i].ShowLevel > GlobalInit.Instance.CurrPlayer.CurrRoleInfo.Level)
            {
                continue;
            }
            GameObject           itemObj = Instantiate(obj);
            MainMenuIconItem     item    = itemObj.GetComponent <MainMenuIconItem>();
            MainMenuIconItemInfo info    = new MainMenuIconItemInfo();
            bool isLockIcon = false;
            if (menuIcon2List[i].LimitLevel > GlobalInit.Instance.CurrPlayer.CurrRoleInfo.Level)
            {
                isLockIcon = true;
            }
            else
            {
                isLockIcon = false;
            }
            info.Row            = 2;
            info.Index          = i + 1;
            info.AtlasName      = menuIcon2List[i].AtlasName;
            info.IconName       = menuIcon2List[i].IconName;
            info.IsLockActive   = isLockIcon;
            info.IsRedDotActive = UnityEngine.Random.Range(1, 10) > 5;
            info.ActivityName   = menuIcon2List[i].Name;
            info.OpenWinName    = menuIcon2List[i].OpenWindowName;
            item.SetData(info, OnMenuIconClickCallBack);
            m_MenuIconItemList.Add(item);
            if (info.Index > m_LastPlayOverItem.Index)
            {
                m_LastPlayOverItem = item;
            }
        }
        MainMenuAndMapView.Instance.SetMainMenu(m_MenuIconItemList, OnShowOrHideCallBack);
        if (isHide)
        {
            OnShowOrHideCallBack();
        }
    }