コード例 #1
0
        /// <summary>
        /// 获取实例
        /// </summary>
        /// <returns></returns>
        public static InitFactory GetInstance()
        {
            InitFactory factory = null;
            Type        type    = BridgeObject.GetCustomerOperateHandleTypes().Where(x => x.BaseType == typeof(InitFactory)).FirstOrDefault();

            if (type != null)
            {
                object obj = Activator.CreateInstance(type);
                return(obj as InitFactory);
            }
            return(factory);
        }
コード例 #2
0
    void ProcessBridgeObject(BridgeObject bo)
    {
        BridgeGameObjectSync bgos;

        if (!bridgeGameObjects.ContainsKey(bo.name))
        {
            GameObject go = new GameObject(bo.name);
            bgos = go.AddComponent <BridgeGameObjectSync>();
            go.transform.parent = BridgeObjectsContainer != null ? BridgeObjectsContainer.transform : transform;
            bridgeGameObjects.Add(bo.name, bgos);
        }

        bgos = bridgeGameObjects[bo.name];
        bgos.Bind(bo);
    }
コード例 #3
0
    public static BridgeObject ParseJson(Dictionary <string, object> obj)
    {
        const string KEY_UVS                   = "uvs";
        const string KEY_VERTICES              = "vertices";
        const string KEY_MATS                  = "materials";
        const string KEY_MAT_SPEC_COLOR        = "specular_color";
        const string KEY_MAT_AMBIENT           = "ambient";
        const string KEY_MAT_SPEC_SHADER       = "specular_shader";
        const string KEY_MAT_DIFFUSE_SHADER    = "diffuse_shader";
        const string KEY_MAT_NAME              = "name";
        const string KEY_MAT_DIFFUSE_INTENSITY = "diffuse_intensity";
        const string KEY_MAT_DIFFUSE_COLOR     = "diffuse_color";
        const string KEY_MAT_ALPHA             = "alpha";
        const string KEY_MAT_SPEC_INTENSITY    = "specular_intensity";
        const string KEY_NAME                  = "name";
        const string KEY_NORMALS               = "normals";
        const string KEY_FACES                 = "faces";
        const string KEY_FACE_MATS             = "face_materials";

        List <object> verts_ = obj.ContainsKey(KEY_VERTICES) ? (obj[KEY_VERTICES] as List <object>) : new List <object>();
        List <object> norms_ = obj.ContainsKey(KEY_NORMALS) ? (obj[KEY_NORMALS] as List <object>) : new List <object>();
        List <object> faces_ = obj.ContainsKey(KEY_FACES) ? (obj[KEY_FACES] as List <object>) : new List <object>();
        string        name_  = obj.ContainsKey(KEY_NAME) ? (obj[KEY_NAME] as string) : "";

        BridgeObject bo = new BridgeObject();

        foreach (var vert in verts_)
        {
            var vertList = vert as List <object>;
            bo.verts.Add(CreateVector3((double)vertList[0], (double)vertList[1], (double)vertList[2]));
        }

        foreach (var norm in norms_)
        {
            var normList = norm as List <object>;
            bo.normals.Add(CreateVector3((double)normList[0], (double)normList[1], (double)normList[2]));
        }

        foreach (var face in faces_)
        {
            bo.faces.Add(Convert.ToInt32(face));
        }

        bo.name = name_;

        return(bo);
    }
コード例 #4
0
    void ProcessQueue()
    {
        if (queue.Count == 0)
        {
            return;
        }

        string data = queue.Dequeue();
        var    json = Json.Deserialize(data) as Dictionary <string, object>;

        BridgeObject bo = BridgeObject.ParseJson(json);

        if (bo != null)
        {
            ProcessBridgeObject(bo);
        }
    }
コード例 #5
0
 public void Bind(BridgeObject bo)
 {
     bo.BindMeshFilter(GetComponent <MeshFilter>());
     bo.BindMeshRenderer(GetComponent <MeshRenderer>());
 }
コード例 #6
0
        /// <summary>
        /// 获取用户的功能(菜单或网格按钮)权限,返回字典,
        /// 字典的第一个参数为功能Id(菜单或按钮Id),第二个
        /// 参数为是否来自父角色的权限,非当前角色权限
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="functionType">功能类型(菜单、网格按钮),0-菜单,1-按钮</param>
        /// <param name="moduleId">模块ID,按钮时需要</param>
        /// <returns></returns>
        public Dictionary <Guid, bool> GetUserFunPermissions(Guid userId, int functionType, Guid?moduleId)
        {
            ISys_PermissionFunDAL permissionDal = BridgeObject.Resolve <ISys_PermissionFunDAL>(this.CurrUser);

            return(permissionDal.GetUserFunPermissions(userId, functionType, moduleId));
        }
コード例 #7
0
        /// <summary>
        /// 获取用户(查看、新增、编辑)字段权限
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="moduleId">模块Id</param>
        /// <param name="fieldPermissionType">字段权限类型,0-查看,1-新增,2-编辑</param>
        /// <returns>返回允许(查看、新增、编辑)的字段名集合</returns>
        public List <string> GetUserFieldsPermissions(Guid userId, Guid moduleId, int fieldPermissionType)
        {
            ISys_PermissionFieldDAL permissionDal = BridgeObject.Resolve <ISys_PermissionFieldDAL>(this.CurrUser);

            return(permissionDal.GetUserFieldsPermissions(userId, moduleId, fieldPermissionType));
        }
コード例 #8
0
        /// <summary>
        /// 获取角色(查看、新增、编辑)字段权限,返回允许(查看、新增、编辑)的字段名字典,
        /// 第一个参数为字段名,第二个参数为是否来自父角色的权限,
        /// 非当前角色权限
        /// </summary>
        /// <param name="roleId">角色Id</param>
        /// <param name="moduleId">模块Id</param>
        /// <param name="fieldPermissionType">字段权限类型,0-查看,1-新增,2-编辑</param>
        /// <param name="read">是否为应用读取,应用读取快速返回</param>
        /// <returns>返回允许(查看、新增、编辑)的字段名字典</returns>
        public Dictionary <string, bool> GetRoleFieldPermissions(Guid roleId, Guid moduleId, int fieldPermissionType, bool read = false)
        {
            ISys_PermissionFieldDAL permissionDal = BridgeObject.Resolve <ISys_PermissionFieldDAL>(this.CurrUser);

            return(permissionDal.GetRoleFieldPermissions(roleId, moduleId, fieldPermissionType, read));
        }