コード例 #1
0
    MyWindow MakeTests()
    {
        var window = new MyWindow(ButtonSprite, "Tests", new Rect(0, 0, kMenuWidth, kMenuHeight));
        var scroll = new MyScrollBar(ButtonSprite);

        var scrollView = new MyList(ButtonSprite, new Rect(78, 0, 200, 241));
        scrollView.SetAnchor(new Vector2(0.5f, 0), new Vector2(1, 1));
        scrollView.Element.GetComponent<RectTransform>().offsetMin = new Vector2(0, 0);
        scrollView.Element.GetComponent<RectTransform>().offsetMax = new Vector2(-20, 0);

        folder = stateMenu.StateFolder[stateMenu.CurrentAssembly][stateMenu.CurrentLevel];
        var data = new LoadingData
        {
            AssemblyName = stateMenu.CurrentAssembly,
            Level = stateMenu.CurrentLevel
        };

        foreach (var e in folder.GetChildrenTests())
        {
            if (e.State != 0 && TestDispatcher.LastTestExecution.ContainsKey(e.NameTest))
                TestDispatcher.LastTestExecution[e.NameTest] = e.State == 1;
            else if (e.State != 0 && !TestDispatcher.LastTestExecution.ContainsKey(e.NameTest))
                TestDispatcher.LastTestExecution.Add(e.NameTest, e.State == 1);
        }

        var buttonTest = TestButton(folder, ButtonSprite, data, backgroundStateTest);

        folderIsLoad = true;
        var scrollR = scrollView.Element.GetComponent<ScrollRect>();
        scrollR.scrollSensitivity = 10;
        scrollR.verticalScrollbar = scroll.Element.GetComponent<Scrollbar>();
        scrollView.Element.name = "ScrollView";
        window.AddElement(scrollView);
        buttonTest.Element.name = "HeadButton";
        scrollView.MainElement.AddElement(buttonTest);
        scrollView.MainElement.Element.AddComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize;

        window.AddElement(scroll);

        return window;
    }