public IPlayerStamina GetStamina(string playerId, string dataId) { IPlayerStamina stamina = null; if (!IPlayerStamina.DataMap.ContainsKey(IPlayerStamina.GetId(playerId, dataId))) { stamina = new IPlayerStamina(); stamina.Guid = IPlayerStamina.GetId(playerId, dataId); stamina.playerId = playerId; stamina.Guid = IPlayerStamina.GetId(playerId, dataId); stamina.dataId = dataId; IPlayerStamina.DataMap.Add(IPlayerStamina.GetId(playerId, dataId), stamina); return(stamina); //GameInstance.dbDataUtils.ExecuteNonQuery(@"INSERT INTO playerStamina (id, playerId, Guid, amount, recoveredTime) VALUES (@id, @playerId, @Guid, @amount, @recoveredTime)", // new SqliteParameter("@id", stamina.Id), // new SqliteParameter("@playerId", stamina.PlayerId), // new SqliteParameter("@Guid", stamina.DataId), // new SqliteParameter("@amount", stamina.Amount), // new SqliteParameter("@recoveredTime", stamina.RecoveredTime)); } else { return(IPlayerStamina.DataMap[PlayerStamina.GetId(playerId, dataId)]); } //var staminas = GameInstance.dbDataUtils.ExecuteReader(@"SELECT * FROM playerStamina WHERE playerId=@playerId AND Guid=@Guid LIMIT 1", // new SqliteParameter("@playerId", playerId), // new SqliteParameter("@Guid", dataId)); //if (!staminas.Read()) //{ // stamina = new PlayerStamina(); // stamina.Id = PlayerStamina.GetId(playerId, dataId); // stamina.PlayerId = playerId; // stamina.DataId = dataId; // GameInstance.dbDataUtils.ExecuteNonQuery(@"INSERT INTO playerStamina (id, playerId, Guid, amount, recoveredTime) VALUES (@id, @playerId, @Guid, @amount, @recoveredTime)", // new SqliteParameter("@id", stamina.Id), // new SqliteParameter("@playerId", stamina.PlayerId), // new SqliteParameter("@Guid", stamina.DataId), // new SqliteParameter("@amount", stamina.Amount), // new SqliteParameter("@recoveredTime", stamina.RecoveredTime)); //} //else //{ // stamina = new PlayerStamina(); // stamina.Id = staminas.GetString(0); // stamina.PlayerId = staminas.GetString(1); // stamina.DataId = staminas.GetString(2); // stamina.Amount = staminas.GetInt32(3); // stamina.RecoveredTime = staminas.GetInt64(4); //} //return stamina; }