/// <summary> /// 基础菜单(内部使用) /// </summary> /// <param name="title">菜单标题</param> /// <param name="actionId">动作表Id</param> /// <param name="order">顺序</param> /// <param name="actionType">菜单动作类型</param> /// <param name="parentId">父菜单Id</param> /// <param name="userId">用户Id</param> /// <param name="appId">应用Id</param> /// <param name="tenantId">租户Id</param> private void AddCustomizMenuEntity(string title, string actionId, int order, MenuActionType actionType, string parentId, string userId, string appId, string tenantId) { CustomizeMenuEntity cme = new CustomizeMenuEntity(); cme.AppId = appId; cme.ActionType = actionType; cme.CreatorUserId = userId; cme.CreateTime = DateTime.Now; cme.ActionId = actionId; cme.DeleteMark = false; cme.EnabledMark = true; cme.Id = Guid.NewGuid().ToString("N"); cme.ParentId = parentId; cme.SortCode = order; if (string.IsNullOrEmpty(parentId)) { cme.LevelNUM = 1; } else { cme.LevelNUM = 2; } cme.TenantId = tenantId; cme.Title = title; ctx.CustomizeMenus.Add(cme); }
private void PreformMenuAction(MenuActionType type) { if (fighting && type.Equals(MenuActionType.Attack)) { attackTurn++; RunAttackTurn(); } switch (type) { case MenuActionType.Explore: this.startFight = this.maze.Explore(); break; case MenuActionType.MainMenu: DisplayMainMenu(); break; case MenuActionType.OpenInventory: DisplayInventory(); break; case MenuActionType.Unequip: ((Weapon)this.player.SelectedItem).MenuOptions.Remove(MenuActionType.Unequip); ((Weapon)this.player.SelectedItem).MenuOptions.Insert(0, MenuActionType.Equip); this.player.EquippedWeapon = new Dud(); break; case MenuActionType.Back: return; case MenuActionType.Eat: this.player.Eat((Food)this.player.SelectedItem); if (((Food)this.player.SelectedItem).Quantity == 0) { this.player.Inventory.RemoveItem(player.SelectedItem); } break; case MenuActionType.Drop: this.player.Inventory.RemoveItem(this.player.SelectedItem); break; case MenuActionType.Equip: this.player.EquippedWeapon.MenuOptions.Remove(MenuActionType.Unequip); this.player.EquippedWeapon.MenuOptions.Insert(0, MenuActionType.Equip); ((Weapon)this.player.SelectedItem).MenuOptions.Insert(0, MenuActionType.Unequip); ((Weapon)this.player.SelectedItem).MenuOptions.Remove(MenuActionType.Equip); this.player.EquippedWeapon = (Weapon)this.player.SelectedItem; break; default: break; } }
/// <summary> /// 添加图文菜单 /// </summary> /// <param name="title">菜单名称</param> /// <param name="newsId">图文消息的Id</param> /// <param name="actionType">图文类型,(单图文,多图文)</param> /// <param name="parentId">父菜单Id</param> /// <param name="userId">用户Id</param> /// <param name="appId">应用Id</param> /// <param name="tenantId">租户Id</param> private void AddNewsLink(string title, string newsId, MenuActionType actionType, string parentId, string userId, string appId, string tenantId) { DateTime createTime = DateTime.Now; int maxOrder = GetMaxDisplayOrder(parentId, appId); string actionId = Guid.NewGuid().ToString("N"); CustomizeMenuNewsEntity cmle = new CustomizeMenuNewsEntity(); cmle.CreateTime = createTime; cmle.CreatorUserId = userId; cmle.DeleteMark = false; cmle.EnabledMark = true; cmle.Id = actionId; cmle.NewsId = newsId; cmle.TenantId = tenantId; ctx.CustomizeMenuNews.Add(cmle); AddCustomizMenuEntity(title, actionId, maxOrder + 1, actionType, parentId, userId, appId, tenantId); }
private void FireMenuEvent(MenuActionType type) { if (MenuAction != null) { MenuAction.Invoke(this,new MenuActionEventArgs { Action = type }); } }