void onClick(GameObject e) { if (!e.GetComponent <Button>().enabled) { return; } switch (e.name) { case "CureBtn": if (roleData.Injury != InjuryType.None) { ConfirmCtrl.Show(string.Format("要想治愈{0}{1}的伤, 需要使用能够治疗{2}状态的药物, 确定治疗?", roleData.Name, Statics.GetGenderDesc(roleData.Gender), Statics.GetInjuryName(roleData.Injury)), () => { Messenger.Broadcast <int>(NotifyTypes.CureRole, roleData.PrimaryKeyId); }); } break; case "Btn": Messenger.Broadcast <RoleData>(NotifyTypes.ShowRoleDetailPanel, roleData); break; default: break; } }
void onClick(GameObject e) { switch (e.name) { case "plusWorkerBtn": if (DbManager.Instance.GetPlusWorkerNum() < DbManager.Instance.GetMaxPlusWorkerNum()) { ConfirmCtrl.Show(string.Format("花费¥3 购买10个家丁({0}/{1})\n(家丁越多资源生产效率越高)\n确定购买?", DbManager.Instance.GetPlusWorkerNum(), DbManager.Instance.GetMaxPlusWorkerNum()), () => { MaiHandler.PayForProduct("com.courage2017.worker_10"); // DbManager.Instance.SetPlusWorkerNum(DbManager.Instance.GetPlusWorkerNum() + 10); // DbManager.Instance.SetMaxWorkerNum(DbManager.Instance.GetMaxWorkerNum() + 10); // DbManager.Instance.SetWorkerNum(DbManager.Instance.GetWorkerNum() + 10); // WorkshopPanelCtrl.MakeWorkerNumChange(DbManager.Instance.GetWorkerNum(), DbManager.Instance.GetMaxWorkerNum()); // AlertCtrl.Show("成功招募了10个家丁"); }, null, "购买", "不了"); } else { AlertCtrl.Show(string.Format("你已经买满了{0}个家丁", DbManager.Instance.GetMaxPlusWorkerNum())); } break; case "CloseBtn": FadeOut(); break; default: break; } }
void onClick(GameObject e) { switch (e.name) { case "Block": Back(); break; case "lvUpgradeBtn": if (weaponData.LV >= weaponLVData.MaxLV) { AlertCtrl.Show(string.Format("<color=\"{0}\">{1}</color>强化度已到满级", Statics.GetQualityColorString(weaponData.Quality), weaponData.Name)); break; } string needMsg = ""; double needRate = DbManager.Instance.GetWeaponNeedRate(weaponData.LV + 1); for (int i = 0, len = weaponData.Needs.Count; i < len; i++) { needMsg += string.Format("{0}个{1}", weaponData.Needs[i].Num * needRate, Statics.GetEnmuDesc <ResourceType>(weaponData.Needs[i].Type)) + (i < len - 1 ? "," : ""); } ConfirmCtrl.Show(string.Format("将<color=\"{0}\">{1}</color>强化到{2}\n需要{3}\n是否立即强化兵器?", Statics.GetQualityColorString(weaponData.Quality), weaponData.Name, weaponData.LV + 1, needMsg), () => { Messenger.Broadcast <WeaponData>(NotifyTypes.WeaponLVUpgrade, weaponData); }); break; default: break; } }
void onClick(GameObject e) { switch (e.name) { case "ScoutBtn": ConfirmCtrl.Show("是否派出一个探子追踪目标?", () => { if (DbManager.Instance.GetProp(PropType.Scout) == null) { AlertCtrl.Show("没有探子可以派遣"); return; } EventData eventData = DbManager.Instance.GetActiveEvent(currentDialog.StringValue); if (eventData != null) { AlertCtrl.Show(string.Format("追踪结果: {0} X: {1} Y: {2}\n<color=\"#00FF00\">(请牢记该坐标)</color>", areaNames[eventData.SceneId] != null ? areaNames[eventData.SceneId]["Name"].ToString() : "", eventData.X, eventData.Y)); } else { AlertCtrl.Show("查询不到该事件信息"); } DbManager.Instance.UseProp(PropType.Scout, 1); Messenger.Broadcast(NotifyTypes.MakeUpdateProps); }); break; default: break; } }
void onClick(GameObject e) { switch (e.name) { case "Block": case "CloseBtn": SlideDown(); break; case "SellBtn": if (selectedItemsId.Count > 0) { ConfirmCtrl.Show("确定将选中物品卖出?", () => { Messenger.Broadcast <JArray>(NotifyTypes.SellItems, selectedItemsId); }); } else { AlertCtrl.Show("请先选择要卖出的物品!"); } break; default: break; } }
void onClick(GameObject e) { switch (e.name) { case "CameraBtn": // ConfirmCtrl.Show("观看一段视频来缓解下各位侠客的伤势如何?", () => { // MaiHandler.StartRewardedVideo(() => { // Messenger.Broadcast(NotifyTypes.RelieveRoles); // }); // MaiHandler.SendEvent("StartRewardedVideoForInjurys", DbManager.Instance.HostData.Lv.ToString()); // }); ConfirmCtrl.Show("是否花费10000两银子请御医来缓解下各位侠客的伤势如何?", () => { if (DbManager.Instance.CostSilver(10000)) { Messenger.Broadcast(NotifyTypes.RelieveRoles); MaiHandler.SendEvent("StartRewardedVideoForInjurys", DbManager.Instance.HostData.Lv.ToString()); } else { AlertCtrl.Show("银两不足"); } }); break; case "CloseBtn": FadeOut(); break; } }
void onClick(GameObject e) { switch (e.name) { case "RandomBtn": randomName(); break; case "CreateBtn": if (NameInputField.text.Length > 6) { AlertCtrl.Show("称谓不能超过6个字!"); return; } ConfirmCtrl.Show(string.Format("<color=\"{0}\">{1}</color>以后就是你的称谓,确定后不可更改", Statics.GetGenderColor(genderType), NameInputField.text), () => { RoleData role = new RoleData(); role.Id = hostRoleId; role.Name = NameInputField.text; role.Gender = genderType; role.IsHost = true; // role.ResourceWeaponDataId = "1"; //默认武器是布缠手 role.Occupation = OccupationType.None; role.IconId = IconImages[iconIndex].sprite.name; role.DeadSoundId = role.Gender == GenderType.Male ? "die0003" : "die0002"; Messenger.Broadcast <RoleData>(NotifyTypes.CreateHostRole, role); }, null, "确定", "取消"); break; default: break; } }
void onClick(GameObject e) { switch (e.name) { case "EnterBtn": DbManager.Instance.ClearTaskCaches(); PlayerPrefs.SetString("CurrentRoleId", currentRoleId); DbManager.Instance.SetCurrentRoleId(currentRoleId); Messenger.Broadcast(NotifyTypes.EnterGame); break; case "DeleteBtn": ConfirmCtrl.Show("删除存档后无法恢复数据,确定删除?", () => { DbManager.Instance.ClearTaskCaches(); PlayerPrefs.SetString("CurrentRoleId", ""); DbManager.Instance.DeleteRecord((int)data[0]); }); break; case "CreateBtn": DbManager.Instance.ClearTaskCaches(); PlayerPrefs.SetString("CurrentRoleId", currentRoleId); DbManager.Instance.SetCurrentRoleId(currentRoleId); Messenger.Broadcast <string>(NotifyTypes.ShowCreateHostRolePanel, currentRoleId); break; default: break; } }
void onClick(GameObject e) { if (!e.GetComponent <Button>().enabled) { return; } switch (e.name) { case "MakeBtn": if (roleData.State == RoleStateType.NotRecruited) { // ConfirmCtrl.Show(string.Format("是否将<color=\"{0}\">{1}</color>赠给{2}与其结交?", Statics.GetQualityColorString(weapon.Quality), weapon.Name, roleData.Name), () => { // Messenger.Broadcast<int>(NotifyTypes.InviteRole, roleData.PrimaryKeyId); // }); string needMsg = ""; for (int i = 0, len = weapon.Needs.Count; i < len; i++) { needMsg += string.Format("{0}个{1}", weapon.Needs[i].Num, Statics.GetEnmuDesc <ResourceType>(weapon.Needs[i].Type)) + (i < len - 1 ? "," : ""); } if (needMsg != "") { ConfirmCtrl.Show(string.Format("要将<color=\"{0}\">{1}</color>赠送给{2}\n需要{3}\n是否立即锻造兵器?", Statics.GetQualityColorString(weapon.Quality), weapon.Name, roleData.Name, needMsg), () => { Messenger.Broadcast <int>(NotifyTypes.InviteRole, roleData.PrimaryKeyId); }); } else { AlertCtrl.Show("兵器没有原材料无法打造", null); } } else { AlertCtrl.Show(string.Format("{0}已经和你结交", roleData.Name), null); } break; case "Btn": Messenger.Broadcast <RoleData>(NotifyTypes.ShowRoleDetailPanel, roleData); break; default: break; } viewedNewFlag(); }
void onClick(GameObject e) { switch (e.name) { case "StudyBtn": SendMessageUpwards("study", secretData); break; case "ForgetBtn": SendMessageUpwards("forget", secretData); break; case "MixBtn": ConfirmCtrl.Show(string.Format("融合<color=\"{0}\">{1}</color>需要消耗2张同类同品质的诀要,是否继续?", Statics.GetQualityColorString(secretData.Quality), secretData.Name), () => { SendMessageUpwards("mix", secretData); }); break; default: break; } }
void onClick(GameObject e) { switch (e.name) { case "DestroyBtn": ConfirmCtrl.Show(string.Format("<color=\"#1ABDE6\">{0}</color>将<color=\"#FF0000\">永久消失</color>, 确定丢弃?", itemData.Name), () => { Messenger.Broadcast <int>(NotifyTypes.DiscardItem, itemData.PrimaryKeyId); Back(); }); break; case "UseBtn": Messenger.Broadcast <int>(NotifyTypes.UseItem, itemData.PrimaryKeyId); Back(); break; default: Back(); break; } }
void onClick(GameObject e) { if (!e.GetComponent <Button>().enabled) { return; } switch (e.name) { case "MakeBtn": if (bookData.Occupation == OccupationType.None || bookData.Occupation == hostRoleData.Occupation) { if (bookData.State == BookStateType.Unread) { string noticeMsg = costStr != "" ? string.Format("是否将{0}拼合成<color=\"{1}\">{2}</color>进行研读?", costStr, Statics.GetQualityColorString(bookData.Quality), bookData.Name) : string.Format("是否研读<color=\"{0}\">{1}</color>?", Statics.GetQualityColorString(bookData.Quality), bookData.Name); ConfirmCtrl.Show(noticeMsg, () => { Messenger.Broadcast <int>(NotifyTypes.ReadBook, bookData.PrimaryKeyId); }); } else { AlertCtrl.Show(string.Format("<color=\"{0}\">{1}</color>已经研读过", Statics.GetQualityColorString(bookData.Quality), bookData.Name), null); } } else { AlertCtrl.Show(string.Format("非{0}弟子不得研习<color=\"{1}\">{2}</color>!", Statics.GetOccupationName(bookData.Occupation), Statics.GetQualityColorString(bookData.Quality), bookData.Name)); } break; case "Btn": Messenger.Broadcast <BookData>(NotifyTypes.ShowBookDetailPanel, bookData); break; default: break; } viewedNewFlag(); }
void onClick(GameObject e) { if (weaponData == null) { return; } switch (e.name) { case "BreakBtn": ConfirmCtrl.Show(string.Format("确定将<color=\"{0}\">{1}</color>熔解?\n<color=\"#FF0000\">熔解后此兵器将永久消失</color>!", Statics.GetQualityColorString(weaponData.Quality), weaponData.Name), () => { Messenger.Broadcast <int>(NotifyTypes.BreakWeapon, weaponData.PrimaryKeyId); }, null, "熔解", "放弃"); break; case "ViewBtn": Messenger.Broadcast <WeaponData>(NotifyTypes.ShowWeaponDetailPanel, weaponData); break; default: break; } }
void onClick(GameObject e) { if (weaponData == null) { return; } switch (e.name) { case "CreateBtn": ConfirmCtrl.Show(string.Format("开始打造<color=\"{0}\">{1}</color>?", Statics.GetQualityColorString(weaponData.Quality), weaponData.Name), () => { Messenger.Broadcast <string>(NotifyTypes.CreateNewWeaponOfWorkshop, weaponData.Id); }, null, "打造", "放弃"); break; case "ViewBtn": Messenger.Broadcast <WeaponData>(NotifyTypes.ShowWeaponDetailPanel, weaponData); break; default: break; } viewedNewFlag(); }
void onClick(GameObject e) { switch (e.name) { case "SettingBtn": if (BattleFightPanelCtrl.Ctrl != null) { AlertCtrl.Show("请专心战斗"); break; } Messenger.Broadcast <bool>(NotifyTypes.ShowSettingPanel, true); break; case "viewTimesButton": AlertCtrl.Show("时辰顺序: \n午时, 未时, 申时, 酉时, 戌时, 亥时 子时, 丑时, 寅时, 卯时, 辰时, 巳时", null, "关闭"); break; case "EnemyInfoBtn": EnemysInfoPanelCtrl.Show(); SetEnemyInfoRedPointFlag(false); break; case "BackToCityBtn": if (BattleFightPanelCtrl.Ctrl != null) { AlertCtrl.Show("请专心战斗"); break; } ConfirmCtrl.Show("现在马上回城?", () => { Messenger.Broadcast(NotifyTypes.BackToCity); }); break; default: break; } }
/// <summary> /// Scenes the notify init. /// </summary> public static void AreaNotifyInit() { Messenger.AddListener <AreaTarget, AreaMain>(NotifyTypes.AreaInit, (target, main) => { AreaModel.CurrentTarget = target; AreaModel.AreaMainScript = main; //加载动态事件列表 Messenger.Broadcast <string>(NotifyTypes.GetActiveEventsInArea, UserModel.CurrentUserData.CurrentAreaSceneName); //打开大地图UI交互界面 Messenger.Broadcast(NotifyTypes.CallAreaMainPanelData); //如果当前所处的位置是城镇,则进入城镇 if (UserModel.CurrentUserData.PositionStatu == UserPositionStatusType.InCity) { Messenger.Broadcast <string>(NotifyTypes.EnterCityScene, UserModel.CurrentUserData.CurrentCitySceneId); } }); Messenger.AddListener(NotifyTypes.AreaDestroyed, () => { if (AreaModel.CurrentTarget != null && AreaModel.CurrentTarget.gameObject != null) { MonoBehaviour.Destroy(AreaModel.CurrentTarget.gameObject); AreaModel.CurrentTarget = null; } Messenger.Broadcast(NotifyTypes.HideAreaMainPanel); }); Messenger.AddListener(NotifyTypes.CallAreaMainPanelData, () => { Messenger.Broadcast <System.Action <UserData> >(NotifyTypes.CallUserData, (userData) => { Messenger.Broadcast <JArray>(NotifyTypes.CallAreaMainPanelDataEcho, new JArray(userData.AreaFood.IconId, userData.AreaFood.Num, userData.AreaFood.MaxNum, userData.CurrentAreaSceneName)); Vector2 pos = new Vector2(userData.CurrentAreaX, userData.CurrentAreaY); Messenger.Broadcast <Vector2, bool>(NotifyTypes.SetAreaPosition, pos, false); }); }); Messenger.AddListener <JArray>(NotifyTypes.CallAreaMainPanelDataEcho, (data) => { AreaMainPanelCtrl.Show(data); }); Messenger.AddListener(NotifyTypes.HideAreaMainPanel, () => { AreaMainPanelCtrl.Hide(); }); Messenger.AddListener <string, bool>(NotifyTypes.MoveOnArea, (direction, duringMove) => { //移动前先判断移动目的地是否有战斗 Vector2 nextMovePosition = AreaModel.CurrentTarget.GetNextMovePosition(direction); //判断前方是否是障碍 tk2dRuntime.TileMap.TileInfo groundTile = AreaModel.CurrentTarget.GetTileInfo((int)nextMovePosition.x, (int)nextMovePosition.y, 0); //判断禁止通过的碰撞区域 if (groundTile == null || groundTile.stringVal == "obstacle") { return; } string fightEventId = string.Format("{0}_{1}_{2}", UserModel.CurrentUserData.CurrentAreaSceneName, (int)nextMovePosition.x, (int)nextMovePosition.y); EventData data; if (AreaMain.ActiveAreaEventsMapping.ContainsKey(fightEventId)) { data = AreaMain.ActiveAreaEventsMapping[fightEventId]; if (data.Type == SceneEventType.Battle) { ConfirmCtrl.Show("前方将有恶战,是否继续?", () => { Messenger.Broadcast <string>(NotifyTypes.CreateBattle, data.EventId); }, null, "动手", "撤退"); return; } } else if (AreaMain.StaticAreaEventsMapping.ContainsKey(fightEventId)) { //判断静态事件是否禁用 if (!AreaMain.DisableEventIdMapping.ContainsKey(fightEventId)) { data = AreaMain.StaticAreaEventsMapping[fightEventId]; if (data.Type == SceneEventType.Battle) { ConfirmCtrl.Show("前方将有恶战,是否继续?", () => { Messenger.Broadcast <string>(NotifyTypes.CreateBattle, data.EventId); //处理静态事件的预禁用操作 EventData disableEvent = new EventData(); disableEvent.Id = fightEventId; disableEvent.Type = SceneEventType.DisableEvent; disableEvent.X = (int)nextMovePosition.x; disableEvent.Y = (int)nextMovePosition.y; Messenger.Broadcast <EventData>(NotifyTypes.HandleDisableEvent, disableEvent); }, null, "动手", "撤退"); return; } else if (data.OpenType != SceneEventOpenType.None) { //静态事件有一个开启判定类型 switch (data.OpenType) { case SceneEventOpenType.FightWined: if (!DbManager.Instance.IsFightWined(data.OpenKey)) { ConfirmCtrl.Show(string.Format("前方有强敌守卫,是否硬闯?{0}", data.Notice), () => { Messenger.Broadcast <string>(NotifyTypes.CreateBattle, data.OpenKey); }, null, "动手", "撤退"); return; } break; case SceneEventOpenType.NeedItem: if (DbManager.Instance.GetUsedItemNumByItemId(data.OpenKey) <= 0) { ItemData item = JsonManager.GetInstance().GetMapping <ItemData>("ItemDatas", data.OpenKey); if (DbManager.Instance.GetItemNumByItemId(data.OpenKey) > 0) { ConfirmCtrl.Show(string.Format("需要交出<color=\"#1ABDE6\">{0}</color>才能通过", item.Name), () => { if (DbManager.Instance.CostItemFromBag(data.OpenKey, 1)) { DbManager.Instance.UpdateUsedItemRecords(data.OpenKey, 1); } }, null, "给", "不给"); } else { AlertCtrl.Show(string.Format("行囊里没有<color=\"#1ABDE6\">{0}</color>,不能过去!{1}", item.Name, data.Notice)); } return; } break; case SceneEventOpenType.NeedTasks: if (!string.IsNullOrEmpty(data.StringValue)) { string[] taskIds = data.StringValue.Split(new char[] { '|' }); if (!DbManager.Instance.HasAnyTask(taskIds)) { AlertCtrl.Show(string.Format("前方暂时无法通过!\n<color=\"#00FF00\">{0}</color>", data.Notice)); return; } } break; default: break; } } } } //判定体力是否足够移动 DbManager.Instance.MoveOnArea(direction, duringMove); // Messenger.Broadcast<string, int, bool>(NotifyTypes.MoveOnAreaEcho, direction, 666, duringMove); }); Messenger.AddListener <string, int, bool>(NotifyTypes.MoveOnAreaEcho, (direction, foodsNum, duringMove) => { AreaMainPanelCtrl.MakeArrowShow(direction, foodsNum); Vector2 pos = AreaModel.CurrentTarget.Move(direction, foodsNum > 0, duringMove); AreaMainPanelCtrl.MakeSetPosition(pos); if (foodsNum <= 0) { AlertCtrl.Show("干粮耗尽, 先回城镇休整", () => { Messenger.Broadcast(NotifyTypes.BackToCity); }); } }); Messenger.AddListener <Vector2, bool>(NotifyTypes.SetAreaPosition, (pos, doEvent) => { AreaMainPanelCtrl.MakeSetPosition(pos); if (AreaModel.AreaMainScript != null) { AreaModel.AreaMainScript.SetPosition(pos, doEvent); } }); Messenger.AddListener <string>(NotifyTypes.GetActiveEventsInArea, (sceneId) => { DbManager.Instance.GetActiveEventsInArea(sceneId); }); Messenger.AddListener <List <EventData> >(NotifyTypes.GetActiveEventsInAreaEcho, (events) => { if (AreaModel.AreaMainScript != null) { AreaModel.AreaMainScript.UpdateActiveAreaEventsData(events); AreaModel.AreaMainScript.RefreshActiveAreaEventsView(); } }); Messenger.AddListener <EventData>(NotifyTypes.HandleDisableEvent, (ev) => { if (AreaModel.AreaMainScript != null) { AreaModel.AreaMainScript.HandleDisableEvent(ev); } }); Messenger.AddListener <bool>(NotifyTypes.ReleaseDisableEvent, (win) => { if (AreaModel.AreaMainScript != null) { AreaModel.AreaMainScript.ReleaseDisableEvent(win); } }); Messenger.AddListener <string, EventData>(NotifyTypes.PushDisableEvent, (eventId, eventData) => { if (AreaModel.AreaMainScript != null) { AreaModel.AreaMainScript.PushDisableEvent(eventId, eventData); } }); Messenger.AddListener(NotifyTypes.ClearDisableEventIdMapping, () => { if (AreaModel.AreaMainScript != null) { AreaModel.AreaMainScript.ClearDisableEventIdMapping(); } }); Messenger.AddListener <int>(NotifyTypes.EatFood, (num) => { int eatNum = DbManager.Instance.EatFood(num); AlertCtrl.Show(string.Format("打开包袱发现<color=\"#00FF00\">{0}个干粮</color>{1}", num, eatNum != num ? "\n你的行囊只装得下<color=\"#FF0000\">" + eatNum + "个</color>" : "")); }); }
void onClick(GameObject e) { if (Time.fixedTime - date <= timeout) { return; } switch (e.name) { case "SureBtn": case "Block": Back(); break; case "ResetBtn": ConfirmCtrl.Show("是否打开塔内重置机关?\n<color=\"#ff0000\">[重置后塔内守卫将会重生]</color>", () => { Messenger.Broadcast <List <SceneEventType> >(NotifyTypes.ClearDisableEventIdMapping, null); Statics.CreatePopMsg(Vector3.zero, "通天塔内守卫全部重生!", Color.red, 30); }); break; case "difficultyBtn0": if (difficultyBtns[0].enabled) { ConfirmCtrl.Show("是否激活普通强度?", () => { if (DbManager.Instance.CostSilver(10000)) { PlayerPrefs.SetInt("TowerDifficulty", 0); Messenger.Broadcast(NotifyTypes.OpenTowerGuiderPanel); Statics.CreatePopMsg(Vector3.zero, "普通的量子强度被激活", Color.white, 30); } else { AlertCtrl.Show("银子不足!"); } }); } break; case "difficultyBtn1": if (difficultyBtns[1].enabled) { ConfirmCtrl.Show("是否激活噩梦强度?\n(4倍修为)", () => { if (DbManager.Instance.CostSilver(180000)) { PlayerPrefs.SetInt("TowerDifficulty", 1); Messenger.Broadcast(NotifyTypes.OpenTowerGuiderPanel); Statics.CreatePopMsg(Vector3.zero, "噩梦的量子强度被激活", new Color(0.93f, 1, 0.33f), 30); } else { AlertCtrl.Show("银子不足!"); } }); } break; case "difficultyBtn2": if (difficultyBtns[2].enabled) { ConfirmCtrl.Show("是否激活绝望强度?\n(8倍修为)", () => { if (DbManager.Instance.CostSilver(980000)) { PlayerPrefs.SetInt("TowerDifficulty", 2); Messenger.Broadcast(NotifyTypes.OpenTowerGuiderPanel); Statics.CreatePopMsg(Vector3.zero, "绝望的量子强度被激活", new Color(0.98f, 0.26f, 0.26f), 30); } else { AlertCtrl.Show("银子不足!"); } }); } break; default: break; } }
void onClick(GameObject e) { if (Time.fixedTime - date <= timeout) { return; } switch (e.name) { case "EnterOccupation0": ConfirmCtrl.Show("丐帮乃中原第一大帮\n兵器:缠手 镇派绝学:降龙十八掌\n特点:高外攻 缴械\n是否加入?", () => { Messenger.Broadcast <string>(NotifyTypes.AddANewTask, "task_occupation0"); Back(); }); break; case "EnterOccupation1": if (DbManager.Instance.HostData.Gender == GenderType.Male) { ConfirmCtrl.Show("天下武功出少林\n兵器:棍 镇派绝学:袈裟伏魔功\n特点:高外防 眩晕\n是否加入?", () => { Messenger.Broadcast <string>(NotifyTypes.AddANewTask, "task_occupation1"); Back(); }); } else { AlertCtrl.Show("少林乃佛门清净之地,不接纳女弟子"); return; } break; case "EnterOccupation2": ConfirmCtrl.Show("全真乃玄门正宗\n兵器:剑 镇派绝学:北斗七星剑法\n特点:高内攻 清空负面状态\n是否加入?", () => { Messenger.Broadcast <string>(NotifyTypes.AddANewTask, "task_occupation2"); Back(); }); break; case "EnterOccupation3": ConfirmCtrl.Show("大理段氏以武立国\n兵器:缠手 镇派绝学:六脉神剑\n特点:超强内攻 定身 混乱 眩晕\n是否加入?", () => { Messenger.Broadcast <string>(NotifyTypes.AddANewTask, "task_occupation3"); Back(); }); break; case "EnterOccupation4": ConfirmCtrl.Show("轻灵飘逸闲雅清隽任逍遥\n兵器:笛子 镇派绝学:北冥神功\n特点:高内攻 瞬间大量回血\n是否加入?", () => { Messenger.Broadcast <string>(NotifyTypes.AddANewTask, "task_occupation4"); Back(); }); break; case "EnterOccupation5": ConfirmCtrl.Show("撼山易,撼岳家军难\n兵器:枪 镇派绝学:镇军穿云枪法\n特点:超高外攻\n是否加入?", () => { Messenger.Broadcast <string>(NotifyTypes.AddANewTask, "task_occupation5"); Back(); }); break; case "SureBtn": case "Block": Back(); break; default: break; } // AlertCtrl.Show("去吧去吧,老夫已为你做了引荐"); }
void onClick(GameObject e) { ConfirmCtrl.Show(string.Format("马上就要出发前往<color=\"#00FF00\">{0}</color>了,客官是否准备妥当?", resultData.Name), () => { Messenger.Broadcast <int, int>(NotifyTypes.GoToCity, resultData.FromIndex, resultData.ToIndex); }, null, "是的", "等下"); }
/// <summary> /// Scenes the notify init. /// </summary> public static void AreaNotifyInit() { Messenger.AddListener <AreaTarget, AreaMain>(NotifyTypes.AreaInit, (target, main) => { AreaModel.CurrentTarget = target; AreaModel.AreaMainScript = main; //加载动态事件列表 Messenger.Broadcast <string>(NotifyTypes.GetActiveEventsInArea, UserModel.CurrentUserData.CurrentAreaSceneName); //打开大地图UI交互界面 Messenger.Broadcast(NotifyTypes.CallAreaMainPanelData); //如果当前所处的位置是城镇,则进入城镇 if (UserModel.CurrentUserData.PositionStatu == UserPositionStatusType.InCity) { Messenger.Broadcast <string>(NotifyTypes.EnterCityScene, UserModel.CurrentUserData.CurrentCitySceneId); } }); Messenger.AddListener(NotifyTypes.AreaDestroyed, () => { if (AreaModel.CurrentTarget != null && AreaModel.CurrentTarget.gameObject != null) { MonoBehaviour.Destroy(AreaModel.CurrentTarget.gameObject); AreaModel.CurrentTarget = null; } Messenger.Broadcast(NotifyTypes.HideAreaMainPanel); }); Messenger.AddListener(NotifyTypes.CallAreaMainPanelData, () => { Messenger.Broadcast <System.Action <UserData> >(NotifyTypes.CallUserData, (userData) => { Messenger.Broadcast <JArray>(NotifyTypes.CallAreaMainPanelDataEcho, new JArray(userData.AreaFood.IconId, userData.AreaFood.Num, userData.AreaFood.MaxNum, userData.CurrentAreaSceneName)); Vector2 pos = new Vector2(userData.CurrentAreaX, userData.CurrentAreaY); Messenger.Broadcast <Vector2, bool>(NotifyTypes.SetAreaPosition, pos, false); }); }); Messenger.AddListener <JArray>(NotifyTypes.CallAreaMainPanelDataEcho, (data) => { AreaMainPanelCtrl.Show(data); Messenger.Broadcast(NotifyTypes.MakeUpdateProps); }); Messenger.AddListener(NotifyTypes.MakeUpdateProps, () => { AreaMainPanelCtrl.MakeUpdateProps(DbManager.Instance.GetAllProps()); }); Messenger.AddListener <PropType, int>(NotifyTypes.AddProp, (type, num) => { DbManager.Instance.AddProp(type, num); Messenger.Broadcast(NotifyTypes.MakeUpdateProps); }); Messenger.AddListener <PropType, int>(NotifyTypes.UseProp, (type, num) => { DbManager.Instance.UseProp(type, num); }); Messenger.AddListener(NotifyTypes.HideAreaMainPanel, () => { AreaMainPanelCtrl.Hide(); }); Messenger.AddListener <string, bool>(NotifyTypes.MoveOnArea, (direction, duringMove) => { //如果触发战斗则禁止移动 if (BattleFightPanelCtrl.Ctrl != null || !AreaModel.CurrentTarget.CanTriggerEvent()) { return; } //移动前先判断移动目的地是否有战斗 Vector2 nextMovePosition = AreaModel.CurrentTarget.GetNextMovePosition(direction); //判断前方是否是障碍 tk2dRuntime.TileMap.TileInfo groundTile = AreaModel.CurrentTarget.GetTileInfo((int)nextMovePosition.x, (int)nextMovePosition.y, 0); //判断禁止通过的碰撞区域 if (groundTile == null || groundTile.stringVal == "obstacle") { Statics.CreatePopMsg(Vector3.zero, "撞到墙上了,请绕行", Color.white, 30); return; } string fightEventId = string.Format("{0}_{1}_{2}", UserModel.CurrentUserData.CurrentAreaSceneName, (int)nextMovePosition.x, (int)nextMovePosition.y); EventData data; if (AreaMain.ActiveAreaEventsMapping.ContainsKey(fightEventId)) { data = AreaMain.ActiveAreaEventsMapping[fightEventId]; if (data.Type == SceneEventType.Battle) { ConfirmCtrl.Show("前方将有恶战,是否继续?", () => { Messenger.Broadcast <string>(NotifyTypes.CreateBattle, data.EventId); }, null, "动手", "撤退"); return; } } else if (AreaMain.StaticAreaEventsMapping.ContainsKey(fightEventId)) { //判断静态事件是否禁用 if (!AreaMain.DisableEventIdMapping.ContainsKey(fightEventId)) { data = AreaMain.StaticAreaEventsMapping[fightEventId]; if (data.Type == SceneEventType.Battle) { ConfirmCtrl.Show("前方将有恶战,是否继续?", () => { Messenger.Broadcast <string>(NotifyTypes.CreateBattle, data.EventId); //处理静态事件的预禁用操作 EventData disableEvent = new EventData(); disableEvent.Id = fightEventId; disableEvent.Type = SceneEventType.DisableEvent; disableEvent.X = (int)nextMovePosition.x; disableEvent.Y = (int)nextMovePosition.y; Messenger.Broadcast <EventData>(NotifyTypes.HandleDisableEvent, disableEvent); }, null, "动手", "撤退"); return; } if (data.Type == SceneEventType.Pagoda) { ConfirmCtrl.Show("前方有守卫,是否继续?", () => { string eventId = data.EventId; if (eventId == "10310020") { //处理金兀术难度选择后战斗id的变化 int difficulty = PlayerPrefs.GetInt("TowerDifficulty"); switch (difficulty) { case 1: eventId = "10310021"; break; case 2: eventId = "10310022"; break; default: break; } } Messenger.Broadcast <string>(NotifyTypes.CreateBattle, eventId); //处理静态事件的预禁用操作 EventData disableEvent = new EventData(); disableEvent.Id = fightEventId; disableEvent.EventId = eventId; disableEvent.Type = SceneEventType.DisablePagoda; disableEvent.X = (int)nextMovePosition.x; disableEvent.Y = (int)nextMovePosition.y; Messenger.Broadcast <EventData>(NotifyTypes.HandleDisableEvent, disableEvent); }, null, "动手", "撤退"); return; } else if (data.OpenType != SceneEventOpenType.None) { //静态事件有一个开启判定类型 switch (data.OpenType) { case SceneEventOpenType.FightWined: if (!DbManager.Instance.IsFightWined(data.OpenKey)) { ConfirmCtrl.Show(string.Format("前方有强敌守卫,是否硬闯?{0}", data.Notice), () => { Messenger.Broadcast <string>(NotifyTypes.CreateBattle, data.OpenKey); }, null, "动手", "撤退"); return; } break; case SceneEventOpenType.NeedItem: if (DbManager.Instance.GetUsedItemNumByItemId(data.OpenKey) <= 0) { ItemData item = JsonManager.GetInstance().GetMapping <ItemData>("ItemDatas", data.OpenKey); if (DbManager.Instance.GetItemNumByItemId(data.OpenKey) > 0) { ConfirmCtrl.Show(string.Format("需要交出 <color=\"#1ABDE6\">{0}</color> 才能通过", item.Name), () => { if (DbManager.Instance.CostItemFromBag(data.OpenKey, 1)) { DbManager.Instance.UpdateUsedItemRecords(data.OpenKey, 1); AlertCtrl.Show(string.Format("交出了 <color=\"#1ABDE6\">{0}</color>", item.Name)); } }, null, "给", "不给"); } else { AlertCtrl.Show(string.Format("行囊里没有<color=\"#1ABDE6\">{0}</color>,不能过去!{1}", item.Name, data.Notice)); } return; } break; case SceneEventOpenType.NeedTasks: if (!string.IsNullOrEmpty(data.StringValue)) { string[] taskIds = data.StringValue.Split(new char[] { '|' }); if (!DbManager.Instance.HasAnyTask(taskIds)) { AlertCtrl.Show(string.Format("前方暂时无法通过!\n<color=\"#00FF00\">{0}</color>", data.Notice)); return; } } break; default: break; } } } } //判定体力是否足够移动 DbManager.Instance.MoveOnArea(direction, duringMove); // Messenger.Broadcast<string, int, bool>(NotifyTypes.MoveOnAreaEcho, direction, 666, duringMove); }); Messenger.AddListener <string, int, bool>(NotifyTypes.MoveOnAreaEcho, (direction, foodsNum, duringMove) => { if (foodsNum > 0) { AreaMainPanelCtrl.MakeArrowShow(direction, foodsNum); Vector2 pos = AreaModel.CurrentTarget.Move(direction, foodsNum > 0, duringMove); AreaMainPanelCtrl.MakeSetPosition(pos); } else { if (UserModel.CurrentRebornTimes >= UserModel.MaxRebornTimes) { AlertCtrl.Show("干粮耗尽, 先回城镇休整", () => { Messenger.Broadcast(NotifyTypes.BackToCity); }); } else { // ConfirmCtrl.Show(string.Format("干粮耗尽,您愿意观看一段视频获得{0}点体力吗?\n(复活次数:{1}/{2})", UserModel.CurrentFoodNums / 2, UserModel.MaxRebornTimes - UserModel.CurrentRebornTimes, UserModel.MaxRebornTimes), () => { // MaiHandler.StartRewardedVideo(() => { // UserModel.CurrentFoodNums = UserModel.CurrentFoodNums / 2; // UserModel.CurrentRebornTimes++; // Messenger.Broadcast<int>(NotifyTypes.EatFood, UserModel.CurrentFoodNums); // }); // MaiHandler.SendEvent("StartRewardedVideoForFoods", DbManager.Instance.HostData.Lv.ToString()); // }, () => { // Messenger.Broadcast(NotifyTypes.BackToCity); // }, "观看", "不了"); ConfirmCtrl.Show(string.Format("干粮耗尽,您愿意花费5000两银子获得{0}点体力吗?\n(复活次数:{1}/{2})", UserModel.CurrentFoodNums / 2, UserModel.MaxRebornTimes - UserModel.CurrentRebornTimes, UserModel.MaxRebornTimes), () => { if (DbManager.Instance.CostSilver(5000)) { UserModel.CurrentFoodNums = UserModel.CurrentFoodNums / 2; UserModel.CurrentRebornTimes++; Messenger.Broadcast <int>(NotifyTypes.EatFood, UserModel.CurrentFoodNums); } else { AlertCtrl.Show("银两不足, 先回城镇休整", () => { Messenger.Broadcast(NotifyTypes.BackToCity); }); } MaiHandler.SendEvent("StartRewardedVideoForFoods", DbManager.Instance.HostData.Lv.ToString()); }, () => { Messenger.Broadcast(NotifyTypes.BackToCity); }, "花钱", "不了"); } BattleFightPanelCtrl.Hide(); //强制退出战斗 } }); Messenger.AddListener <Vector2, bool>(NotifyTypes.SetAreaPosition, (pos, doEvent) => { AreaMainPanelCtrl.MakeSetPosition(pos); if (AreaModel.AreaMainScript != null) { AreaModel.AreaMainScript.SetPosition(pos, doEvent); } }); Messenger.AddListener <string>(NotifyTypes.GetActiveEventsInArea, (sceneId) => { DbManager.Instance.GetActiveEventsInArea(sceneId); }); Messenger.AddListener <List <EventData> >(NotifyTypes.GetActiveEventsInAreaEcho, (events) => { if (AreaModel.AreaMainScript != null) { AreaModel.AreaMainScript.UpdateActiveAreaEventsData(events); AreaModel.AreaMainScript.RefreshActiveAreaEventsView(); } }); Messenger.AddListener <EventData>(NotifyTypes.HandleDisableEvent, (ev) => { if (AreaModel.AreaMainScript != null) { AreaModel.AreaMainScript.HandleDisableEvent(ev); } }); Messenger.AddListener <bool>(NotifyTypes.ReleaseDisableEvent, (win) => { if (AreaModel.AreaMainScript != null) { AreaModel.AreaMainScript.ReleaseDisableEvent(win); } }); Messenger.AddListener <string, EventData>(NotifyTypes.PushDisableEvent, (eventId, eventData) => { if (AreaModel.AreaMainScript != null) { AreaModel.AreaMainScript.PushDisableEvent(eventId, eventData); } }); Messenger.AddListener <List <SceneEventType> >(NotifyTypes.ClearDisableEventIdMapping, (excepts) => { if (AreaModel.AreaMainScript != null) { AreaModel.AreaMainScript.ClearDisableEventIdMapping(excepts); } }); Messenger.AddListener <int>(NotifyTypes.EatFood, (num) => { int eatNum = DbManager.Instance.EatFood(num); AlertCtrl.Show(string.Format("打开包袱发现<color=\"#00FF00\">{0}个干粮</color>{1}", num, eatNum != num ? "\n你的行囊只装得下<color=\"#FF0000\">" + eatNum + "个</color>" : "")); }); }