コード例 #1
0
        protected override async void Run(ETModel.Session session, Actor_GamerReady message)
        {
            try
            {
                Log.Info($"收到准备");
                UI uiRoom = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIRoom);
                UIReadyComponent uiReadyComponent = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIReady)?.GetComponent <UIReadyComponent>();

                if (uiRoom == null)
                {
                    return;
                }

                GamerComponent gamerComponent = uiRoom.GetComponent <GamerComponent>();

                Gamer gamer = gamerComponent.Get(message.Uid);
                if (gamer == null)
                {
                    Log.Warning($"{message.Uid}玩家为空");
                    return;
                }
                GamerUIComponent gamerUiComponent = gamer.GetComponent <GamerUIComponent>();
                gamerUiComponent.SetReady();
                uiReadyComponent?.SetReady(message.Uid);

                SoundsHelp.Instance.playSound_ZhunBei();
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }