Exemplo n.º 1
0
        public DbUserLogin CreateUser(VkontakteId vkontakteId)
        {
            DbUserLogin databaseUser = new DbUserLogin {
                creationTime  = CommonUtils.SecondsFrom1970(),
                email         = string.Empty,
                gameRef       = Guid.NewGuid().ToString(),
                login         = vkontakteId.value,
                password      = vkontakteId.value,
                facebookId    = string.Empty,
                vkontakteId   = vkontakteId.value,
                nebulaCredits = 0,
                steamId       = string.Empty,
                deviceId      = string.Empty
            };
            var result = UserLogins.Save(databaseUser);

            return(databaseUser);
        }
Exemplo n.º 2
0
        public DbUserLogin CreateUser(LoginAuth auth, Email email, FacebookId fbId, VkontakteId vkId)
        {
            DbUserLogin dbUser = new DbUserLogin {
                creationTime  = CommonUtils.SecondsFrom1970(),
                email         = email.value,
                gameRef       = Guid.NewGuid().ToString(),
                login         = auth.login,
                password      = auth.password,
                facebookId    = fbId.value,
                vkontakteId   = vkId.value,
                nebulaCredits = NEBULA_CREDITS_AT_START,
                steamId       = string.Empty,
                deviceId      = string.Empty
            };

            var result = UserLogins.Save(dbUser);

            return(dbUser);
        }
Exemplo n.º 3
0
        public object AddNebulaCredits(string login, string gameRefId, string characterId, int nebulaCredits)
        {
            logger.Info($"{LOG_TAG} => AddNebulaCredits({login}, {gameRefId}, {characterId}, {nebulaCredits})");
            GameRefId   gameRef = new GameRefId(gameRefId);
            DbUserLogin user    = application.GetUser(gameRef);

            if (user == null)
            {
                return((int)ReturnCode.Fatal);
            }
            user.nebulaCredits += nebulaCredits;
            if (user.nebulaCredits < 0)
            {
                user.nebulaCredits = 0;
            }
            application.SaveUser(user);
            application.LogedInUsers.SendEvent(gameRef, new Photon.SocketServer.EventData((byte)LoginEventCode.NebulaCreditsUpdate, new NebulaCreditsUpdateEvent {
                nebulaCredits = user.nebulaCredits
            }));
            return((int)ReturnCode.Ok);
        }
Exemplo n.º 4
0
 public void SaveUser(DbUserLogin user)
 {
     UserLogins.Save(user);
 }