/// <summary> /// Scenes the notify init. /// </summary> public static void RoleNotifyInit() { Messenger.AddListener <bool>(NotifyTypes.CallRoleInfoPanelData, (isfighting) => { DbManager.Instance.CallRoleInfoPanelData(isfighting); }); Messenger.AddListener <JObject, bool>(NotifyTypes.CallRoleInfoPanelDataEcho, (obj, isfighting) => { // RoleInfoPanelCtrl.Show((JArray)obj["data"], isfighting); RolesInfoPanelCtrl.Show((JArray)obj["data"]); if (!isfighting) { Messenger.Broadcast(NotifyTypes.ShowTaskBtnPanel); } }); Messenger.AddListener(NotifyTypes.HideRoleInfoPanel, () => { // RoleInfoPanelCtrl.MoveDown(); RolesInfoPanelCtrl.MoveDown(); Messenger.Broadcast(NotifyTypes.HideTaskBtnPanel); }); Messenger.AddListener(NotifyTypes.MakeRoleInfoPanelRedPointRefresh, () => { RolesInfoPanelCtrl.MakeRefreshRedPoint(); }); Messenger.AddListener(NotifyTypes.MakeReviewRole, () => { RolesInfoPanelCtrl.MakeReviewRole(); }); Messenger.AddListener <bool>(NotifyTypes.MakeChangeRoleEnable, (enable) => { RoleInfoPanelCtrl.MakeChangeRoleEnable(enable); }); Messenger.AddListener <bool>(NotifyTypes.MakeChangeBookEnable, (enable) => { RoleInfoPanelCtrl.MakeChangeBookEnable(enable); }); Messenger.AddListener <bool>(NotifyTypes.MakeRoleInfoPanelDisable, (dis) => { RoleInfoPanelCtrl.MakeDisable(dis); }); Messenger.AddListener <string>(NotifyTypes.GetRolesOfWinShopPanelData, (cityId) => { DbManager.Instance.GetRolesOfWinShopPanelData(cityId); }); Messenger.AddListener <List <RoleData> >(NotifyTypes.GetRolesOfWinShopPanelDataEcho, (roles) => { roles.Sort((a, b) => b.Id.CompareTo(a.Id)); RolesOfWinShopPanelCtrl.Show(roles); }); Messenger.AddListener(NotifyTypes.GetWeaponsListPanelData, () => { DbManager.Instance.GetWeaponsListPanelData(); }); Messenger.AddListener <List <WeaponData>, RoleData>(NotifyTypes.GetWeaponsListPanelDataEcho, (weapons, host) => { WeaponListPanelCtrl.Show(weapons, host); }); Messenger.AddListener <int, string>(NotifyTypes.ReplaceWeapon, (id, beUsingByRoleId) => { DbManager.Instance.ReplaceWeapon(id, beUsingByRoleId); }); Messenger.AddListener <int>(NotifyTypes.TakeOffWeapon, (id => { DbManager.Instance.TakeOffWeapon(id); SoundManager.GetInstance().PushSound("ui0008"); })); Messenger.AddListener(NotifyTypes.GetBooksListPanelData, () => { DbManager.Instance.GetBooksListPanelData(); }); Messenger.AddListener <List <BookData> >(NotifyTypes.GetBooksListPanelDataEcho, (books) => { BookListPanelCtrl.Show(books); }); Messenger.AddListener <int>(NotifyTypes.UseBook, (id => { DbManager.Instance.UseBook(id); })); Messenger.AddListener <int>(NotifyTypes.UnuseBook, (id => { DbManager.Instance.UnuseBook(id); SoundManager.GetInstance().PushSound("ui0008"); })); Messenger.AddListener <string>(NotifyTypes.GetBooksOfForbiddenAreaPanelData, (cityId) => { DbManager.Instance.GetBooksOfForbiddenAreaPanelData(cityId); }); Messenger.AddListener <List <BookData>, RoleData>(NotifyTypes.GetBooksOfForbiddenAreaPanelDataEcho, (books, host) => { BooksOfForbiddenAreaPanelCtrl.Show(books, host); }); Messenger.AddListener <int>(NotifyTypes.InviteRole, (id) => { // DbManager.Instance.InviteRole(id); DbManager.Instance.InviteRoleWithResources(id); }); Messenger.AddListener <int>(NotifyTypes.ReadBook, (id => { DbManager.Instance.ReadBook(id); })); Messenger.AddListener(NotifyTypes.GetReadyToTravelPanelData, () => { DbManager.Instance.GetReadyToTravelPanelData(); }); Messenger.AddListener <List <RoleData>, UserData>(NotifyTypes.GetReadyToTravelPanelDataEcho, (roles, user) => { Messenger.Broadcast(NotifyTypes.HideRoleInfoPanel); roles.Sort(sortReadyToTravelRoles); ReadyToTravelPanelCtrl.Show(roles, user); }); Messenger.AddListener <RoleData>(NotifyTypes.MakeSelectRoleInTeam, (role) => { ReadyToTravelPanelCtrl.MakeSelectRole(role); }); Messenger.AddListener <RoleData>(NotifyTypes.MakeUnSelectRoleInTeam, (role) => { ReadyToTravelPanelCtrl.MakeUnSelectRole(role); }); Messenger.AddListener <JArray>(NotifyTypes.ChangeRolesSeatNo, (ids) => { DbManager.Instance.ChangeRolesSeatNo(ids); }); Messenger.AddListener(NotifyTypes.EnterAreaFromCity, () => { Messenger.Broadcast(NotifyTypes.HideCityScenePanel); Messenger.Broadcast(NotifyTypes.FromCitySceneBackToArea); Messenger.Broadcast(NotifyTypes.CallAreaMainPanelData); ReadyToTravelPanelCtrl.Hide(); }); Messenger.AddListener(NotifyTypes.GetHospitalPanelData, () => { DbManager.Instance.GetHospitalPanelData(); }); Messenger.AddListener <List <RoleData> >(NotifyTypes.GetHospitalPanelDataEcho, (roles) => { roles.Sort((a, b) => b.Injury.CompareTo(a.Injury)); HospitalPanelCtrl.Show(roles); }); Messenger.AddListener <int>(NotifyTypes.CureRole, (id => { DbManager.Instance.CureRole(id); })); Messenger.AddListener(NotifyTypes.RelieveRoles, () => { DbManager.Instance.RelieveRoles(); }); Messenger.AddListener(NotifyTypes.GetBagPanelData, () => { DbManager.Instance.GetBagPanelData(); }); Messenger.AddListener <List <ItemData>, double>(NotifyTypes.GetBagPanelDataEcho, (items, silver) => { BagPanelCtrl.Show(items, silver); }); Messenger.AddListener <ItemData, bool>(NotifyTypes.ShowItemDetailPanel, (item, fromBag) => { ItemDetailPanelCtrl.Show(item, fromBag); }); Messenger.AddListener(NotifyTypes.GetSellItemsPanelData, () => { DbManager.Instance.GetSellItemsPanelData(); }); Messenger.AddListener <List <ItemData> >(NotifyTypes.GetSellItemsPanelDataEcho, (items) => { SellItemsPanelCtrl.Show(items); }); Messenger.AddListener(NotifyTypes.MakeSelectedItemOfSellItemsPanel, () => { SellItemsPanelCtrl.MakeSelectedItem(); }); Messenger.AddListener <JArray>(NotifyTypes.SellItems, (ids) => { DbManager.Instance.SellItems(ids); }); Messenger.AddListener <double>(NotifyTypes.SellItemsEcho, (silver) => { SellItemsPanelCtrl.Hide(); StorePanelCtrl.MakeChangeSilverNum(silver); SoundManager.GetInstance().PushSound("ui0005"); }); Messenger.AddListener <int>(NotifyTypes.DiscardItem, (id) => { DbManager.Instance.DiscardItem(id); SoundManager.GetInstance().PushSound("ui0008"); }); Messenger.AddListener <BookData>(NotifyTypes.ShowBookDetailPanel, (book) => { BookDetailPanelCtrl.Show(book, DbManager.Instance.GetBookExpAndSecrets(book.Id)); }); Messenger.AddListener <WeaponData>(NotifyTypes.ShowWeaponDetailPanel, (weapon) => { WeaponDetailPanelCtrl.Show(weapon, DbManager.Instance.GetWeaponLV(weapon.Id)); }); Messenger.AddListener <WeaponData>(NotifyTypes.WeaponLVUpgrade, (weapon) => { DbManager.Instance.WeaponLVUpgrade(weapon); }); Messenger.AddListener <WeaponLVData>(NotifyTypes.WeaponLVUpgradeEcho, (lvData) => { WeaponDetailPanelCtrl.WeaponLVUpgrade(lvData); }); Messenger.AddListener <RoleData>(NotifyTypes.ShowRoleDetailPanel, (role) => { RoleDetailPanelCtrl.Show(role, DbManager.Instance.GetSecretsBelongBooks(role.ResourceBookDataIds)); }); Messenger.AddListener <List <DropData> >(NotifyTypes.ShowDropsListPanel, (drops) => { DropsListPanelCtrl.Show(drops); SoundManager.GetInstance().PushSound("ui0004"); }); Messenger.AddListener <int>(NotifyTypes.UseItem, (id => { DbManager.Instance.UseItem(id); })); Messenger.AddListener <string>(NotifyTypes.GetInnInCityData, (cityId) => { DbManager.Instance.GetInnInCityData(cityId); }); Messenger.AddListener <List <FloydResult> >(NotifyTypes.GetInnInCityDataEcho, (results) => { InnPanelCtrl.Show(results); }); Messenger.AddListener <int, int>(NotifyTypes.GoToCity, (fromIndex, toIndex) => { DbManager.Instance.GoToCity(fromIndex, toIndex); }); Messenger.AddListener <SceneData>(NotifyTypes.GoToCityEcho, (scene) => { string eventId = JsonManager.GetInstance().GetMapping <string>("AreaCityPosDatas", scene.Id); string[] fen = eventId.Split(new char[] { '_' }); if (fen.Length >= 3) { string areaName = fen[0]; int x = int.Parse(fen[1]); int y = int.Parse(fen[2]); if (UserModel.CurrentUserData != null) { CityScenePanelCtrl.MakeClose(); InnPanelCtrl.Hide(); UserModel.CurrentUserData.PositionStatu = UserPositionStatusType.InCity; UserModel.CurrentUserData.CurrentCitySceneId = scene.Id; UserModel.CurrentUserData.CurrentAreaSceneName = areaName; UserModel.CurrentUserData.CurrentAreaX = x; UserModel.CurrentUserData.CurrentAreaY = y; //清空临时事件 Messenger.Broadcast <List <SceneEventType> >(NotifyTypes.ClearDisableEventIdMapping, new List <SceneEventType>() { SceneEventType.DisablePagoda }); Messenger.Broadcast <System.Action <UserData> >(NotifyTypes.UpdateUserData, null); Messenger.Broadcast <string>(NotifyTypes.GoToScene, areaName); } } }); Messenger.AddListener <string>(NotifyTypes.NpcsEventHandler, (npcId) => { switch (npcId) { case "05002001": if (DbManager.Instance.HostData.Occupation == OccupationType.None) { if (!DbManager.Instance.HasAnyTask((new List <string>() { "task_occupation0", "task_occupation1", "task_occupation2", "task_occupation3", "task_occupation4", "task_occupation5" }).ToArray())) { OccupationPanelCtrl.Show(); } else { AlertCtrl.Show("去吧去吧,老夫已为你做了引荐"); } } else { AlertCtrl.Show(string.Format("你已是{0},可喜可贺啊,哦哈哈哈哈", Statics.GetOccupationDesc(DbManager.Instance.HostData.Occupation))); } break; default: break; } }); Messenger.AddListener <int>(NotifyTypes.HostRoleUpgrade, (toLv) => { DbManager.Instance.HostRoleUpgrade(toLv); }); Messenger.AddListener <RoleData, RoleData>(NotifyTypes.HostRoleUpgradeEcho, (roleData, toData) => { RoleUpgradeLvPanelCtrl.Show(roleData, toData); SoundManager.GetInstance().PushSound("ui0002"); }); Messenger.AddListener(NotifyTypes.OpenRepairBugPanel, () => { RepairBugPanelCtrl.Show(); }); Messenger.AddListener <BookData, List <SecretData> >(NotifyTypes.GetSecretListPanelData, (book, hasSecrets) => { SecretListPanelCtrl.Show(DbManager.Instance.GetEffectiveSecrets(), book, hasSecrets); }); Messenger.AddListener <BookData, List <SecretData> >(NotifyTypes.DealSecretEcho, (book, hasSecrets) => { if (RolesInfoPanelCtrl.Ctrl != null) { Messenger.Broadcast <bool>(NotifyTypes.CallRoleInfoPanelData, false); Messenger.Broadcast(NotifyTypes.MakeReviewRole); } Messenger.Broadcast <BookData>(NotifyTypes.ShowBookDetailPanel, book); Messenger.Broadcast <BookData, List <SecretData> >(NotifyTypes.GetSecretListPanelData, book, hasSecrets); }); Messenger.AddListener(NotifyTypes.OpenTowerGuiderPanel, () => { TowerGuiderPanelCtrl.Show(); AreaMainPanelCtrl.MakeRefreshDifficultyView(); }); }
/// <summary> /// Scenes the notify init. /// </summary> public static void RoleNotifyInit() { Messenger.AddListener <bool>(NotifyTypes.CallRoleInfoPanelData, (isfighting) => { DbManager.Instance.CallRoleInfoPanelData(isfighting); }); Messenger.AddListener <JObject, bool>(NotifyTypes.CallRoleInfoPanelDataEcho, (obj, isfighting) => { RoleInfoPanelCtrl.Show((JArray)obj["data"], isfighting); if (!isfighting) { Messenger.Broadcast(NotifyTypes.ShowTaskBtnPanel); } }); Messenger.AddListener(NotifyTypes.HideRoleInfoPanel, () => { RoleInfoPanelCtrl.MoveDown(); Messenger.Broadcast(NotifyTypes.HideTaskBtnPanel); }); Messenger.AddListener <bool>(NotifyTypes.MakeChangeRoleEnable, (enable) => { RoleInfoPanelCtrl.MakeChangeRoleEnable(enable); }); Messenger.AddListener <bool>(NotifyTypes.MakeChangeBookEnable, (enable) => { RoleInfoPanelCtrl.MakeChangeBookEnable(enable); }); Messenger.AddListener <bool>(NotifyTypes.MakeRoleInfoPanelDisable, (dis) => { RoleInfoPanelCtrl.MakeDisable(dis); }); Messenger.AddListener <string>(NotifyTypes.GetRolesOfWinShopPanelData, (cityId) => { DbManager.Instance.GetRolesOfWinShopPanelData(cityId); }); Messenger.AddListener <List <RoleData> >(NotifyTypes.GetRolesOfWinShopPanelDataEcho, (roles) => { RolesOfWinShopPanelCtrl.Show(roles); }); Messenger.AddListener(NotifyTypes.GetWeaponsListPanelData, () => { DbManager.Instance.GetWeaponsListPanelData(); }); Messenger.AddListener <List <WeaponData>, RoleData>(NotifyTypes.GetWeaponsListPanelDataEcho, (weapons, host) => { WeaponListPanelCtrl.Show(weapons, host); }); Messenger.AddListener <int, string>(NotifyTypes.ReplaceWeapon, (id, beUsingByRoleId) => { DbManager.Instance.ReplaceWeapon(id, beUsingByRoleId); }); Messenger.AddListener <int>(NotifyTypes.TakeOffWeapon, (id => { DbManager.Instance.TakeOffWeapon(id); })); Messenger.AddListener(NotifyTypes.GetBooksListPanelData, () => { DbManager.Instance.GetBooksListPanelData(); }); Messenger.AddListener <List <BookData> >(NotifyTypes.GetBooksListPanelDataEcho, (books) => { BookListPanelCtrl.Show(books); }); Messenger.AddListener <int>(NotifyTypes.UseBook, (id => { DbManager.Instance.UseBook(id); })); Messenger.AddListener <int>(NotifyTypes.UnuseBook, (id => { DbManager.Instance.UnuseBook(id); })); Messenger.AddListener <string>(NotifyTypes.GetBooksOfForbiddenAreaPanelData, (cityId) => { DbManager.Instance.GetBooksOfForbiddenAreaPanelData(cityId); }); Messenger.AddListener <List <BookData>, RoleData>(NotifyTypes.GetBooksOfForbiddenAreaPanelDataEcho, (books, host) => { BooksOfForbiddenAreaPanelCtrl.Show(books, host); }); Messenger.AddListener <int>(NotifyTypes.InviteRole, (id) => { // DbManager.Instance.InviteRole(id); DbManager.Instance.InviteRoleWithResources(id); }); Messenger.AddListener <int>(NotifyTypes.ReadBook, (id => { DbManager.Instance.ReadBook(id); })); Messenger.AddListener(NotifyTypes.GetReadyToTravelPanelData, () => { DbManager.Instance.GetReadyToTravelPanelData(); }); Messenger.AddListener <List <RoleData>, ItemData>(NotifyTypes.GetReadyToTravelPanelDataEcho, (roles, food) => { Messenger.Broadcast(NotifyTypes.HideRoleInfoPanel); ReadyToTravelPanelCtrl.Show(roles, food); }); Messenger.AddListener <RoleData>(NotifyTypes.MakeSelectRoleInTeam, (role) => { ReadyToTravelPanelCtrl.MakeSelectRole(role); }); Messenger.AddListener <RoleData>(NotifyTypes.MakeUnSelectRoleInTeam, (role) => { ReadyToTravelPanelCtrl.MakeUnSelectRole(role); }); Messenger.AddListener <JArray>(NotifyTypes.ChangeRolesSeatNo, (ids) => { DbManager.Instance.ChangeRolesSeatNo(ids); }); Messenger.AddListener(NotifyTypes.ChangeRolesSeatNoEcho, () => { Messenger.Broadcast(NotifyTypes.HideCityScenePanel); Messenger.Broadcast(NotifyTypes.FromCitySceneBackToArea); Messenger.Broadcast(NotifyTypes.CallAreaMainPanelData); ReadyToTravelPanelCtrl.Hide(); }); Messenger.AddListener(NotifyTypes.GetHospitalPanelData, () => { DbManager.Instance.GetHospitalPanelData(); }); Messenger.AddListener <List <RoleData> >(NotifyTypes.GetHospitalPanelDataEcho, (roles) => { HospitalPanelCtrl.Show(roles); }); Messenger.AddListener <int>(NotifyTypes.CureRole, (id => { DbManager.Instance.CureRole(id); })); Messenger.AddListener(NotifyTypes.GetBagPanelData, () => { DbManager.Instance.GetBagPanelData(); }); Messenger.AddListener <List <ItemData>, double>(NotifyTypes.GetBagPanelDataEcho, (items, silver) => { BagPanelCtrl.Show(items, silver); }); Messenger.AddListener <ItemData, bool>(NotifyTypes.ShowItemDetailPanel, (item, fromBag) => { ItemDetailPanelCtrl.Show(item, fromBag); }); Messenger.AddListener(NotifyTypes.GetSellItemsPanelData, () => { DbManager.Instance.GetSellItemsPanelData(); }); Messenger.AddListener <List <ItemData> >(NotifyTypes.GetSellItemsPanelDataEcho, (items) => { SellItemsPanelCtrl.Show(items); }); Messenger.AddListener(NotifyTypes.MakeSelectedItemOfSellItemsPanel, () => { SellItemsPanelCtrl.MakeSelectedItem(); }); Messenger.AddListener <JArray>(NotifyTypes.SellItems, (ids) => { DbManager.Instance.SellItems(ids); }); Messenger.AddListener <double>(NotifyTypes.SellItemsEcho, (silver) => { SellItemsPanelCtrl.Hide(); StorePanelCtrl.MakeChangeSilverNum(silver); }); Messenger.AddListener <int>(NotifyTypes.DiscardItem, (id) => { DbManager.Instance.DiscardItem(id); }); Messenger.AddListener <BookData>(NotifyTypes.ShowBookDetailPanel, (book) => { BookDetailPanelCtrl.Show(book); }); Messenger.AddListener <WeaponData>(NotifyTypes.ShowWeaponDetailPanel, (weapon) => { WeaponDetailPanelCtrl.Show(weapon); }); Messenger.AddListener <RoleData>(NotifyTypes.ShowRoleDetailPanel, (role) => { RoleDetailPanelCtrl.Show(role); }); Messenger.AddListener <List <DropData> >(NotifyTypes.ShowDropsListPanel, (drops) => { DropsListPanelCtrl.Show(drops); }); Messenger.AddListener <int>(NotifyTypes.UseItem, (id => { DbManager.Instance.UseItem(id); })); Messenger.AddListener <string>(NotifyTypes.GetInnInCityData, (cityId) => { DbManager.Instance.GetInnInCityData(cityId); }); Messenger.AddListener <List <FloydResult> >(NotifyTypes.GetInnInCityDataEcho, (results) => { InnPanelCtrl.Show(results); }); Messenger.AddListener <int, int>(NotifyTypes.GoToCity, (fromIndex, toIndex) => { DbManager.Instance.GoToCity(fromIndex, toIndex); }); Messenger.AddListener <SceneData>(NotifyTypes.GoToCityEcho, (scene) => { string eventId = JsonManager.GetInstance().GetMapping <string>("AreaCityPosDatas", scene.Id); string[] fen = eventId.Split(new char[] { '_' }); if (fen.Length >= 3) { string areaName = fen[0]; int x = int.Parse(fen[1]); int y = int.Parse(fen[2]); if (UserModel.CurrentUserData != null) { CityScenePanelCtrl.MakeClose(); InnPanelCtrl.Hide(); UserModel.CurrentUserData.PositionStatu = UserPositionStatusType.InCity; UserModel.CurrentUserData.CurrentCitySceneId = scene.Id; UserModel.CurrentUserData.CurrentAreaSceneName = areaName; UserModel.CurrentUserData.CurrentAreaX = x; UserModel.CurrentUserData.CurrentAreaY = y; //清空临时事件 Messenger.Broadcast(NotifyTypes.ClearDisableEventIdMapping); Messenger.Broadcast <System.Action <UserData> >(NotifyTypes.UpdateUserData, null); Messenger.Broadcast <string>(NotifyTypes.GoToScene, areaName); } } }); Messenger.AddListener <string>(NotifyTypes.NpcsEventHandler, (npcId) => { switch (npcId) { case "05002001": if (DbManager.Instance.HostData.Occupation == OccupationType.None) { if (!DbManager.Instance.HasAnyTask((new List <string>() { "task_occupation0", "task_occupation1", "task_occupation2", "task_occupation3", "task_occupation4", "task_occupation5" }).ToArray())) { OccupationPanelCtrl.Show(); } else { AlertCtrl.Show("去吧去吧,老夫已为你做了引荐"); } } else { AlertCtrl.Show(string.Format("你已是{0}{1},可喜可贺啊,哦哈哈哈哈", Statics.GetOccupationName(DbManager.Instance.HostData.Occupation), Statics.GetOccupationDesc(DbManager.Instance.HostData.Occupation))); } break; default: break; } }); }