public void SetDataForTeamCustomer(long teamId) { CptUtil.RemoveChildsByActive(objLoveMenuContainer); //获取团队数据 NpcTeamBean npcTeamData = NpcTeamHandler.Instance.manager.GetCustomerTeam(teamId); if (npcTeamData == null) { return; } //获取喜爱的菜单 List <long> listLoveMenu = npcTeamData.GetLoveMenus(); GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData(); UserAchievementBean userAchievement = gameData.GetAchievementData(); foreach (long menuId in listLoveMenu) { MenuInfoBean menuInfo = InnFoodHandler.Instance.manager.GetFoodDataById(menuId); Sprite spFood = InnFoodHandler.Instance.manager.GetFoodSpriteByName(menuInfo.icon_key); GameObject objLoveMenu = Instantiate(objLoveMenuContainer, objLoveMenuModel); ItemBaseTextCpt itemLoveMenu = objLoveMenu.GetComponent <ItemBaseTextCpt>(); if (userAchievement.CheckHasTeamCustomerLoveMenu(teamId, menuId)) { itemLoveMenu.SetData(spFood, menuInfo.name, ""); } else { itemLoveMenu.SetData(spUnLock, "???", Color.gray, ""); } } }
/// <summary> /// 点餐 /// </summary> public override void HandleForOrderFood() { if (!characterMoveCpt.IsAutoMoveStop()) { return; } //首先调整修改朝向 SetCharacterFace(orderForCustomer.table.GetUserFace()); //点餐 //判断是否有团队喜欢的菜 List <long> loveMenus = new List <long>(); if (teamData != null) { loveMenus = teamData.GetLoveMenus(); } //如果没有团队专有喜欢的菜,没有则随机点 if (loveMenus.Count == 0) { InnHandler.Instance.OrderForFood(orderForCustomer); } else { //检测是否拥有自己喜欢的菜品 GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData(); if (gameData.CheckHasLoveMenus(loveMenus, out List <MenuOwnBean> ownLoveMenus)) { //随机获取一个喜欢的菜 MenuOwnBean loveMenu = RandomUtil.GetRandomDataByList(ownLoveMenus); InnHandler.Instance.OrderForFood(orderForCustomer, loveMenu); } else { //如果没有自己喜欢的菜品则点一杯茶 //InnHandler.Instance.OrderForFood(orderForCustomer, 1); } } //如果有这菜 if (orderForCustomer.foodData != null) { //喊出需要的菜品 characterShoutCpt.Shout(orderForCustomer.foodData.name); //设置等待食物 SetIntent(CustomerIntentEnum.WaitFood); } //如果没有这菜 甚至连茶都没有 else { //如果没有菜品出售 心情直接降为不加好感 SetMood(30, true); EndOrderAndLeave(true); characterShoutCpt.Shout(TextHandler.Instance.manager.GetTextById(13002)); } }