Ejemplo n.º 1
0
 /// <summary>创建玩家</summary>
 public static bool GetCreatePlayer(ref tg_user model)
 {
     try
     {
         model.Insert();
         return(true);
     }
     catch { return(false); }
 }
Ejemplo n.º 2
0
 public static bool GetUserUpdate(tg_user model)
 {
     try
     {
         model.Update();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
        /// <summary>记录session</summary>
        private bool RecordSeesion(TGGSession session, tg_user user, Int32 isAdult)
        {
            var player = Common.GetInstance().GetPlayer(user, isAdult);

            if (player == null)
            {
                return(false);
            }
            session.Player = player;
            tg_user_login_log.LoginLog(user.id, Common.GetInstance().GetRemoteIP(session));
            Variable.OnlinePlayer.AddOrUpdate(session.Player.User.id, session, (k, v) => session);
            return(true);
        }
Ejemplo n.º 4
0
 public Player()
 {
     User = new tg_user();
     //Role = new view_role();
     Role   = new RoleItem();
     Scene  = new view_scene_user();
     Order  = new BusinessOrder();
     Bag    = new BagItem();
     Family = new tg_family_member();
     // PrisonPoint = new Prison_point();
     BlackList    = new List <long>();
     Position     = new Ninjutsu_position();
     moduleIds    = new List <int>();
     BusinessArea = new List <tg_user_area>();
     DamingLog    = new List <tg_daming_log>();
     Game         = new GameItem();
 }
Ejemplo n.º 5
0
 /// <summary>初始化玩家</summary>
 /// <param name="user_code">玩家关联账号</param>
 /// <param name="role_id">武将基表id</param>
 /// <param name="sex">性别</param>
 /// <param name="player_name">玩家名称</param>
 /// <param name="birthplace">出生地</param>
 /// <param name="player_vocation">职业</param>
 /// <param name="player_influence">势力</param>
 /// <param name="player_camp">阵营</param>
 /// <param name="scene_id">场景基表id</param>
 /// <param name="x">X坐标</param>
 /// <param name="y">Y坐标</param>
 public static tg_user InitUser(string user_code, int role_id, int sex, string player_name, int birthplace, int player_vocation, int player_influence, int player_camp, Int64 scene_id, int x, int y, int gold)
 {
     try
     {
         using (var trans = Meta.CreateTrans())
         {
             var check = FindCount(_.user_code, user_code);
             if (check > 0)
             {
                 trans.Commit(); return(null);
             }
             var user = new tg_user
             {
                 user_code        = user_code,
                 role_id          = role_id,
                 player_sex       = sex,
                 player_name      = player_name,
                 birthplace       = birthplace,
                 player_vocation  = player_vocation,
                 player_influence = player_influence,
                 player_camp      = player_camp,
                 createtime       = DateTime.Now.Ticks,
                 //内测
                 gold = gold,
             };
             user.Save();
             var role       = tg_role.InitRole(user.id, user.player_vocation, user.role_id);
             var life_skill = tg_role_life_skill.InitSkill(role.id);
             var scene      = tg_scene.InitScene(scene_id, user.id, x, y);
             var car        = tg_car.InitCar(user.id);
             var task       = tg_task.InitTask(user.id, role.role_identity, user.player_vocation);
             //if (life_skill == null || scene == null || car || task == null) return null;
             trans.Commit();
             return(user);
         }
     }
     catch { return(null); }
 }
Ejemplo n.º 6
0
 /// <summary>记录session</summary>
 private void RecordSeesion(TGGSession session, tg_user user)
 {
     session.Player = Common.GetInstance().GetPlayer(user);
     tg_user_login_log.LoginLog(user.id, Common.GetInstance().GetRemoteIP(session));
     Variable.OnlinePlayer.AddOrUpdate(session.Player.User.id, session, (k, v) => session);
 }
Ejemplo n.º 7
0
 /// <summary>向用户推送更新</summary>
 public void RewardsToUser(TGGSession session, tg_user user, int type)
 {
     session.Player.User = user;
     (new Share.User()).REWARDS_API(type, session.Player.User);
 }