Exemplo n.º 1
0
    //各种窗口UI显示/关闭动画
    /// <summary>
    ///<param name="windowUI">窗口UI的预设克隆体</param>
    ///<param name="windowShowType">类型</param>
    ///<param name="state">显示关闭</param>
    /// </summary>
    public void StartActiveUIWindow(GameObject windowUI, UIWindowShowAnimationType windoeShowType = UIWindowShowAnimationType.CenterToBig, bool state = true)
    {
        switch (windoeShowType)
        {
        case UIWindowShowAnimationType.Normal:
            ShowNormal(windowUI, state);
            break;

        case UIWindowShowAnimationType.CenterToBig:
            ShowCenterToBig(windowUI, state);
            break;

        case UIWindowShowAnimationType.LeftToRight:
            ShowDirection(windowUI, state, 1);
            break;

        case UIWindowShowAnimationType.RightToLeft:
            ShowDirection(windowUI, state, 2);
            break;

        case UIWindowShowAnimationType.TopToBottom:
            ShowDirection(windowUI, state, 3);
            break;

        case UIWindowShowAnimationType.BottomToTop:
            ShowDirection(windowUI, state, 4);
            break;

        default:
            break;
        }
    }
Exemplo n.º 2
0
 /// <summary>
 /// Closes the user interface window.
 /// </summary>
 /// <param name="windowType">Window type.</param>
 public void CloseUIWindow(UIWindowType windowType)
 {
     if (uiWindowDic.ContainsKey(windowType))
     {
         GameObject                uiWindow                = uiWindowDic[windowType];
         UIWindowControllerBase    uiWindownController     = uiWindow.GetOrAddComponent <UIWindowControllerBase>();
         UIWindowShowAnimationType windowShowAnimationType = uiWindownController.windowShowAnimationType;
         StartActiveUIWindow(uiWindow, windowShowAnimationType, state: false);
     }
 }
Exemplo n.º 3
0
    /// <summary>
    /// Opens the user interface window.
    /// </summary>
    /// <param name="windowType">Window type.</param>
    public void OpenUIWindow(UIWindowType windowType)
    {
        if (uiWindowDic.ContainsKey(windowType))
        {
            return;
        }
        GameObject uiWindow = null;

        switch (windowType)
        {
        case UIWindowType.Login:
            uiWindow = ResourceManager.Instance.Load("UIWindow_Login", resType: ResourceType.UIWindow);
            break;

        case UIWindowType.Register:
            uiWindow = ResourceManager.Instance.Load("UIWindow_Register", resType: ResourceType.UIWindow);
            break;

        case UIWindowType.Header:
            uiWindow = ResourceManager.Instance.Load("UIWindow_Header", resType: ResourceType.UIWindow);
            break;

        case UIWindowType.Function:
            uiWindow = ResourceManager.Instance.Load("UIWindow_Function", resType: ResourceType.UIWindow);
            break;

        case UIWindowType.Skill:
            uiWindow = ResourceManager.Instance.Load("UIWindow_Skill", resType: ResourceType.UIWindow);
            break;

        case UIWindowType.Progress:
            uiWindow = ResourceManager.Instance.Load("UIWindow_Progress", resType: ResourceType.UIWindow);
            break;

        default:
            break;
        }

        UIWindowControllerBase uiWindowController = uiWindow.GetOrAddComponent <UIWindowControllerBase>();

        uiWindowController.windowType = windowType;

        Transform transParentWindowContainer = null;

        UIWindowContainerType windowContainerType = uiWindowController.windowContainerType;

        switch (windowContainerType)
        {
        case UIWindowContainerType.Center:
            transParentWindowContainer = UISceneManager.Instance.currentUISceneController.centerContainer;
            break;

        case UIWindowContainerType.LeftBottom:
            transParentWindowContainer = UISceneManager.Instance.currentUISceneController.leftBottomContainer;
            break;

        case UIWindowContainerType.LeftTop:
            transParentWindowContainer = UISceneManager.Instance.currentUISceneController.leftTopContainer;
            break;

        case UIWindowContainerType.RightBottom:
            transParentWindowContainer = UISceneManager.Instance.currentUISceneController.rightBottomContainer;
            break;

        case UIWindowContainerType.RightTop:
            transParentWindowContainer = UISceneManager.Instance.currentUISceneController.rightTopContainer;
            break;

        case UIWindowContainerType.RightCenter:
            transParentWindowContainer = UISceneManager.Instance.currentUISceneController.rightCenterContainer;
            break;

        default:
            break;
        }
        uiWindow.transform.parent        = transParentWindowContainer;
        uiWindow.transform.localPosition = Vector3.zero;
        uiWindow.transform.localScale    = Vector3.one;

        uiWindowDic.Add(windowType, uiWindow);

        NGUITools.SetActive(uiWindow, false);
        UIWindowShowAnimationType windowShowAnimationType = uiWindowController.windowShowAnimationType;

        StartActiveUIWindow(uiWindow, windowShowAnimationType: windowShowAnimationType, state: true);
    }