Esempio n. 1
0
        /// <summary>
        /// 替换兵器(不允许侠客不拿兵器)
        /// </summary>
        /// <param name="id">Identifier.</param>
        /// <param name="beUsingByRoleId">Be using by role identifier.</param>
        public void ReplaceWeapon(int id, string beUsingByRoleId)
        {
            db = OpenDb();
            //查询角色信息
            SqliteDataReader sqReader = db.ExecuteQuery("select RoleId, RoleData from RolesTable where RoleId = '" + beUsingByRoleId + "' and BelongToRoleId = '" + currentRoleId + "'");

            if (sqReader.Read())
            {
                //获取角色数据
                string roleDataStr = sqReader.GetString(sqReader.GetOrdinal("RoleData"));
                roleDataStr = roleDataStr.IndexOf("{") == 0 ? roleDataStr : DESStatics.StringDecder(roleDataStr);
                RoleData role = JsonManager.GetInstance().DeserializeObject <RoleData>(roleDataStr);
                sqReader = db.ExecuteQuery("select * from WeaponsTable where BeUsingByRoleId = '" + beUsingByRoleId + "' and BelongToRoleId ='" + currentRoleId + "'");
                while (sqReader.Read())
                {
                    //将兵器先卸下
                    int dataId = sqReader.GetInt32(sqReader.GetOrdinal("Id"));
                    db.ExecuteQuery("update WeaponsTable set BeUsingByRoleId = '' where Id = " + dataId);
                }
                sqReader = db.ExecuteQuery("select Id, WeaponId from WeaponsTable where Id = " + id);
                if (sqReader.Read())
                {
                    string     weaponId = sqReader.GetString(sqReader.GetOrdinal("WeaponId"));
                    WeaponData weapon   = JsonManager.GetInstance().GetMapping <WeaponData>("Weapons", weaponId);
                    if (weapon.BelongToRoleId == "")
                    {
                        if (weapon.Occupation == OccupationType.None || weapon.Occupation == HostData.Occupation)
                        {
                            //装备新兵器
                            db.ExecuteQuery("update WeaponsTable set BeUsingByRoleId = '" + beUsingByRoleId + "' where Id = " + id);
                            //更新角色的武器信息
                            role.ResourceWeaponDataId = weaponId;
                            //查询下新武器替换上后秘籍需不需要卸下
                            sqReader = db.ExecuteQuery("select Id, BookId from BooksTable where BeUsingByRoleId = '" + currentRoleId + "' and BelongToRoleId = '" + currentRoleId + "'");
                            BookData book;
                            string   unuseBookMsg = "";
                            while (sqReader.Read())
                            {
                                book = JsonManager.GetInstance().GetMapping <BookData>("Books", sqReader.GetString(sqReader.GetOrdinal("BookId")));
                                if (book.LimitWeaponType != WeaponType.None && (book.LimitWeaponType != weapon.Type))
                                {
                                    db.ExecuteQuery("update BooksTable set SeatNo = 888, BeUsingByRoleId = '' where Id = " + sqReader.GetInt32(sqReader.GetOrdinal("Id")));
                                    int index = role.ResourceBookDataIds.FindIndex(item => item == book.Id);
                                    if (index >= 0)
                                    {
                                        //更新角色的秘籍信息
                                        role.ResourceBookDataIds.RemoveAt(index);
                                    }
                                    unuseBookMsg += " " + book.Name;
                                }
                            }
                            //更新主角关联数据
                            db.ExecuteQuery("update RolesTable set RoleData = '" + DESStatics.StringEncoder(JsonManager.GetInstance().SerializeObjectDealVector(role)) + "' where RoleId = '" + beUsingByRoleId + "'");
                            if (unuseBookMsg != "")
                            {
                                Statics.CreatePopMsg(Vector3.zero, string.Format("拿上<color=\"{0}\">{1}</color>后不可能再习练{2}", Statics.GetQualityColorString(weapon.Quality), weapon.Name, unuseBookMsg), Color.white, 30);
                            }
                            SoundManager.GetInstance().PushSound("ui0011");
                        }
                        else
                        {
                            AlertCtrl.Show(string.Format("<color=\"{0}\">{1}</color>只有 {2} 才能使用!", Statics.GetQualityColorString(weapon.Quality), weapon.Name, Statics.GetOccupationDesc(weapon.Occupation)));
                        }
                    }
                    else
                    {
                        AlertCtrl.Show(string.Format("<color=\"{0}\">{1}</color>只有 {2} 才能使用!", Statics.GetQualityColorString(weapon.Quality), weapon.Name, JsonManager.GetInstance().GetMapping <RoleData>("RoleDatas", weapon.BelongToRoleId).Name));
                    }
                }
            }
            db.CloseSqlConnection();
            GetWeaponsListPanelData();             //刷新兵器匣列表
            CallRoleInfoPanelData(false);          //刷新队伍数据
        }
Esempio n. 2
0
        /// <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();
            });
        }
Esempio n. 3
0
        /// <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;
                }
            });
        }