Exemple #1
0
 private void AddTypeComponent(GameObject viewGo, string path)
 {
     foreach (var type in BindUtil.GetType(path))
     {
         viewGo.AddComponent(type);
     }
 }
Exemple #2
0
    /// <summary>
    /// 实例化UI Prefab
    /// </summary>
    /// <param name="path"></param>
    /// <returns></returns>
    private IView InitView(string path)
    {
        if (_views.ContainsKey(path))
        {
            return(_views[path]);
        }
        else
        {
            GameObject viewGo    = LoadMgr.Single.LoadPrefab(path, Canvas.transform);
            Type       type      = BindUtil.GetType(path);
            var        component = viewGo.AddComponent(type);
            IView      view      = null;
            //必须得判断下 脚本是否实现了IView接口
            if (component is IView)
            {
                view = component as IView;
                view.Init();
            }
            else
            {
                Debug.Log("当前添加脚本未继承ViewBase");
            }

            return(view);
        }
    }
Exemple #3
0
 private void AddBindScripts(string path, GameObject viewGo)
 {
     foreach (var type in BindUtil.BindGet(path))
     {
         viewGo.AddComponent(type);
     }
 }
        private void InitData()
        {
            UserInfo user     = UserInfo.Instance;
            var      userList = SysBLL.Instance.GetBy <UserEntity>(item => item.StoreID == user.StoreID && item.ID != user.ID);

            BindUtil.BindComboBoxEdit(cboUsers, userList, "RealName", "ID");
            var roleList = SysBLL.Instance.GetBy <BaseRoleEntity>(item => item.RecordStatus == RecordStatus.Normal && item.RoleName != "店长" && item.IsBackstage == false);

            BindUtil.BindComboBoxEdit(cboRoles, roleList, "RoleName", "ID");
            GetUserRoleList(user);
        }
Exemple #5
0
 private IView InitView(string path)
 {
     if (_views.ContainsKey(path))
     {
         return(_views[path]);
     }
     else
     {
         GameObject viewGo = LoadMgr.Single.LoadPrefab(path, Canvas.transform);
         viewGo.AddComponent(BindUtil.GetScriptType(path));
         IView view = viewGo.GetComponent <IView>();
         view.Init();
         return(view);
     }
 }
Exemple #6
0
        private void InitData()
        {
            txtOperator.Text = UserInfo.Instance.UserCode;
            var listMdm = MdmBLL.Instance.MDMSubList.Where(item => item.MDMTypeName == "出库类型").ToList();

            BindUtil.BindComboBoxEdit(cboGoosOutType, listMdm, "SubName", "SubValue");

            var storeList = StoreBLL.Instance.GetAllStore().Where(s => s.ID != UserInfo.Instance.StoreID).ToList();

            BindUtil.BindComboBoxEdit(cboReciveStore, storeList, "StoreName", "ID");
            gvGoodsOutList.Columns.ToList().ForEach(column =>
            {
                column.OptionsColumn.AllowEdit = true;
                //column.OptionsColumn.ReadOnly = true;
            });
        }
Exemple #7
0
        private void InitData()
        {
            txtOperator.Text = UserInfo.Instance.UserCode;
            var category = SysBLL.Instance.GetALL <CategoryEntity>().Where(item => item.ParentCategoryID == 0 || item.ParentCategoryID == null);
            //var listMdm=MdmBLL.Instance.GetMDMByNameOrCode(new MDMEntity { MDMName = "InStockType" });
            var listMdm = MdmBLL.Instance.MDMSubList.Where(item => item.MDMTypeName == "入库类型" && item.SubValue != "1").ToList();

            BindUtil.BindComboBoxEdit(cboGoodsInType, listMdm, "SubName", "SubValue");
            BindUtil.BindComboBoxEdit(cboCategory, category.ToList(), "Category", "ID");
            BindUtil.BindComboBoxEdit(cboBarID, FindGoods("", UserInfo.Instance.StoreID.ToString()), "Name", "BarID", showKeyValueMode: false);
            gvGoodsInList.Columns.ToList().ForEach(column =>
            {
                column.OptionsColumn.AllowEdit = true;
                column.OptionsColumn.ReadOnly  = true;
            });
            groupControl1.CustomButtonClick += (s, e) => Close();
        }
Exemple #8
0
    public void Init()
    {
        System.Reflection.Assembly asm = System.Reflection.Assembly.GetAssembly(typeof(BindPrefab));
        System.Type[] types            = asm.GetExportedTypes();

        foreach (Type type in types)
        {
            foreach (Attribute attribute in Attribute.GetCustomAttributes(type, true))
            {
                if (attribute is BindPrefab)
                {
                    BindPrefab data = attribute as BindPrefab;
                    BindUtil.Bind(data.Path, type);
                }
            }
        }
    }
Exemple #9
0
    public void Init()
    {
        Assembly assembly = Assembly.GetAssembly(typeof(PrefabBind));

        Type[] types = assembly.GetExportedTypes();

        foreach (Type type in types)
        {
            //true用来表示是否可以继承
            foreach (Attribute attribute in Attribute.GetCustomAttributes(type, true))
            {
                if (attribute is PrefabBind)
                {
                    PrefabBind data = attribute as PrefabBind;
                    //存储脚本的信息与类型
                    BindUtil.BindSave(data, type);
                }
            }
        }
    }
    public void Init()
    {
        //获得BindPrefab所在的程序集
        Assembly assembly = Assembly.GetAssembly(typeof(BindPrefabAttribute));

        //获取程序集当中所有的公有类型
        Type[] types = assembly.GetExportedTypes();

        //遍历类型
        foreach (var type in types)
        {
            //遍历Type类型所拥有的特性 找到对应的特性
            foreach (Attribute attr in Attribute.GetCustomAttributes(type, true))
            {
                if (attr is BindPrefabAttribute)
                {
                    BindPrefabAttribute data = attr as BindPrefabAttribute;
                    BindUtil.Bind(data.Path, type);
                }
            }
        }
    }