コード例 #1
0
        public void Init()
        {
            if (null != NodesCommon.Instance)
            {
                NodeTypesList = NodesCommon.Instance.GetNodesTypes();  //初始化
            }
            else
            {
                Debug.LogError("NodesCommon没有初始化!");
            }

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

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

            PartClass1 = GameObject.Find("Canvas/BG/PartsPanel/PartsClassPanel/PartClass 1").GetComponent <Toggle>();
            PartClass2 = GameObject.Find("Canvas/BG/PartsPanel/PartsClassPanel/PartClass 2").GetComponent <Toggle>();
            PartClass3 = GameObject.Find("Canvas/BG/PartsPanel/PartsClassPanel/PartClass 3").GetComponent <Toggle>();

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

            PartClass1.onValueChanged.AddListener((Ison) => { PartClass1RefreshItems(Ison); });
            PartClass2.onValueChanged.AddListener((Ison) => { PartClass2RefreshItems(Ison); });
            PartClass3.onValueChanged.AddListener((Ison) => { PartClass3RefreshItems(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);
        }