Example #1
0
    /// <summary>
    /// 获取UI脚本实例
    /// </summary>
    /// <param name="inputTargetState">UI状态</param>
    /// <param name="inputComponent">UI脚本组件</param>
    /// <returns></returns>
    public GameObject GetHelp(UIState inputUIState, Component inputComponet)
    {
        if (inputComponet == null)
        {
            for (int i = 0; i < uiPanelList.Count; i++)
            {
                if (uiPanelList[i].targetState == inputUIState)
                {
                    GameObject obj      = LoadingManager.NewUI(uiPanelList[i].prefabPath);
                    GameObject targetGo = obj.GetComponent <UIMainLoadedPanel>().targetPanel;

                    targetGo.transform.parent        = transform.GetChild(0);
                    targetGo.transform.localPosition = Vector3.zero;
                    targetGo.transform.localScale    = Vector3.one;

                    Destroy(obj);
                    return(targetGo);
                }
            }
        }

        return(inputComponet.gameObject);
    }