Пример #1
0
        public override void OnLevelLoaded(LoadMode mode)
        {
            if (mode != LoadMode.LoadGame && mode != LoadMode.NewGame && mode != LoadMode.NewMap && mode != LoadMode.LoadMap)
                return;

            lastLoadMode_ = mode;

            UIView view = UIView.GetAView();
            UITabstrip tabStrip = null;

            whatsNewPanelGameObject = new GameObject("whatsNewPanel");
            this.whatsNewPanel = whatsNewPanelGameObject.AddComponent<WhatsNewPanel>();
            this.whatsNewPanel.transform.parent = view.transform;
            this.whatsNewPanel.Hide();

            exportPanelGameObject = new GameObject("exportPanel");
            this.exportPanel = exportPanelGameObject.AddComponent<ExportPanel>();
            this.exportPanel.transform.parent = view.transform;
            this.exportPanel.whatsNewPanel = whatsNewPanel;
            this.exportPanel.Hide();

            if (mode == LoadMode.NewGame || mode == LoadMode.LoadGame)
            {
                tabStrip =  ToolsModifierControl.mainToolbar.component as UITabstrip;
            }
            else
            {
                tabStrip = UIView.Find<UITabstrip>("MainToolstrip");
            }

            if (m_tabButton == null)
            {
                GameObject buttonGameObject = UITemplateManager.GetAsGameObject("MainToolbarButtonTemplate");
                GameObject pageGameObject = UITemplateManager.GetAsGameObject("ScrollablePanelTemplate");
                m_tabButton = tabStrip.AddTab("Road Namer", buttonGameObject, pageGameObject, new Type[] { }) as UIButton;

                UITextureAtlas atlas = CimToolsHandler.CimToolBase.SpriteUtilities.GetAtlas("CimtographerIcons");

                m_tabButton.eventClicked += uiButton_eventClick;
                m_tabButton.tooltip = "Cimtographer";
                m_tabButton.foregroundSpriteMode = UIForegroundSpriteMode.Fill;

                if (atlas != null)
                {
                    m_tabButton.atlas = atlas;
                    m_tabButton.normalFgSprite = "ToolbarFGIcon";
                    m_tabButton.focusedFgSprite = "ToolbarFGIcon";
                    m_tabButton.hoveredFgSprite = "ToolbarFGIcon";
                    m_tabButton.disabledFgSprite = "ToolbarFGIcon";
                    m_tabButton.pressedFgSprite = "ToolbarFGIcon";
                    m_tabButton.focusedBgSprite = "ToolbarBGFocused";
                    m_tabButton.hoveredBgSprite = "ToolbarBGHovered";
                    m_tabButton.pressedBgSprite = "ToolbarBGPressed";
                }
                else
                {
                    Debug.LogError("Cimtographer: Could not find atlas.");
                }
            }
        }
Пример #2
0
        public override void OnLevelLoaded(LoadMode mode)
        {
            if (mode != LoadMode.LoadGame && mode != LoadMode.NewGame && mode != LoadMode.NewMap && mode != LoadMode.LoadMap)
                return;

            lastLoadMode_ = mode;

            UIView view = UIView.GetAView();
            UITabstrip tabStrip = null;

            whatsNewPanelGameObject = new GameObject("whatsNewPanel");
            this.whatsNewPanel = whatsNewPanelGameObject.AddComponent<WhatsNewPanel>();
            this.whatsNewPanel.transform.parent = view.transform;
            this.whatsNewPanel.Hide();

            exportPanelGameObject = new GameObject("exportPanel");
            this.exportPanel = exportPanelGameObject.AddComponent<ExportPanel>();
            this.exportPanel.transform.parent = view.transform;
            this.exportPanel.whatsNewPanel = whatsNewPanel;
            this.exportPanel.Hide();

            if (mode == LoadMode.NewGame || mode == LoadMode.LoadGame)
            {
                tabStrip =  ToolsModifierControl.mainToolbar.component as UITabstrip;
            }
            else
            {
                tabStrip = UIView.Find<UITabstrip>("MainToolstrip");
            }

            buttonObject = UITemplateManager.GetAsGameObject("MainToolbarButtonTemplate");
            buttonObject2 = UITemplateManager.GetAsGameObject("ScrollablePanelTemplate");
            menuButton = tabStrip.AddTab("cimtographerMod", buttonObject, buttonObject2, new Type[] { }) as UIButton;
            menuButton.eventClick += uiButton_eventClick;
        }