コード例 #1
0
        public void SetupControls()
        {
            //  Title Bar:
            m_title       = AddUIComponent <UIMainTitleBar>();
            m_title.title = "American RoadSigns " + Mod.version;

            //  Tabs:
            panelTabs                  = AddUIComponent <UITabstrip>();
            panelTabs.size             = new Vector2(UIUtils.c_modPanelInnerWidth, UIUtils.c_tabButtonHeight);
            panelTabs.relativePosition = new Vector2(UIUtils.c_spacing, UIUtils.c_titleBarHeight + UIUtils.c_spacing);

            //  Tab Buttons:
            //  Road signs:
            roadSignsButton           = UIUtils.CreateTab(panelTabs, "Road signs", true);
            roadSignsButton.tooltip   = "";
            roadSignsButton.width     = UIUtils.c_tabButtonWidth;
            roadSignsButton.height    = UIUtils.c_tabButtonHeight;
            roadSignsButton.textScale = 0.9f;
            //  Roadside props:
            roadPropsButton           = UIUtils.CreateTab(panelTabs, "Road props");
            roadPropsButton.tooltip   = "";
            roadPropsButton.width     = UIUtils.c_tabButtonWidth;
            roadPropsButton.height    = UIUtils.c_tabButtonHeight;
            roadPropsButton.textScale = 0.9f;
            //  Tab Button Events:
            roadSignsButton.eventClick += (c, e) => TabClicked(c, e);
            roadPropsButton.eventClick += (c, e) => TabClicked(c, e);

            //  Main Panel:
            UIPanel body = AddUIComponent <UIPanel>();

            body.width  = UIUtils.c_modPanelInnerWidth;
            body.height = UIUtils.c_modPanelInnerHeight;
            //  ScrollRect
            body.relativePosition = new Vector3(5, 36 + 28 + 5);

            //  Section Panels:
            //  Road signs Panel:
            roadSignsPanel                  = body.AddUIComponent <UIRoadSignsPanel>();
            roadSignsPanel.name             = "roadSignsPanel";
            roadSignsPanel.width            = UIUtils.c_modPanelInnerWidth;
            roadSignsPanel.height           = UIUtils.c_modPanelInnerHeight;
            roadSignsPanel.relativePosition = Vector3.zero;
            roadSignsPanel.isVisible        = true;
            //  Roadside props Panel:
            roadPropsPanel                  = body.AddUIComponent <UIRoadPropsPanel>();
            roadPropsPanel.name             = "roadPropsPanel";
            roadPropsPanel.width            = UIUtils.c_modPanelInnerWidth;
            roadPropsPanel.height           = UIUtils.c_modPanelInnerHeight;
            roadPropsPanel.relativePosition = Vector3.zero;
            roadPropsPanel.isVisible        = false;
        }
コード例 #2
0
        public void SetupControls()
        {
            //  Title Bar:
            m_title       = AddUIComponent <UIMainTitleBar>();
            m_title.title = "American RoadSigns " + Mod.version;

            //  Tabs:
            panelTabs = AddUIComponent <UITabstrip>();
            panelTabs.relativePosition = new Vector2(10, AmericanRoadsignsTool.TITLE_HEIGHT + AmericanRoadsignsTool.SPACING);
            panelTabs.size             = new Vector2(AmericanRoadsignsTool.WIDTH - (3 * AmericanRoadsignsTool.SPACING), AmericanRoadsignsTool.TABS_HEIGHT);

            //  Tab Buttons:
            //  Road signs:
            roadSignsButton           = UIUtils.CreateTab(panelTabs, "Road signs", true);
            roadSignsButton.tooltip   = "";
            roadSignsButton.textScale = 0.8f;
            roadSignsButton.width     = 130f;
            //  Roadside props:
            roadPropsButton           = UIUtils.CreateTab(panelTabs, "Road props");
            roadPropsButton.tooltip   = "";
            roadPropsButton.textScale = 0.8f;
            roadPropsButton.width     = 130f;
            //  Tab Button Events:
            roadSignsButton.eventClick += (c, e) => TabClicked(c, e);
            roadPropsButton.eventClick += (c, e) => TabClicked(c, e);

            //  Main Panel:
            UIPanel body = AddUIComponent <UIPanel>();

            body.width  = AmericanRoadsignsTool.WIDTH;
            body.height = AmericanRoadsignsTool.HEIGHT;
            //  ScrollRect
            body.relativePosition = new Vector3(5, 36 + 28 + 5);

            //  Section Panels:
            //  Road signs Panel:
            roadSignsPanel                  = body.AddUIComponent <UIRoadSignsPanel>();
            roadSignsPanel.name             = "roadSignsPanel";
            roadSignsPanel.width            = AmericanRoadsignsTool.WIDTH - (3 * AmericanRoadsignsTool.SPACING);
            roadSignsPanel.height           = AmericanRoadsignsTool.HEIGHT;
            roadSignsPanel.relativePosition = new Vector3(5, 0);
            roadSignsPanel.isVisible        = true;
            //  Roadside props Panel:
            roadPropsPanel                  = body.AddUIComponent <UIRoadPropsPanel>();
            roadPropsPanel.name             = "roadPropsPanel";
            roadPropsPanel.width            = AmericanRoadsignsTool.WIDTH - 3 * AmericanRoadsignsTool.SPACING;
            roadPropsPanel.height           = AmericanRoadsignsTool.HEIGHT;
            roadPropsPanel.relativePosition = new Vector3(5, 0);
            roadPropsPanel.isVisible        = false;
        }