コード例 #1
0
        /// <summary>
        /// 初始化界面各个按钮
        /// </summary>
        public void Init()
        {
            if (null != ToolsCommon.Instance)
            {
                ToolsTypeList = ToolsCommon.Instance.GetToolTypes();  //初始化
            }
            else
            {
                Debug.LogError("ToolsCommon没有初始化!");
            }

            _OnReceivedTools = GameObject.Find("Canvas/BG/ToolsPanel/SingleToolPanel").GetComponent <OnReceivedTools>();

            m_BtnNext     = GameObject.Find("Canvas/BG/ToolsPanel/NextIcon_Btn").GetComponent <Button>();
            m_BtnPrevious = GameObject.Find("Canvas/BG/ToolsPanel/PreviousIcon_Btn").GetComponent <Button>();

            ToolsClass1 = GameObject.Find("Canvas/BG/ToolsPanel/ToolsClassPanel/ToolsClass 1").GetComponent <Toggle>();
            ToolsClass2 = GameObject.Find("Canvas/BG/ToolsPanel/ToolsClassPanel/ToolsClass 2").GetComponent <Toggle>();
            ToolsClass3 = GameObject.Find("Canvas/BG/ToolsPanel/ToolsClassPanel/ToolsClass 3").GetComponent <Toggle>();

            //为上一页和下一页添加事件
            m_BtnNext.onClick.AddListener(() => { Next(); });
            m_BtnPrevious.onClick.AddListener(() => { Previous(); });

            //为类型开关添加监听事件
            ToolsClass1.onValueChanged.AddListener((Ison) => { ToolsClass1RefreshItems(Ison); });
            ToolsClass2.onValueChanged.AddListener((Ison) => { ToolsClass2RefreshItems(Ison); });
            ToolsClass3.onValueChanged.AddListener((Ison) => { ToolsClass3RefreshItems(Ison); });

            InitItems();
        }
コード例 #2
0
ファイル: StartUI.cs プロジェクト: XinliZ/VirtualAssemble
        // Use this for initialization
        void Start()
        {
            _Canvas         = GameObject.Find("Canvas");
            _InitCanvas     = GameObject.Find("InitCanvas");
            _TipCanvas      = GameObject.Find("TipsCanvas");
            _TipErrorPlane  = GameObject.Find("TipsCanvas/ErrorPlane");
            _TipErrBtn      = GameObject.Find("TipsCanvas/ErrorPlane/ErrorBack");
            _PartsInfoPlane = GameObject.Find("TipsCanvas/PartsInfoPlane");
            _PartsInfoText  = GameObject.Find("TipsCanvas/PartsInfoPlane/InfoContent");
            _PartsInfoBtn   = GameObject.Find("TipsCanvas/PartsInfoPlane/PartsBtn");

            _RootPartGameObject = FindObjectOfType <AssembleController>().gameObject;

            _RestartBtn = GameObject.Find("InitCanvas/BG/RestartBtn").GetComponent <Button>();

            _AddPartsManager       = GameObject.Find("RuntimeObject").GetComponent <AddPartsManager>();
            _AddToolsManager       = GameObject.Find("RuntimeObject").GetComponent <AddToolsManager>();
            _AddCommonPartsManager = GameObject.Find("RuntimeObject").GetComponent <AddCommonPartsManager>();

            _UIPartsPanelClass = GameObject.Find("Canvas/BG/PartsPanel/PartsClassPanel").GetComponent <UIPartsPanelClass>();
            _UIPartsPage       = GameObject.Find("Canvas/BG/PartsPanel/SinglePartPanel").GetComponent <UIPartsPage>();

            _UIToolsClassPanel = GameObject.Find("Canvas/BG/ToolsPanel/ToolsClassPanel").GetComponent <UIToolsClassPanel>();
            _OnReceivedTools   = GameObject.Find("Canvas/BG/ToolsPanel/SingleToolPanel").GetComponent <OnReceivedTools>();

            _UICommonClass = GameObject.Find("Canvas/BG/CommonPartsPanel/ClassPanel").GetComponent <UICommonClass>();
            _UICommonParts = GameObject.Find("Canvas/BG/CommonPartsPanel/PartPanel").GetComponent <UICommonParts>();

            foreach (Transform tran in _TipCanvas.transform)                      //初始化隐藏所有提示(错误提示和信息提示)
            {
                tran.gameObject.SetActive(false);
            }

            _Canvas.SetActive(false);                            //初始化隐藏零件架等UI

            if (null != _RootPartGameObject)                     //将整个LCD1机器隐藏
            {
                foreach (Transform tran in _RootPartGameObject.transform)
                {
                    tran.gameObject.SetActive(false);
                }
            }

            _InitCanvas.SetActive(true);                         //初始化画布显示

            _RestartBtn.onClick.AddListener(RestartBtnOnClick);
        }