コード例 #1
0
 public void CreateMenu(string title, Page page, bool canClose)
 {
     if (menuPages.Keys.Contains(title))
     {
         (UIElement as WindowMain).PageFrame.Content = menuPages[title];
     }
     else
     {
         (UIElement as WindowMain).PageFrame.Content = page;
         MenuButton button = new MenuButton();
         button.CanClose    = canClose;
         button.Text        = title;
         button.ButtonStyle = MenuButtonStyle.DGrayBlue;
         button.Close((s, e) => {
             menuPages.Remove(title);
             menuButtons.Remove(title);
             (UIElement as WindowMain).MenuPanel.Children.Remove(button);
             if ((UIElement as WindowMain).MenuPanel.Children.Count == 1)
             {
                 (UIElement as WindowMain).PageFrame.Content = (mainPage.UIElement as Page);
             }
         });
         button.Click((s, e) => {
             (UIElement as WindowMain).PageFrame.Content = page;
             FocusButton(title);
         });
         (UIElement as WindowMain).MenuPanel.Children.Add(button);
         menuPages.Add(title, page);
         menuButtons.Add(title, button);
     }
     //FocusButton(title);
 }
コード例 #2
0
    private void SetButton()
    {
        //Debug.Log("2222"+ directoryPathData.filePathData[0].fileInfos[0]);

        FileInfo fileInfo = directoryPathData.filePathData[0].fileInfos[0];

        Title.text = directoryPathData.filePathData[0].directoryInfo.Name;
        fileInfos  = directoryPathData.filePathData[0].fileInfos;
        Debug.Log("文件个数:" + fileInfos.Count);
        Debug.Log(directoryPathData.filePathData[0].directoryInfo.Name);
        if (directoryPathData.filePathData[0].directoryInfo.Name.Contains("贵金属展示"))
        {
            Debug.Log("第一个文件夹是贵金属展示");
            foreach (Transform item in ContentGroup)
            {
                item.gameObject.SetActive(false);
            }
            NobleMetalControl.Instance.Open();
        }
        else
        {
            SetContent(-1);
        }


        int v = 0;

        foreach (var item in directoryPathData.filePathData)
        {
            MenuButton menuButton = GameObject.Instantiate(contentButton, ButtonGroup);
            menuButtons.Add(menuButton);
            menuButton.Init(item.directoryInfo.Name);
            menuButton.OnClick += OnClick;
            if (v > 2)
            {
                menuButton.Close();
            }

            v++;
        }

        if (v > 2)
        {
            UP.gameObject.SetActive(true);
            Down.gameObject.SetActive(true);
        }
        else
        {
            UP.gameObject.SetActive(false);
            Down.gameObject.SetActive(false);
        }
    }
コード例 #3
0
    public override void Hide()
    {
        base.Hide();
        NobleMetalControl.Instance.Hide();
        transform.DOLocalMoveX(-1920, hideTweenTime);
        UP.Close();
        Down.Close();

        for (int i = 0; i < contentControls.Length; i++)
        {
            contentControls[i].Close();
        }
        for (int i = 0; i < menuButtons.Count; i++)
        {
            GameObject.Destroy(menuButtons[i].gameObject);
        }
        menuButtons.Clear();
        PlayerManager.Instance.onPlayerGestureEvent -= OnPlayerGesture;

        buttonIndex = 0;
        ButtonGroup.DOLocalMoveY((0) + (100 + 20) * 1.5f, 0.5f);
    }