public static async Task <bool> InitDataSync(this PlayerDbComponent self)
        {
            RoleDbInfo dbInfo = await Game.Scene.GetComponent <SqlComponent>().GetUserDbInfo(self.AccountId);

            var unit = self.GetParent <Model.Fishs.Entitys.Unit>();

            if (unit != null)
            {
                unit.AddComponent <AttributeComponent, RoleDbInfo>(dbInfo);
            }
            else
            {
                Log.Error("InitDataAsync Parent 不存在");
                return(false);
            }
            self.UpdateFrameAsync();
            return(true);
        }
        public static async void UpdateFrameAsync(this PlayerDbComponent self)
        {
            TimerComponent timerComponent = Game.Scene.GetComponent <TimerComponent>();

            long instanceId = self.InstanceId;

            while (true)
            {
                await timerComponent.WaitAsync(10000);

                if (self.InstanceId != instanceId)
                {
                    return;
                }
                //Log.Debug("保存");
                RoleDbInfo roledb = new RoleDbInfo();
                self.GetParent <Model.Fishs.Entitys.Unit>().GetComponent <AttributeComponent>().GetRoleDbInfo(roledb);
                //

                await Game.Scene.GetComponent <SqlComponent>().SaveUserDbInfo(self.AccountId, roledb);
            }
        }
 public static void Awake(this PlayerDbComponent self, int a)
 {
     //初始化数据
     self.AccountId = a;
 }