public void UpgradeSkill(int skillId, GameObject upGrade) { GameSkillBase skill = SkillManager.singleton.GetSkill(skillId); if (skill != null) { int level = skill.level; if (level <= skill.skillConfig.upgradeGold.Count) { skill.level = level + 1; //播放升级的动画?减少金币 EventDispatch.Broadcast(Events.DlgFlyTextShow); EventDispatch.Broadcast <string>(Events.DlgAddSingleSystemInfo, "成功升级该技能"); int upGradeGold = skill.skillConfig.upgradeGold[level]; UserPrefsBase.singleton.AddMoney(-upGradeGold); if (level + 1 >= skill.skillConfig.upgradeGold.Count) { //已经是最打等级 //隐藏 upGrade.SetActive(false); } } else { Debug.LogError("已经是最打等级"); } } }
public override void OnEnter() { PlayerManager.singleton.LoadAllEntity(); SceneManager.singleton.LoadScene(); EventDispatch.Broadcast(Events.DlgMainShow); AudioManagerBase.Instance.StopMusic(); }
public void CastSkill(string token) { int skillId = -1; if (string.IsNullOrEmpty(token)) { if (!GuideModel.singleton.bIsGuideAllComp) { //再次尝试 GuideModel.singleton.NowTaskId = 6007; EventDispatch.Broadcast(Events.DlgGuideExecuteNextTask); } } else { //出现口令 skillId = SkillManager.singleton.MatchSkill(token); if (skillId == -1) { Debug.Log("匹配不到技能"); this.ShowToken(token); if (!GuideModel.singleton.bIsGuideAllComp) { //再次尝试 GuideModel.singleton.NowTaskId = 6007; EventDispatch.Broadcast(Events.DlgGuideExecuteNextTask); } } } GameSkillBase skill = SkillManager.singleton.GetSkill(skillId); if (skill != null) { this.ShowToken(skill.skillConfig.skillName); skill.Enter(this.entity, true); if (!GuideModel.singleton.bIsGuideAllComp) { TimerManager.AddTimer(4000, 0, () => { GuideModel.singleton.NowTaskId = 6008; EventDispatch.Broadcast(Events.DlgGuideExecuteNextTask); }); } } if (this.ShowTokenTimerId != uint.MinValue) { TimerManager.DelTimer(this.ShowTokenTimerId); this.ShowTokenTimerId = TimerManager.AddTimer(4000, 0, () => { this.ShowToken("", false); }); } else { this.ShowTokenTimerId = TimerManager.AddTimer(4000, 0, () => { this.ShowToken("", false); }); } }
public void CastSkillError(string error) { //防止最开始出现token气泡 if (!GuideModel.singleton.bIsGuideAllComp && GuideModel.singleton.bIsSelfSpeaked == false) { return; } if (!GuideModel.singleton.bIsGuideAllComp) { //再次尝试 GuideModel.singleton.NowTaskId = 6007; EventDispatch.Broadcast(Events.DlgGuideExecuteNextTask); } //出现口令 this.ShowToken(error); this.ShowMask(false); if (this.ShowTokenTimerId != uint.MinValue) { TimerManager.DelTimer(this.ShowTokenTimerId); this.ShowTokenTimerId = TimerManager.AddTimer(4000, 0, () => { this.ShowToken("", false); }); } else { this.ShowTokenTimerId = TimerManager.AddTimer(4000, 0, () => { this.ShowToken("", false); }); } }
private void OnClickOkButton() { EventDispatch.Broadcast(Events.DlgTextEnterLearn); this.FinishTask(); GuideModel.singleton.NowTaskId = 6004; EventDispatch.Broadcast(Events.DlgGuideExecuteNextTask); }
public void OnClickButtonSpeakTest() { GameSkillBase skill = SkillManager.singleton.GetSkill(this.selectSkillId); //等音频播放结束后,然后角色播放动作 if (skill != null) { this.ShowSpeakButton(false); //出现口令 this.ShowToken(skill.skillConfig.skillRealToken); skill.Enter(this.entity, true); TimerManager.AddTimer(4000, 0, () => { this.ShowToken("", false); this.ShowSpeakButton(true); if (!GuideModel.singleton.bIsGuideAllComp && GuideModel.singleton.bIsSelfSpeaked == false) { //然后开始guide进入自己说 GuideModel.singleton.NowTaskId = 6005; GuideModel.singleton.bIsSelfSpeaked = true; EventDispatch.Broadcast(Events.DlgGuideExecuteNextTask); } }); } }
public void EndWave() { this.AllDuration = 0; this.dicCreateEntitys.Clear(); LevelManager.singleton.curWaveIndex += 1; if (!this.curWaveDicEntitys.ContainsKey(LevelManager.singleton.curWaveIndex)) { //说明没有下一波,结束当前关卡 this.Clear(); LevelManager.singleton.Clear(); SkillManager.singleton.ClearSkill(); //通知主界面结束游戏 EventDispatch.Broadcast <bool>(Events.DlgMainEndLevel, true); } else { //开始下一波 this.StartWave(LevelManager.singleton.GetCurLevel(), LevelManager.singleton.curWaveIndex); //刷新界面 EventDispatch.Broadcast(Events.DlgMainRefresh); //加载所有怪物 PlayerManager.singleton.LoadAllEntity(() => { PlayerManager.singleton.ShowCurWaveMaster(); }); } }
public void OnPlayNextFailed() { Debug.Log("12312312PlayNext"); EventDispatch.Broadcast(Events.DlgFlyTextShow); //显示玩家需要等广告缓冲一段时间 EventDispatch.Broadcast <string>(Events.DlgAddSingleSystemInfo, "广告观看失败,请完整看完广告或者你的手机不支持广告功能!"); }
private void SetLoadingVisible(ELoadingStyle dlgType, bool bVisible) { //switch (dlgType) //{ // case ELoadingStyle.LoadingWait: // if (bVisible) // { // EventDispatch.Broadcast(EventsBase.OnLoadingWaitUIShow); // } // else // { // EventDispatch.Broadcast(EventsBase.OnLoadingWaitUIHide); // } // break; // case ELoadingStyle.LoadingNormal: // if (bVisible) // { // EventDispatch.Broadcast(Events.DlgLoadingShow); // } // else // { // EventDispatch.Broadcast(Events.DlgLoadingHide); // } // break; //} if (bVisible) { EventDispatch.Broadcast(Events.DlgLoadingShow); } else { EventDispatch.Broadcast(Events.DlgLoadingHide); } }
public override void OnLeave() { if (ClientGameStateManager.singleton.ENextGameState.Equals("TestState")) { return; } EventDispatch.Broadcast(Events.DlgStartHide); EventDispatch.Broadcast(Events.DlgLevelHide); }
public override void OnLeave() { BattleController.singleton.LeaveGameMain(); PlayerManager.singleton.UnloadAllEntity(); EventDispatch.Broadcast(Events.DlgMainHide); SceneManager.singleton.Clear(); SceneManager.singleton.ClearLater(); AudioManagerBase.Instance.StopMusic(); }
//任务结束广播消息 public virtual void FinishTask() { if (m_bFinished) { return; } m_bFinished = true; EventDispatch.Broadcast <EGuideTaskType, int>(Events.DlgGuideChildTaskFinished, this.taskType, this.TaskId); }
public void AddGuideEventButton(GameObject obj) { if (obj == null || GuideModel.singleton.UIGuideButtonGameObject.ContainsKey(obj.name)) { return; } GuideModel.singleton.UIGuideButtonGameObject.Add(obj.name, obj); //通知事件 EventDispatch.Broadcast(Events.DlgAddGuideEvent, obj); }
public void EnterLock(int skillId) { if (!GuideModel.singleton.bIsGuideAllComp && GuideModel.singleton.bIsFirstLocked == false) { if (skillId > 0) { if (SkillManager.singleton.LockSkill(skillId)) { this.RefreshSkillItem(skillId); GuideModel.singleton.bIsFirstLocked = true; } } } else { if (UnityMonoDriver.s_instance.ReleaseMode == false) { if (skillId > 0) { if (SkillManager.singleton.LockSkill(skillId)) { this.RefreshSkillItem(skillId); //UserPrefsBase.singleton.AddMoney(-SkillManager.singleton.GetSkill(skillId).skillConfig.lockGold); EventDispatch.Broadcast(Events.DlgFlyTextShow); //提示解锁成功 EventDispatch.Broadcast <string>(Events.DlgAddSingleSystemInfo, "解锁成功!快去练习下吧!"); } } return; } //需要金币解锁 if (UserPrefsBase.singleton.Money < SkillManager.singleton.GetSkill(skillId).skillConfig.lockGold) { EventDispatch.Broadcast(Events.DlgFlyTextShow); //提示金币不足 EventDispatch.Broadcast <string>(Events.DlgAddSingleSystemInfo, "金币不足,请获取金币再来解锁!"); } else { if (skillId > 0) { if (SkillManager.singleton.LockSkill(skillId)) { this.RefreshSkillItem(skillId); UserPrefsBase.singleton.AddMoney(-SkillManager.singleton.GetSkill(skillId).skillConfig.lockGold); EventDispatch.Broadcast(Events.DlgFlyTextShow); //提示解锁成功 EventDispatch.Broadcast <string>(Events.DlgAddSingleSystemInfo, "解锁成功!快去练习下吧!"); } } } } }
public void OnClickEnterGameButton() { if (this.selectLevelId > 0) { LevelManager.singleton.EnterLevel(this.selectLevelId); BattleController.singleton.EnterGameMain(); ClientGameStateManager.singleton.ChangeGameState("GameMainState", CaomaoFramework.GameState.ELoadingStyle.LoadingNormal, () => { EventDispatch.Broadcast(Events.DlgLoadingAllFinished); }); } }
private void SetLoadingVisible(ELoadingStyle dlgType, bool bVisible) { switch (dlgType) { case ELoadingStyle.LoaidngWait: EventDispatch.Broadcast(this.m_sLoadWaitUIEvent); break; case ELoadingStyle.LoadingNormal: EventDispatch.Broadcast(this.m_sLoadNormalUIEvent); break; } }
public void OnChangeToNextTask() { this.ClearExecuteGuideTask(); //如果完成的任务是模块的最后一个任务,告诉服务器 if (GuideModel.singleton.TaskMrgData.Moduleend) { //保存下 string finished = PlayerPrefs.GetString(CommonDefineBase.GuideFinish); if (string.IsNullOrEmpty(finished)) { finished = GuideModel.singleton.TaskMrgData.TaskType.ToString(); } else { finished += "," + GuideModel.singleton.TaskMrgData.TaskType; } PlayerPrefs.SetString(CommonDefineBase.GuideFinish, finished); if ((EGuideStepInfo)GuideModel.singleton.TaskMrgData.TaskType == EGuideStepInfo.WatchAds) { //结束 GuideModel.singleton.bIsGuideAllComp = true; GuideModel.singleton.bIsGuideBattle = false; GuideModel.singleton.ClearData(); string finished2 = PlayerPrefs.GetString(CommonDefineBase.GuideFinish); finished2 += ",ok"; PlayerPrefs.SetString(CommonDefineBase.GuideFinish, finished2); } } if (GuideModel.singleton.bIsGuideAllComp) { //不显示GUideUI this.Exit(); return; } if (GuideModel.singleton.TaskMrgData.NextTaskId == -1) { return; } GuideModel.singleton.NowTaskId = GuideModel.singleton.TaskMrgData.NextTaskId; if (!GameData <DataGuideParentTaskInfo> .dataMap.ContainsKey(GuideModel.singleton.NowTaskId)) { return; } GuideModel.singleton.TaskMrgData = GameData <DataGuideParentTaskInfo> .dataMap[GuideModel.singleton.NowTaskId]; if (GuideModel.singleton.TaskMrgData == null) { return; } EventDispatch.Broadcast(Events.DlgGuideExecuteNextTask); }
public virtual void Exit() { EventDispatch.Broadcast <int>(Events.DlgMainStartCd, this.skillConfig.skillId); if (PlayerManager.singleton.MySelf != null) { PlayerManager.singleton.MySelf.Idle(); } if (actor != null) { actor.Exit(); actor = null; } SkillManager.singleton.runningSkills.Remove(this); }
public void OnPointerUp(PointerEventData eventData) { if (onClickUp != null) { onClickUp(); return; } #if UNITY_ANDROID VoiceManager.Instance.StopSpeech(); #elif UNITY_IOS VoiceManager.Instance.StopSpeech_IOS(); #endif EventDispatch.Broadcast <bool>(Events.DlgMainShowMask, false); EventDispatch.Broadcast <bool>(Events.DlgTextShowMask, false); }
public void OverGame() { this.AllDuration = 0; this.dicCreateEntitys.Clear(); foreach (var entity in allVisiableMonster) { if (entity != null && entity.GameObject != null) { entity.Clear(); } } this.Clear(); LevelManager.singleton.Clear(); SkillManager.singleton.ClearSkill(); //通知主界面结束游戏 EventDispatch.Broadcast <bool>(Events.DlgMainEndLevel, false); }
public override void FinishTask() { this.EventButton.transform.SetParent(this.EventButtonTempParent); if (this.ShowView != null) { this.ShowView.transform.SetParent(this.EventButtonTempParent); } this.EventButtonTempParent = null; if (data.BtnTriggerType == (int)EButtonTriggerType.Click) { Selectable eventBtn = this.EventButton.GetComponent <Selectable>(); if (eventBtn != null) { if (eventBtn is Button) { (eventBtn as Button).onClick.RemoveListener(this.OnClick); } else { (eventBtn as Toggle).onValueChanged.RemoveListener(this.OnSelect); } } else { if (controller != null) { controller.onClickDown -= this.OnClick; controller.onClickUp -= this.OnClickUp; controller.onClickDown = null; controller.onClickUp = null; #if UNITY_ANDROID VoiceManager.Instance.StartSpeech(); #elif UNITY_IOS VoiceManager.Instance.StartSpeech_IOS(); #endif EventDispatch.Broadcast <bool>(Events.DlgTextShowMask, true); } } } this.controller = null; this.data = null; this.ShowView = null; base.FinishTask(); }
public void EndLevel(bool bWin) { if (bWin) { //开始解锁下一关 bool bEndLevel = !LevelManager.singleton.LockedNextLevel(); //播放胜利音乐 AudioManagerBase.Instance.PlayMusic(CommonDefineBase.VictoryAudioPath); //显示胜利界面 int lastLevel = 0; if (bEndLevel) { lastLevel = LevelManager.singleton.currLevelId; bEndLevel = true; } else { lastLevel = LevelManager.singleton.currLevelId - 1; bEndLevel = false; } int money = LevelManager.singleton.GetLevel(lastLevel).levelGold; //增加金币 UserPrefsBase.singleton.AddMoney(money); this.ShowGetMoney(money); this.EndAllInCDSkillView(); } else { //播放失败音乐 AudioManagerBase.Instance.PlayMusic(CommonDefineBase.DefaultAudioPath); //显示失败界面 TimerManager.AddTimer(2000, 0, () => { SkillManager.singleton.ClearSkill(); EventDispatch.Broadcast(Events.DlgFlyTextShow); EventDispatch.Broadcast <string, Action>(Events.DlgAddSingleActionSystemInfo, "挑战失败!是否重新开始?(小提示:可以去练功房学习更多的技能再来挑战!)", () => { ClientGameStateManager.singleton.ChangeGameState("StartState"); }); }); } }
public void OnAdsPlaySuccess() { //发送给游戏服务器记录广告次数 int time = -1; if (PlayerPrefs.HasKey(CommonDefineBase.Ads)) { string[] content = PlayerPrefs.GetString(CommonDefineBase.Ads).Split(':'); DateTime lastWatchTime = new DateTime(0); lastWatchTime.AddTicks(long.Parse(content[0])); time = int.Parse(content[1]); if (time == 0) { TimeSpan leftTime = DateTime.Now - lastWatchTime; if (leftTime.Hours >= 24) { time = CommonDefineBase.AdsTime; } else { EventDispatch.Broadcast(Events.DlgFlyTextShow); EventDispatch.Broadcast <string>(Events.DlgAddSingleSystemInfo, "每天只能看5次广告哦!还要" + leftTime.Hours + "小时才能继续观看!"); return; } } } else { PlayerPrefs.SetString(CommonDefineBase.Ads, string.Format("{0}:{1}", DateTime.Now.Ticks, CommonDefineBase.AdsTime)); time = CommonDefineBase.AdsTime; } time--; UserPrefsBase.singleton.AddMoney(200); PlayerPrefs.SetString(CommonDefineBase.Ads, string.Format("{0}:{1}", DateTime.Now.Ticks, time)); Debug.Log("Success"); }
/// <summary> /// 在收到服务器发送的已经完成的任务Id列表 /// </summary> /// <param name="finishList"></param> public void GuideFinishModelList(List <int> finishList) { GuideModel.singleton.GuideFinishedList.Clear(); GuideModel.singleton.GuideFinishedList.AddRange(finishList); GuideModel.singleton.CurrentTaskModelId = EGuideStepInfo.GuideStepNull; foreach (EGuideStepInfo step in Enum.GetValues(typeof(EGuideStepInfo))) { if (step == EGuideStepInfo.GuideStepNull) { continue; } if (!GuideModel.singleton.GuideFinishedList.Contains((int)step)) { GuideModel.singleton.CurrentTaskModelId = step; break; } } if (GuideModel.singleton.CurrentTaskModelId != EGuideStepInfo.GuideStepNull) { this.StartModelTask(GuideModel.singleton.CurrentTaskModelId); //显示Guide的UI EventDispatch.Broadcast(Events.DlgPlayGuideShow); } }
public void EnterLearn(int skillId, bool bSelect = true) { this.SKillView.SetActive(false); this.MySelf.SetActive(true); this.parse = TestParse.SkillSelectLearn; GameSkillBase skill = SkillManager.singleton.GetSkill(skillId); if (skill != null) { this.m_Iamge_SkillIcon.sprite = WWWResourceManager.Instance.LoadSpriteFormAtla("common1.ab", skill.skillConfig.skillName); this.m_Text_SkillInfo.text = skill.skillConfig.skillInfo + "\n <color=red>口令:" + skill.skillConfig.skillRealToken + "</color>"; this.m_Text_SkillName.text = skill.skillConfig.skillName; this.SkillLearn.SetActive(true); } if (!GuideModel.singleton.bIsGuideAllComp && bSelect == false) { GuideModel.singleton.NowTaskId = 6004; EventDispatch.Broadcast(Events.DlgGuideExecuteNextTask); } else if (GuideModel.singleton.bIsGuideAllComp) { this.m_Button_Back.gameObject.SetActive(true); } }
public void ShowNextLevelWindow() { this.ShowGetMoney(0, false); TimerManager.AddTimer(2000, 0, () => { AudioManagerBase.Instance.StopMusic(); SkillManager.singleton.ClearSkill(); EventDispatch.Broadcast(Events.DlgFlyTextShow); string tip = this.bEndLevel ? "你已经完成了所有关卡,敬请关注我们的其他游戏!" : "恭喜通过本关!是否继续开始下一关?"; EventDispatch.Broadcast <string, Action, Action>(Events.DlgAddDoubleSystemInfo, tip, () => { if (this.bEndLevel) { //应该回到初始 ClientGameStateManager.singleton.ChangeGameState("StartState"); return; } LevelManager.singleton.EnterLevel(LevelManager.singleton.currLevelId); PlayerManager.singleton.CreateAllEntity(); VoiceManager.Instance.RegisterCallback(PlayerManager.singleton.MySelf.CastSkill); //刷新界面 EventDispatch.Broadcast(Events.DlgMainRefresh); //加载所有怪物 PlayerManager.singleton.LoadAllEntity(() => { PlayerManager.singleton.ShowMySelf(); PlayerManager.singleton.ShowCurWaveMaster(); }); }, () => { ClientGameStateManager.singleton.ChangeGameState("StartState"); }); }); }
public override void OnEnter() { EventDispatch.Broadcast(Events.DlgStartShow); AudioManagerBase.Instance.PlayMusic("Assets.Audios.Musics.Main.mp3"); }
public override void OnEnter() { EventDispatch.Broadcast(Events.DlgTextShow); }
public override void OnEnter() { EventDispatch.Broadcast("DlgLogin"); }
public void Exit() { EventDispatch.Broadcast(Events.DlgPlayGuideHide); }