/// <summary> /// Constuctor for entity types /// </summary> /// <param name="id"></param> /// <param name="name"></param> /// <param name="sprite"></param> /// <param name="solid"></param> /// <param name="width"></param> /// <param name="height"></param> public EntityType(int id, string name, Texture2D sprite, int width, int height, bool solid, EntityFunction function = EntityFunction.Custom) { Id = id; Name = name; Description = "Stub"; Sprite = sprite; //AltSprite = new Rectangle(sprite.X + sprite.Width, sprite.Y, sprite.Width, sprite.Height); Solid = solid; Width = width; Height = height; Health = 100; Function = function; }
/// <summary> /// CheckNode /// </summary> /// <param name="node"></param> internal void CheckNode(TreeListNode node) { EntityFunction vo = Viewer.tvFunction.GetDataRecordByNode(node) as EntityFunction; vo.imageIndex = (node.CheckState == CheckState.Checked ? 1 : 0); if (Viewer.gvRole.FocusedRowHandle >= 0) { if (Function.Int(GetFieldValueStr(Viewer.gvRole, Viewer.gvRole.FocusedRowHandle, EntityCodeRole.Columns.isEdit)) > 0) { EntityRoleFunction voFunc = new weCare.Core.Entity.EntityRoleFunction(); voFunc.Rolecode = GetFieldValueStr(Viewer.gvRole, Viewer.gvRole.FocusedRowHandle, EntityCodeRole.Columns.roleCode); voFunc.Funcid = vo.Funcid; using (ProxyDictionary proxy = new ProxyDictionary()) { int ret = proxy.Service.SaveRoleFunc(voFunc, vo.imageIndex); if (ret < 0) { DialogBox.Msg("权限分配失败。"); } } } } Viewer.tvFunction.RefreshNode(node); }