Esempio n. 1
0
 public void RemoveEvent(NetEventType m_event, VoidHandle handle)
 {
     for (int i = 0; i < mgrEventList.Count; i++)
     {
         if (mgrEventList[i].eventType == m_event)
         {
             mgrEventList.RemoveAt(i);
             i--;
         }
     }
 }
Esempio n. 2
0
    public void RegistEvent(NetEventType m_event, VoidHandle handle)
    {
        MgrEvent tmp = new MgrEvent();

        tmp.eventType = m_event;
        tmp.handle    = handle;
        if (mgrEventList.Contains(tmp) == false)
        {
            mgrEventList.Add(tmp);
        }
    }
Esempio n. 3
0
 /// <summary>
 /// 注册事件监听
 /// </summary>
 /// <param name="m_event"></param>
 /// <param name="m_win"></param>
 /// <param name="handle"></param>
 public void RegistEvent(UIEventType m_event, WindowType m_win, VoidHandle handle)
 {
     if (m_eventList.ContainsKey(m_event) == false)
     {
         m_eventList.Add(m_event, new Dictionary <WindowType, VoidHandle>());
     }
     if (m_eventList[m_event].ContainsKey(m_win) == false)
     {
         m_eventList[m_event].Add(m_win, handle);
     }
 }
Esempio n. 4
0
    public void RegistEvent(UIEventType m_event, Window m_win, VoidHandle handle)
    {
        UIEvent tmp = new UIEvent();

        tmp.eventType = m_event;
        tmp.window    = m_win;
        tmp.handle    = handle;
        if (uiEventList.Contains(tmp) == false)
        {
            uiEventList.Add(tmp);
        }
    }
Esempio n. 5
0
    public void OnLoad(GameObject go)
    {
        m_go = go;
        if (m_go.GetComponent <GraphicRaycaster>() == null)
        {
            m_go.AddComponent <GraphicRaycaster>();
        }

        m_Parent = GameObject.Find("Main").GetComponent <Transform>();
        if (m_Parent != null)
        {
            m_go.transform.SetParent(m_Parent, false);
        }
        else
        {
            Debug.LogError("Main ui window is null or empty!!");
        }


        m_canvas = m_go.GetComponent <Canvas>();
        if (m_canvas == null)
        {
            m_canvas = m_go.AddComponent <Canvas>();
        }
        m_canvas.overrideSorting = true;
        m_canvas.sortingOrder    = m_sort_order;

        Initialize();
        m_done = true;

        if (m_show)
        {
            Show();
            //..
            if (m_open_handle != null)
            {
                m_open_handle();//..
                m_open_handle = null;
            }
        }
        else
        {
            Hide();
        }
        //..
    }
Esempio n. 6
0
    public void CreateWindow(WindowType winType, VoidHandle handle = null, bool isShow = true, params object[] param)
    {
        if (m_winList.Contains(winType))
        {
            return;
        }
        Window win = WindowManager.instance.GetWindow(winType);

        if (m_winList.Contains(winType) == false)
        {
            m_winList.Add(winType);
        }
        if (win == null)
        {
            win = (Window)Activator.CreateInstance(Type.GetType(WindowManager.instance.GetWindowTypeName(winType)));
            win.m_winEnumType = winType;

            UIHelper.instance.CreateWindow(win, handle, isShow, param);
        }
        else
        {
            m_winList.Remove(winType);
            if (win.IsLoad)
            {
                if (isShow)
                {
                    if (handle != null)
                    {
                        handle();
                    }
                    win.Show(param);
                }
                else
                {
                    win.Hide();
                }
            }
        }
    }