Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 加载配置表
        /// </summary>
        /// <param name="self"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static ChapterCategory GetChapterByName(this GalGameEngineComponent self, string name)
        {
            ChapterCategory res = ConfigComponent.Instance.LoadOneConfig <ChapterCategory>("Config/" + name + "Category.bytes");

            if (res == null)
            {
                Log.Error("加载配置表 " + name + "失败");
            }

            return(res);
        }
Exemplo n.º 5
0
 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);
 }
Exemplo n.º 6
0
 /// <summary>
 /// 切换快进状态
 /// </summary>
 /// <param name="self"></param>
 /// <returns></returns>
 public static async ETTask <bool> ChangePlayFastModel(this GalGameEngineComponent self)
 {
     if (self.State == GalGameEngineComponent.GalGameEngineState.FastForward)
     {
         await self.FSM.ChangeState <GalGameEngineRunningState>();
     }
     else if (self.State == GalGameEngineComponent.GalGameEngineState.Running)
     {
         await self.FSM.ChangeState <GalGameEngineFastForwardState>();
     }
     else
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 打开对话框
        /// </summary>
        /// <param name="self"></param>
        /// <param name="text"></param>
        /// <param name="name"></param>
        /// <param name="windowType"></param>
        /// <param name="pageCtrl"></param>
        /// <param name="voice"></param>
        /// <returns></returns>
        public static async ETTask ShowMessage(this GalGameEngineComponent self, string text, string name, string windowType, string pageCtrl, string voice, long waitTime = 1000)
        {
            if (string.IsNullOrEmpty(windowType))
            {
                windowType = "MessageWindow";
            }
            if (string.IsNullOrEmpty(pageCtrl))
            {
                pageCtrl = "Page";
            }
            bool refresh = pageCtrl.IndexOf("page", StringComparison.OrdinalIgnoreCase) >= 0;

            if (pageCtrl.IndexOf("br", StringComparison.OrdinalIgnoreCase) >= 0)
            {
                text += "\n";
            }
            await UIManagerComponent.Instance.CloseWindow <UIMessageWindow>();

            await UIManagerComponent.Instance.CloseWindow <UIBaseMessageWindow>();

            if (windowType.Equals("messagewindow", StringComparison.OrdinalIgnoreCase))
            {
                UIMessageWindow win = await UIManagerComponent.Instance.OpenWindow <UIMessageWindow, float, long>(UIMessageWindow.PrefabPath, self.Speed, waitTime);

                self.AppendReviewItem(name, text, !refresh);
                win.SetName(name);
                await win.SetContent(text, clear : refresh);
            }
            else if (windowType.Equals("messagewindowfull", StringComparison.OrdinalIgnoreCase))
            {
                var win = await UIManagerComponent.Instance.OpenWindow <UIBaseMessageWindow, float, long>(UIBaseMessageWindow.UIMessageWindowFull, self.Speed, waitTime);

                await win.SetContent(text, clear : refresh);
            }
            else if (windowType.Equals("messagewindowmiddle", StringComparison.OrdinalIgnoreCase))
            {
                var win = await UIManagerComponent.Instance.OpenWindow <UIBaseMessageWindow, float, long>(UIBaseMessageWindow.UIMessageWindowMiddle, self.Speed, waitTime);

                await win.SetContent(text, clear : refresh);
            }
            else
            {
                return;
            }
        }
Exemplo n.º 9
0
 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);
             }
         }
     }
 }
Exemplo n.º 10
0
 public static void AppendReviewItem(this GalGameEngineComponent self, string name, string content, bool isContinue = false)
 {
     if (string.IsNullOrEmpty(content))
     {
         return;
     }
     if (self.ReviewItems.Count <= 0 || !self.ReviewItems[self.ReviewItems.Count - 1].Continue)
     {
         self.ReviewItems.Add(new GalGameEngineComponent.ReviewItem
         {
             Name     = name,
             Content  = content,
             Continue = isContinue,
         });
     }
     else
     {
         self.ReviewItems[self.ReviewItems.Count - 1].Content += "," + content;
         self.ReviewItems[self.ReviewItems.Count - 1].Continue = isContinue;
     }
 }
Exemplo n.º 11
0
            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);
            }
Exemplo n.º 12
0
        /// <summary>
        /// 开始播放一段剧情
        /// </summary>
        /// <param name="self"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static async ETTask <bool> PlayChapterByName(this GalGameEngineComponent self, string name, Action <bool> onPlayOver = null)
        {
            if (self.State != GalGameEngineComponent.GalGameEngineState.Ready)
            {
                return(false);
            }
            ChapterCategory category = GetChapterByName(self, name);

            if (category == null)
            {
                return(false);
            }
            self.CurCategory = category;
            self.CurCategory.Order();
            self.StageRoleMap.Clear();
            self.RoleExpressionMap.Clear();
            self.Index      = 0;
            self.OnPlayOver = onPlayOver;
            UIManagerComponent.Instance.OpenWindow <UIGalGameHelper>(UIGalGameHelper.PrefabPath).Coroutine();
            await self.FSM.ChangeState <GalGameEngineRunningState>();

            return(true);
        }
Exemplo n.º 13
0
        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);
            }
        }
Exemplo n.º 14
0
 public async ETTask Run(GalGameEngineComponent self, GalGameEnginePara para)
 {
     SoundComponent.Instance.StopMusic();
     await CommandWatcherComponent.Instance.Run("Wait", self, para);
 }
Exemplo n.º 15
0
 /// <summary>
 /// 播放结束
 /// </summary>
 /// <param name="self"></param>
 /// <returns></returns>
 public static async ETTask PlayOver(this GalGameEngineComponent self)
 {
     Log.Debug("PlayOver");
     await self.FSM.ChangeState <GalGameEngineReadyState, bool>(true);
 }
Exemplo n.º 16
0
        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);
        }
Exemplo n.º 17
0
 public async ETTask Run(GalGameEngineComponent self, GalGameEnginePara para)
 {
     self.PlayOver().Coroutine();
     await ETTask.CompletedTask;
     //todo: 结束情景
 }