public async ETTask Run(GalGameEngineComponent self, GalGameEnginePara para) { if (string.IsNullOrEmpty(para.Arg1)) //全下场 { self.StageRoleMap.Clear(); self.RoleExpressionMap.Clear(); await UIManagerComponent.Instance.CloseWindow <UIStageView>(); await UIManagerComponent.Instance.CloseWindow <UIMessageWindow>(); } else //下场指定角色 { if (self.RoleExpressionMap.ContainsKey(para.Arg1)) { self.RoleExpressionMap.Remove(para.Arg1); } var keys = self.StageRoleMap.Keys.ToList(); for (int i = 0; i < keys.Count; i++) { if (self.StageRoleMap[keys[i]] == para.Arg1) { self.StageRoleMap.Remove(keys[i]); break; } } await UIManagerComponent.Instance.OpenWindow <UIStageView, GalGameEngineComponent, GalGameEnginePara>( UIStageView.PrefabPath, self, para); await UIManagerComponent.Instance.CloseWindow <UIMessageWindow>(); } await CommandWatcherComponent.Instance.Run("Wait", self, para); }
public async ETTask Run(GalGameEngineComponent self, GalGameEnginePara para) { if (!string.IsNullOrEmpty(para.Voice)) { SoundComponent.Instance.PlayMusic(para.Voice); } await CommandWatcherComponent.Instance.Run("Wait", self, para); }
public async ETTask Run(GalGameEngineComponent self, GalGameEnginePara para) { await UIManagerComponent.Instance.CloseWindow <UIMessageWindow>(); await UIManagerComponent.Instance.CloseWindow <UIBaseMessageWindow>(); await CommandWatcherComponent.Instance.Run("Wait", self, para); }
public async ETTask Run(GalGameEngineComponent self, GalGameEnginePara para) { if (!float.TryParse(para.Arg6, out var wait_time)) { wait_time = 1; } if (self.State != GalGameEngineComponent.GalGameEngineState.FastForward) { UIManagerComponent.Instance.OpenWindow <UIMaskView, string, float, bool>(UIMaskView.PrefabPath, para.Arg1, wait_time, false, UILayerNames.TopLayer).Coroutine(); } await CommandWatcherComponent.Instance.Run("Wait", self, para); }
public async ETTask Run(GalGameEngineComponent self, GalGameEnginePara para) { if (!string.IsNullOrEmpty(para.Arg1)) { if (self.RoleExpressionMap.ContainsKey(para.Arg1)) //在场上 { if (!string.IsNullOrEmpty(para.Arg3)) { self.StageRoleMap[para.Arg3] = para.Arg1; } if (!string.IsNullOrEmpty(para.Arg2)) { self.RoleExpressionMap[para.Arg1] = para.Arg2; } } else { if (string.IsNullOrEmpty(para.Arg3)) { para.Arg3 = "default"; } if (string.IsNullOrEmpty(para.Arg2)) { para.Arg2 = "default"; } self.StageRoleMap[para.Arg3] = para.Arg1; self.RoleExpressionMap[para.Arg1] = para.Arg2; } await UIManagerComponent.Instance.OpenWindow <UIStageView, GalGameEngineComponent>( UIStageView.PrefabPath, self); UIManagerComponent.Instance.MoveWindowToTop <UIMessageWindow>(); } if (float.TryParse(para.Arg6, out var wait_time)) { await self.ShowMessage(para.Text, para.Arg1, para.WindowType, para.PageCtrl, para.Voice, (long)(wait_time * 1000)); } else { await self.ShowMessage(para.Text, para.Arg1, para.WindowType, para.PageCtrl, para.Voice); } await CommandWatcherComponent.Instance.Run("Wait", self, para); }
public async ETTask Run(GalGameEngineComponent self, GalGameEnginePara para) { if (!string.IsNullOrEmpty(para.Arg6)) { if (float.TryParse(para.Arg6, out float wait_time)) { if (self.Speed > 0) { if (GalGameEngineComponent.Instance.CancelToken == null) { GalGameEngineComponent.Instance.CancelToken = new ETCancellationToken(); } await TimerComponent.Instance.WaitAsync((long)(wait_time * 1000 / self.Speed), self.CancelToken); } } } }
public async ETTask Run(GalGameEngineComponent self, GalGameEnginePara para) { if (!string.IsNullOrEmpty(para.Arg1)) { if (self.RoleExpressionMap.ContainsKey(para.Arg1)) //在场上 { if (!string.IsNullOrEmpty(para.Arg3)) { self.StageRoleMap[para.Arg3] = para.Arg1; } if (!string.IsNullOrEmpty(para.Arg2)) { self.RoleExpressionMap[para.Arg1] = para.Arg2; } } else { if (string.IsNullOrEmpty(para.Arg3)) { para.Arg3 = "default"; } if (string.IsNullOrEmpty(para.Arg2)) { para.Arg2 = "default"; } self.StageRoleMap[para.Arg3] = para.Arg1; self.RoleExpressionMap[para.Arg1] = para.Arg2; } await UIManagerComponent.Instance .OpenWindow <UIStageView, GalGameEngineComponent, GalGameEnginePara>( UIStageView.PrefabPath, self, para); UIManagerComponent.Instance.MoveWindowToTop <UIMessageWindow>(); } await CommandWatcherComponent.Instance.Run("Wait", self, para); }
public static async ETTask RunNextCommand(this GalGameEngineRunningState self) { if (!self.ChapterCategory.TryGet(self.Engine.Index, out var command)) { self.Engine.PlayOver().Coroutine(); return; } GalGameEnginePara para = new GalGameEnginePara(); para.Command = command.Command; //参数赋值 para.Arg1 = command.Arg1; para.Arg2 = command.Arg2; para.Arg3 = command.Arg3; para.Arg4 = command.Arg4; para.Arg5 = command.Arg5; para.Arg6 = command.Arg6; //多语言处理 if (I18NComponent.Instance.curLangType == I18NComponent.LangType.Chinese) { para.Text = command.Chinese; } else if (I18NComponent.Instance.curLangType == I18NComponent.LangType.English) { para.Text = command.English; } else { para.Text = command.Chinese; } para.PageCtrl = command.PageCtrl; para.WindowType = command.WindowType; para.Voice = command.Voice; await CommandWatcherComponent.Instance.Run(command.Command, self.Engine, para); self.Engine.Index++; }
public static async ETTask Refresh(this UIStageView self, GalGameEnginePara chapter = default) { foreach (var item in self.infos) //先全部隐藏 { item.Value.active = false; } var keys = self.Engine.StageRoleMap.Keys.ToList(); for (int i = 0; i < keys.Count; i++) { var key = keys[i]; if (!self.Engine.StageRoleMap.TryGetValue(key, out var value)) { continue; } var Expression = self.Engine.RoleExpressionMap[value]; //todo: 角色上场 if (self.Engine.RoleExpressionPathMap.TryGetValue(value, out var ExpressionPath)) { if (!ExpressionPath.TryGetValue(Expression, out var path)) { foreach (var exp in ExpressionPath) { Log.Debug("ExpressionPath not found:" + value + Expression + ", use " + exp.Value + " replace"); path = exp.Value; break; } } if (!string.IsNullOrEmpty(path)) { if (!self.infos.TryGetValue(key, out var info)) { info = await GameObjectPoolComponent.Instance.GetUIGameObjectAsync <UIStageRoleInfo>("UIGames/UIGalGame/Prefabs/Character.prefab"); if (self.infos.ContainsKey(key)) //异步加载回来已经有了 { GameObjectPoolComponent.Instance?.RecycleUIGameObject(info); info = self.infos[key]; } else { var pos = self.Engine.StagePosMap[key]; info.GetTransform().parent = self.GetTransform(); info.GetTransform().localPosition = pos; info.GetTransform().localScale = new Vector3(1, 1, 1); self.infos[key] = info; } info.active = true; } else { info.active = true; if (info.path == path) { continue; //没变化直接跳过 } } info.image.SetSpritePath(path).Coroutine(); info.path = path; if (string.Equals(chapter.Command, "CharacterOn", StringComparison.OrdinalIgnoreCase)) //入场 { string newUser = chapter.Arg1; if (string.Equals(newUser, value, StringComparison.OrdinalIgnoreCase)) { string type = chapter.Arg5; if (string.Equals(type, "FadeIn", StringComparison.OrdinalIgnoreCase)) { info.image.SetImageColor(Color.clear); float time = float.Parse(chapter.Arg6); DOTween.To(() => info.image.GetImageColor(), x => info.image.SetImageColor(x), Color.white, time); } } } else if (string.Equals(chapter.Command, "CharacterOff", StringComparison.OrdinalIgnoreCase)) //入场 { string newUser = chapter.Arg1; if (string.Equals(newUser, value, StringComparison.OrdinalIgnoreCase)) { string type = chapter.Arg5; if (string.Equals(type, "FadeOut", StringComparison.OrdinalIgnoreCase)) { info.image.SetImageColor(Color.white); float time = float.Parse(chapter.Arg6); DOTween.To(() => info.image.GetImageColor(), x => info.image.SetImageColor(x), Color.clear, time); } } } } else { Log.Debug("path is null:" + value + Expression); } } else { Log.Debug("RoleExpressionPathMap not found:" + value); } } foreach (var item in self.infos) //修改显隐状态 { item.Value.SetActive(item.Value.active); } }
public async ETTask Run(GalGameEngineComponent self, GalGameEnginePara para) { SoundComponent.Instance.StopMusic(); await CommandWatcherComponent.Instance.Run("Wait", self, para); }
public async ETTask Run(GalGameEngineComponent self, GalGameEnginePara para) { await UIManagerComponent.Instance.OpenWindow <UIBgView, string>(UIBgView.PrefabPath, para.Arg1); await CommandWatcherComponent.Instance.Run("Wait", self, para); }
public async ETTask Run(GalGameEngineComponent self, GalGameEnginePara para) { self.PlayOver().Coroutine(); await ETTask.CompletedTask; //todo: 结束情景 }
public static async ETTask Run(this CommandWatcherComponent self, string command, GalGameEngineComponent engine, GalGameEnginePara para) { List <ICommandWatcher> list; if (!self.allWatchers.TryGetValue(command, out list)) { return; } for (int i = 0; i < list.Count; i++) { ICommandWatcher watcher = list[i]; await watcher.Run(engine, para); } }