Beispiel #1
0
 protected override void OnRegisterClass(System.Object container, Type type)
 {
     if (container == null)
     {
         return;
     }
     if (!type.IsSubclassOf(typeof(EWMsgBoxCustomDrawer)))
     {
         return;
     }
     System.Object[] atts = type.GetCustomAttributes(typeof(EWMsgBoxHandleAttribute), false);
     for (int i = 0; i < atts.Length; i++)
     {
         EWMsgBoxHandleAttribute att = (EWMsgBoxHandleAttribute)atts[i];
         if (att == null)
         {
             continue;
         }
         if (att.targetType != container.GetType())
         {
             continue;
         }
         EWMsgBoxCustomDrawer drawer = (EWMsgBoxCustomDrawer)System.Activator.CreateInstance(type);
         if (drawer == null)
         {
             continue;
         }
         drawer.SetContainer(container);
         drawer.closeAction = HideMsgBox;
         AddMsgBox(att.id, drawer);
     }
 }
Beispiel #2
0
    /// <summary>
    /// 添加MsgBox
    /// </summary>
    /// <param name="id">id</param>
    /// <param name="drawer">自定义绘制器对象</param>
    public void AddMsgBox(int id, EWMsgBoxCustomDrawer drawer)
    {
        if (m_MsgBoxs.ContainsKey(id))
        {
            Debug.LogError("错误,已经包含该ID的MsgBox方法:" + id);
            return;
        }
        EWMsgBoxObjectDrawer msgbox = new EWMsgBoxObjectDrawer(drawer);

        msgbox.Init();
        m_MsgBoxs.Add(id, msgbox);
    }
Beispiel #3
0
    /// <summary>
    /// 添加MsgBox
    /// </summary>
    /// <param name="id">id</param>
    /// <param name="drawer">自定义绘制器对象</param>
    public void AddMsgBox(int id, EWMsgBoxCustomDrawer drawer)
    {
        if (m_MsgBoxs.ContainsKey(id))
        {
            Debug.LogError("Error, MsgBox method that already contains the ID:" + id);
            return;
        }
        EWMsgBoxObjectDrawer msgbox = new EWMsgBoxObjectDrawer(drawer);

        msgbox.Init();
        m_MsgBoxs.Add(id, msgbox);
    }
Beispiel #4
0
        public EWMsgBoxObjectDrawer(EWMsgBoxCustomDrawer drawer)
        {
            m_Drawer = drawer;
            if (m_Drawer == null)
            {
                return;
            }
            string id = GetID();

            if (EditorPrefsEx.HasKey(id))
            {
                var obj = EditorPrefsEx.GetObject(id, drawer.GetType());
                if (obj != null)
                {
                    drawer = (EWMsgBoxCustomDrawer)obj;
                    drawer.SetContainer(this.m_Drawer.Container);
                    drawer.closeAction = this.m_Drawer.closeAction;
                    this.m_Drawer      = drawer;
                }
            }
        }