/* * public string LoadVehicleSounds(string filename, VehicleSounds vehicleSounds, Action<AudioClip, VehicleSounds> onSuccess) { * * filename = GetFileName(filename); * * var filePath = GetPersistentPath(filename); * var file = "file://" + filePath; * * currentFileName = filename; * * LogUtil.Log( "Load: onSuccess: " + onSuccess ); * LogUtil.Log( "Load: filePath: " + filename ); * * var onFailure = new Action<string>( error => LogUtil.Log( error ) ); * #if UNITY_STANDALONE_OSX #elif UNITY_STANDALONE_WIN #elif UNITY_ANDROID * if(CheckIfSoundExists(filePath)) { * CoroutineUtil.Start( loadAudioFileAtPathVehicles( file, vehicleSounds, onFailure, onSuccess ) ); * } #elif UNITY_WEBPLAYER #elif UNITY_IPHONE * if(CheckIfSoundExists(filePath)) { * CoroutineUtil.Start( loadAudioFileAtPathVehicles( file, vehicleSounds, onFailure, onSuccess ) ); * } #elif UNITY_EDITOR #endif * LogUtil.Log( "Load: " + file ); * LogUtil.Log( "Load checked: " + filePath ); * return file; * } */ public virtual string Load(string filename, Action <AudioClip> onSuccess) { filename = GetFileName(filename); var filePath = GetPersistentPath(filename); var file = "file://" + filePath; currentFileName = filename; LogUtil.Log("Load: onSuccess: " + onSuccess); LogUtil.Log("Load: filePath: " + filename); #if !UNITY_WEBPLAYER var onFailure = new Action <string>(error => LogUtil.Log(error)); #endif #if UNITY_STANDALONE_OSX #elif UNITY_STANDALONE_WIN #elif UNITY_ANDROID if (CheckIfSoundExists(filePath)) { CoroutineUtil.Start(loadAudioFileAtPath(file, onFailure, onSuccess)); } #elif UNITY_WEBPLAYER #elif UNITY_IPHONE if (CheckIfSoundExists(filePath)) { CoroutineUtil.Start(loadAudioFileAtPath(file, onFailure, onSuccess)); } #elif UNITY_EDITOR #endif LogUtil.Log("Load: " + file); LogUtil.Log("Load checked: " + filePath); return(file); }
public void Battle(Action onFinish) { bool hasGrandDaughter = GameData._isGrandDaughterInQueue; _onPlotFinish = () => { if (onFinish != null) { onFinish(); } if (hasGrandDaughter) { UIManager._Instance.SetMaskEnable(true); UIManager._Instance.SetSysMsgInfo(string.Format(SystemMessage._removePlayer, GameData._Instance._roleLib.GetRole(ERole.GrandDaughter)._name)); GameData._isGrandDaughterInQueue = false; // 孙女离队,老人失去方向感 // 生成孙女并设置位置 MapManager.ResetMap(48, MapCode.NPC_GRAND_DAUGHTER, true); // TODO 写死位置不好吧 } else { // 如果这里没有孙女那么就去除孙女的NPC信息 Singleton._npcManager.RemoveNPC(ERole.GrandDaughter); } GameData._CanRotateCamera = true; PlotManager.status = EPlotStatus.Battle; }; _plotRoutine = PlotRoutine(ERole.Grandpa, UIManager._Instance.SetTipInfo, hasGrandDaughter ? GameData._Instance._plot_Battle : GameData._Instance._plot_Battle_NoGrandDaughter); CoroutineUtil.Start(_plotRoutine); }
public void BattleAfter(Action onFinish) { var hasGrandDaughter = Singleton._npcManager.GetNPC <GrandDaughter>(ERole.GrandDaughter) != null; Action a = onFinish; a += () => { if (hasGrandDaughter) { _addPlayerRoutine = AddPlayerRoutine(ERole.GrandDaughter, HUDView._maxSysMsgTime / 2); StartCoroutine(_addPlayerRoutine); Player._Instance.transform.eulerAngles = Vector3.zero; GameData._CanRotateCamera = false; UIManager._Instance.SetMaskEnable(false); PlotManager.status = EPlotStatus.Battle_After; // 对话结束,销毁地图上的NPC var pos = MapManager.GetPos(MapCode.NPC_GRAND_DAUGHTER); MapManager.ResetMap(MapManager.CurIndex(pos._x, pos._y)); } }; _plotRoutine = PlotRoutine(ERole.Grandpa, UIManager._Instance.SetTipInfo, hasGrandDaughter ? GameData._Instance._plot_BattleAfter : GameData._Instance._plot_BattleAfter_NoGrandDaughter, a); // _plotRoutine = PlotRoutine(ERole.Grandpa, UIManager._Instance.SetTipInfo, GameData._Instance._plot_BattleAfter, onFinish); CoroutineUtil.Start(_plotRoutine); }
/// <summary> /// Sets the repaint flag and resets it after 0.5 secs. /// </summary> public void EnableRepaint() { if (Context != null) { CoroutineUtil.Start(Context, m_StopRepaintCoroutine); m_Repaint = true; } }
public void Win(Action onFinish) { _onPlotFinish = () => { if (onFinish != null) { onFinish(); } }; _plotRoutine = PlotRoutine(ERole.None, UIManager._Instance.SetPlotInfo_Win, GameData._Instance._plot_Win); CoroutineUtil.Start(_plotRoutine); }
public void GrandDaughterDie(Action onFinish) { _onPlotFinish = () => { if (onFinish != null) { onFinish(); } }; _plotRoutine = PlotRoutine(ERole.Grandpa, UIManager._Instance.SetTipInfo, GameData._Instance._plot_GrandDaughterDie); CoroutineUtil.Start(_plotRoutine); }
public void Init(Pos pos, Transform transform) { _transform = transform; _anim = _transform.GetComponentInChildren <Animator>(); SetPos(pos); if (_updateRoutine != null) { CoroutineUtil.Stop(_updateRoutine); _updateRoutine = null; } _updateRoutine = UpdateRoutine(); CoroutineUtil.Start(_updateRoutine); }
public void Battle(Action onFinish) { _onPlotFinish = () => { if (onFinish != null) { onFinish(); } UIManager._Instance.SetMaskEnable(true); UIManager._Instance.SetSysMsgInfo(string.Format(SystemMessage._removePlayer, GameData._Instance._roleLib.GetRole(ERole.GrandDaughter)._name)); PlotManager.status = EPlotStatus.Battle; }; _plotRoutine = PlotRoutine(ERole.Grandpa, UIManager._Instance.SetTipInfo, GameData._Instance._plot_Battle); CoroutineUtil.Start(_plotRoutine); }
public override void Init(ERole roleIdent, Pos pos, Sprite[] moveSprites) { IDie die = new NormalDie(); die.onDie = () => { Player._Instance.isLockMove = true; PlotManager.instance.Die_DarkPrince(() => { GameData._isLockDoor = false; if (GameData._isGrandDaughterInQueue) { GameData._CanRotateCamera = false; UIManager._Instance.SetMaskEnable(false); } PlotManager.instance.BattleAfter(() => { // 此处有问题,应该是在上面显示,但是由于这个栈里面下面有一句也是弹出SystemMessage,因此把这个顶掉了 _getKeyRoutine = GetKeyRoutine(GameData._isGrandDaughterInQueue ? (HUDView._maxSysMsgTime * 2) : (HUDView._maxSysMsgTime)); CoroutineUtil.Start(_getKeyRoutine); Player._Instance.isLockMove = false; // 从NPC表中移除NPC Singleton._npcManager.RemoveNPC(ERole.DarkPrince); }); }); }; _iHP.Init(die, transform, 5); var move = (AIMove)_iMove; move.onMove = (Pos dirPos) => { // 黑王子移动的时候也要提示 if (!GameData._isGrandDaughterInQueue && !GameData._isGrandDaughterRebel) { MoveUtil.ShowDangerTip(Player._Instance.GetPos()); } }; move.onAllure = () => { Allure(Singleton._npcManager.GetNPC <GrandDaughter>(ERole.GrandDaughter)); }; _iMove.Init(pos, transform); move._followTarget = Player._Instance.transform; base.Init(roleIdent, pos, moveSprites); }
public void Allure(Action onFinish, int index) { var allures = GameData._Instance._plot_Allures; if (allures.Length <= index) { return; } _onPlotFinish = () => { if (onFinish != null) { onFinish(); } }; _plotRoutine = PlotRoutine(ERole.Grandpa, UIManager._Instance.SetTipInfo, allures[index]); CoroutineUtil.Start(_plotRoutine); }
public void _Start(Action onFinish) { UIManager._Instance.SetMaskEnable(true); _onPlotFinish = () => { PlotManager.status = EPlotStatus.Start; if (onFinish != null) { onFinish(); } // UIManager._Instance.SetMaskEnable(false); }; _plotRoutine = PlotRoutine(ERole.None, UIManager._Instance.SetPlotInfo, GameData._Instance._plot_Start); CoroutineUtil.Start(_plotRoutine); #if TEST // _onPlotFinish(); #endif }
public void Meet(ERole roleIdent, Action onFinish) { _onPlotFinish = () => { if (onFinish != null) { onFinish(); } UIManager._Instance.SetSysMsgInfo(SystemMessage._openLightMode); _addPlayerRoutine = AddPlayerRoutine(roleIdent); StartCoroutine(_addPlayerRoutine); Player._Instance.transform.eulerAngles = Vector3.zero; GameData._CanRotateCamera = false; UIManager._Instance.SetMaskEnable(false); PlotManager.status = EPlotStatus.Meet; }; _plotRoutine = PlotRoutine(ERole.Grandpa, UIManager._Instance.SetTipInfo, GameData._Instance._plot_Meet); CoroutineUtil.Start(_plotRoutine); }
public void _Start(Action onFinish) { UIManager._Instance.SetMaskEnable(true); _onPlotFinish = () => { if (onFinish != null) { onFinish(); } PlotManager.status = EPlotStatus.Start; UIManager._Instance._tipText.fontSize = 30; UIManager._Instance.ClearTip(); UIManager._Instance.SetMaskEnable(false); }; UIManager._Instance._tipText.fontSize = 40; _plotRoutine = PlotRoutine(ERole.None, UIManager._Instance.SetTipInfo, GameData._Instance._plot_Start); CoroutineUtil.Start(_plotRoutine); // for test //_onPlotFinish(); }
public void Meet(ERole roleIdent, Action onFinish) { _onPlotFinish = () => { if (onFinish != null) { onFinish(); } UIManager._Instance.SetSysMsgInfo(SystemMessage._openLightMode); _addPlayerRoutine = AddPlayerRoutine(roleIdent, HUDView._maxSysMsgTime / 2); StartCoroutine(_addPlayerRoutine); Player._Instance.transform.eulerAngles = Vector3.zero; GameData._CanRotateCamera = false; UIManager._Instance.SetMaskEnable(false); PlotManager.status = EPlotStatus.Meet; // 对话结束,销毁地图上的NPC var pos = MapManager.GetPos(MapCode.NPC_GRAND_DAUGHTER); MapManager.ResetMap(MapManager.CurIndex(pos._x, pos._y)); }; _plotRoutine = PlotRoutine(ERole.Grandpa, UIManager._Instance.SetTipInfo, GameData._Instance._plot_Meet); CoroutineUtil.Start(_plotRoutine); }
// public virtual void PauseAnimationUpdate(float duration) { CoroutineUtil.Start(PauseAnimationUpdateCo(duration)); }