コード例 #1
0
        public async void ClearIncome()
        {
            IsClear = false; day = DateTime.Now.Day;

            userInfoList.Clear();

            if (DBHelper <UserInfo> .QureySingleTableAllData("UserInfo", userInfoList))
            {
                List <ComponentWithId> userList = new List <ComponentWithId>();

                userInfoList.ForEach(u => { u.Scroe = 0; userList.Add(u); });

                await DBSaveHelper.SaveBatch(dbProxy, userList);
            }
        }
コード例 #2
0
        private async void InsertGameData()
        {
            try
            {
                List <ComponentWithId> gameInfoList = new List <ComponentWithId>();

                ETModel.GameInfo DouDiZhukWar = ComponentFactory.CreateWithId <ETModel.GameInfo>(IdGenerater.GenerateId());
                DouDiZhukWar.GameId   = 1;
                DouDiZhukWar.GameName = "斗地主";
                gameInfoList.Add(DouDiZhukWar);

                await DBSaveHelper.SaveBatch(dbProxy, gameInfoList);

                DBHelper <GameInfo> .QureySingleTableAllData("GameInfo", gameList);
            }
            catch (System.Exception e)
            {
                Log.Debug($"插入游戏列表失败 信息 {e}!!!");
            }
        }
コード例 #3
0
        private async void InsertAreaData()
        {
            List <ComponentWithId> areaInfoList = new List <ComponentWithId>();

            try
            {
                AreaInfo DDZArea = ComponentFactory.Create <AreaInfo, int>(101);
                DDZArea.GameId = 1; DDZArea.AreaId = 101; DDZArea.AreaType = "初级场"; DDZArea.Score = 1;
                areaInfoList.Add(DDZArea);

                DBProxyComponent dbProxy = Game.Scene.GetComponent <DBProxyComponent>();

                await DBSaveHelper.SaveBatch(dbProxy, areaInfoList);

                Log.Debug("向数据库插入场数据成功  !!!");

                DBHelper <AreaInfo> .QureySingleTableAllData("AreaInfo", areaList);
            }
            catch (System.Exception e)
            {
                Log.Debug($"插入游戏列表失败 信息 {e}!!!");
            }
        }
コード例 #4
0
        public async void TimingStorage()
        {
            while (true)
            {
                userList.Clear();

                await Game.Scene.GetComponent <TimerComponent>().WaitAsync(20000);

                if (Game.Scene.GetComponent <PlayerManagerComponent>().GetAllUser().Count > 0)
                {
                    var playerList = Game.Scene.GetComponent <PlayerManagerComponent>().GetAllUser();

                    if (playerList == null)
                    {
                        return;
                    }

                    playerList.ForEach(d => userList.Add(d));

                    await DBSaveHelper.SaveBatch(dbProxy, userList);
                }
            }
        }
コード例 #5
0
        private async void InsertAreaData()
        {
            List <ComponentWithId> roomInfoList = new List <ComponentWithId>();

            try
            {
                int      DouDiZhuRoomId = RandomHelper.RandInt32();
                RoomInfo DouDiZhuRoom   = ComponentFactory.Create <RoomInfo, int>(DouDiZhuRoomId);
                DouDiZhuRoom.GameId   = 1; DouDiZhuRoom.AreaId = 101; DouDiZhuRoom.RoomId = DouDiZhuRoomId; DouDiZhuRoom.DiFen = 1;
                DouDiZhuRoom.MaxCount = 3;
                roomInfoList.Add(DouDiZhuRoom);

                DBProxyComponent dbProxy = Game.Scene.GetComponent <DBProxyComponent>();

                await DBSaveHelper.SaveBatch(dbProxy, roomInfoList);

                Log.Debug("向数据库插入 房间数据成功  !!!");
                DBHelper <RoomInfo> .QureySingleTableAllData("RoomInfo", roomList);
            }
            catch (Exception e)
            {
                Log.Debug($"插入游戏列表失败 信息 {e}!!!");
            }
        }