예제 #1
0
    public void CloseView(UIViewName uiName)
    {
        string ViewName = uiName.ToString();

        if (!openViewDict.ContainsKey(ViewName))
        {
            return;
        }
        GameObject ui = openViewDict[ViewName];

        openViewDict.Remove(ViewName);
        closeViewDict[ViewName] = ui;
        UIBaseView uiView = ui.GetComponent <UIBaseView>();

        uiView.CloseView();

        ui.transform.parent           = hideLayer;
        ui.transform.localScale       = Vector3.one;
        ui.transform.localEulerAngles = Vector3.zero;
        ui.transform.localPosition    = Vector3.zero;
    }
예제 #2
0
    public void OpenView(UIViewName uiName, params object[] param)
    {
        for (int i = 0; i < openViewStack.Count; ++i)
        {
            CloseView(openViewStack[i]);
        }
        openViewStack.Clear();
        openViewStack.Add(uiName);

        string ViewName = uiName.ToString();

        if (openViewDict.ContainsKey(ViewName))
        {
            return;
        }
        GameObject ui = null;

        if (closeViewDict.ContainsKey(ViewName))
        {
            ui = closeViewDict[ViewName];
            closeViewDict.Remove(ViewName);
            openViewDict[ViewName] = ui;
        }
        else
        {
            GameObject resGo = Resources.Load <Object>("Prefab/UI/" + ViewName) as GameObject;
            ui = GameObject.Instantiate(resGo);
            CanvasDepth cd = ui.AddComponent <CanvasDepth>();
            cd.isUI = true;
            openViewDict[ViewName] = ui;
        }
        ui.transform.parent           = openLayer;
        ui.transform.localScale       = Vector3.one;
        ui.transform.localEulerAngles = Vector3.zero;
        ui.transform.localPosition    = Vector3.zero;
        UIBaseView uiView = ui.GetComponent <UIBaseView>();

        uiView.OpenView(param);
    }