Ejemplo n.º 1
0
 /// <summary>结果数据处理</summary>
 private bool ResultData(Int64 userid, int type, GameItem game)
 {
     if (type == (int)GameResultType.FAIL)
     {
         if (game.GameType == (int)GameType.ACTIONGAME)
         {
             if (!CheckDay(userid))
             {
                 return(false);                                   //处理使用次数  每日完成度
             }
             Common.GetInstance().ClearVariable(userid);
         }
         GAMES_PUSH.GetInstance().CommandStart(userid, (int)GameResultType.FAIL, game.Tea.tea_pass, (int)GameEnterType.花月茶道);//推送
         UpdateData(game);
     }
     else
     {
         if (game.GameType == (int)GameType.ACTIONGAME)   //闯关模式验证最高闯关次数
         {
             var b = Common.GetInstance().UpdateMax(userid, (int)GameEnterType.花月茶道, game.Tea.tea_pass);
             if (!b)
             {
                 return(false);
             }
         }
         game.Tea.tea_pass++;
         GAMES_PUSH.GetInstance().CommandStart(userid, (int)GameResultType.WIN, game.Tea.tea_pass, (int)GameEnterType.花月茶道);  //推送
     }
     return(true);
 }
Ejemplo n.º 2
0
 /// <summary>处理数据</summary>
 public ASObject ResultData(GameItem game, Int64 userid, List <Int32> nb)
 {
     if (nb[0] == nb[1] && nb[0] == nb[2])     //通关
     {
         if (game.GameType == (int)GameType.ACTIONGAME)
         {
             var b = Common.GetInstance().UpdateMax(userid, (int)GameEnterType.老虎机, game.Calculate.calculate_pass);
             if (!b)
             {
                 return(Result((int)ResultType.DATABASE_ERROR));
             }
         }
         game.Calculate.calculate_pass++;
         GAMES_PUSH.GetInstance().CommandStart(userid, (int)GameResultType.WIN, game.Calculate.calculate_pass, (int)GameEnterType.老虎机);//推送
     }
     else
     {
         if (game.GameType == (int)GameType.ACTIONGAME)
         {
             if (!CheckDay(userid))
             {
                 return(Result((int)ResultType.DATABASE_ERROR));
             }
             Common.GetInstance().ClearVariable(userid);
         }
         GAMES_PUSH.GetInstance().CommandStart(userid, (int)GameResultType.FAIL, game.Calculate.calculate_pass, (int)GameEnterType.老虎机);//推送
         game.Calculate.calculate_pass = 0;
     }
     return(Result((int)ResultType.SUCCESS));
 }
Ejemplo n.º 3
0
        /// <summary>分数未达到结束通关</summary>
        private ASObject UnPass(Int64 userid)
        {
            //验证玩家是否在线
            if (!Variable.OnlinePlayer.ContainsKey(userid))
            {
                return(Error((int)ResultType.BASE_PLAYER_OFFLINE_ERROR));
            }
            var session = Variable.OnlinePlayer[userid] as TGGSession;

            if (session == null)
            {
                return(Error((int)ResultType.BASE_PLAYER_OFFLINE_ERROR));
            }

            var game = session.Player.Game;

            if (game.GameType == (int)GameType.ACTIONGAME)
            {
                var extend = session.Player.UserExtend;
                extend.ball_count++;
                extend.Save();
                session.Player.UserExtend = extend;
                Common.GetInstance().PushReward(userid);
                Common.GetInstance().ClearVariable(userid);
            }

            //推送失败
            GAMES_PUSH.GetInstance().CommandStart(userid, (int)GameResultType.FAIL, game.Spirit.spirit_pass, (int)GameEnterType.猎魂);
            return(new ASObject(Common.GetInstance().BuilData((int)ResultType.SUCCESS, game.Spirit.spirit_pass)));
        }
Ejemplo n.º 4
0
        /// <summary>游艺园忍术游戏开始</summary>
        public ASObject CommandStart(TGGSession session, ASObject data)
        {
            try
            {
#if DEBUG
                XTrace.WriteLine("{0}:{1}", "GAMES_NINJUTSU_START", "游艺园忍术游戏开始");
#endif
                var pos     = Convert.ToInt32(data.FirstOrDefault(m => m.Key == "position").Value.ToString());
                var correct = session.Player.Position.position;   //色子的正确位置
                var player  = session.Player;
                var game    = player.Game;

                if (game.GameType == (int)GameType.ACTIONGAME)     //闯关模式
                {
                    //验证剩余次数
                    var b = Common.GetInstance().CheckCount((int)GameEnterType.猜宝游戏, player.UserExtend);
                    if (!b)
                    {
                        return(Result((int)ResultType.GAME_COUNT_FAIL));
                    }
                    Common.GetInstance().CreateVariable(session.Player.User.id, (int)GameEnterType.猜宝游戏);
                }

                if (pos == correct)                                //通关
                {
                    if (game.GameType == (int)GameType.ACTIONGAME) //闯关模式
                    {
                        var b = Common.GetInstance().UpdateMax(player.User.id, (int)GameEnterType.猜宝游戏, game.Ninjutsu.ninjutsu_pass);
                        if (!b)
                        {
                            return(Result((int)ResultType.DATABASE_ERROR));
                        }
                    }
                    game.Ninjutsu.ninjutsu_pass++;
                    GAMES_PUSH.GetInstance().CommandStart(player.User.id, (int)GameResultType.WIN, game.Ninjutsu.ninjutsu_pass, (int)GameEnterType.猜宝游戏);//推送
                }
                else
                {
                    if (game.GameType == (int)GameType.ACTIONGAME)
                    {
                        if (!CheckDay(session))
                        {
                            return(Result((int)ResultType.DATABASE_ERROR));
                        }
                        Common.GetInstance().ClearVariable(player.User.id);
                    }
                    GAMES_PUSH.GetInstance().CommandStart(player.User.id, (int)GameResultType.FAIL, game.Ninjutsu.ninjutsu_pass, (int)GameEnterType.猜宝游戏);//推送
                    game.Ninjutsu.ninjutsu_pass = 0;
                }
                return(Result((int)ResultType.SUCCESS));
            }
            catch (Exception ex)
            {
                XTrace.WriteException(ex);
                return(new ASObject());
            }
        }
Ejemplo n.º 5
0
        /// <summary>推送游戏结果</summary>
        private void CheckResult(GameItem game, Int64 userid)
        {
            if (game.Eloquence.user_blood == 0 || game.Eloquence.npc_blood == 0)
            {
                if (!Variable.OnlinePlayer.ContainsKey(userid))
                {
                    return;
                }
                var session = Variable.OnlinePlayer[userid] as TGGSession;
                if (session == null)
                {
                    return;
                }
                if (game.Eloquence.user_blood == 0)   //闯关失败
                {
                    if (game.GameType == (int)GameType.ACTIONGAME)
                    {
                        var userextend = session.Player.UserExtend.CloneEntity();
                        userextend.eloquence_count++;
                        userextend.Save();
                        session.Player.UserExtend = userextend;
                        Common.GetInstance().PushReward(userid); //每日完成次数
                        Common.GetInstance().ClearVariable(userid);
                    }
                    GAMES_PUSH.GetInstance().CommandStart(userid, (int)GameResultType.FAIL, game.Eloquence.eloquence_pass, (int)GameEnterType.辩驳游戏);
                    session.Player.Game.Eloquence.eloquence_pass = 0;
                }
                else
                {
                    //闯关成功
                    if (game.GameType == (int)GameType.ACTIONGAME)
                    {
                        Common.GetInstance().UpdateMax(userid, (int)GameEnterType.辩驳游戏, game.Eloquence.eloquence_pass);  //验证最高闯关次数
                    }
                    game.Eloquence.eloquence_pass += 1;
                    GAMES_PUSH.GetInstance().CommandStart(userid, (int)GameResultType.WIN, game.Eloquence.eloquence_pass, (int)GameEnterType.辩驳游戏);//推送胜利

                    var rule = Variable.BASE_RULE.FirstOrDefault(m => m.id == "30001");
                    if (rule == null)
                    {
                        return;
                    }

                    session.Player.Game.Eloquence.user_blood = Convert.ToInt32(rule.value);
                    session.Player.Game.Eloquence.npc_blood  = Convert.ToInt32(rule.value);
                    //session.Player.Game.Eloquence.eloquence_pass = game.Eloquence.eloquence_pass;
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>推送 Vo</summary>
        private void Push(Int64 userid, GameItem game, int gt)
        {
            switch (gt)
            {
            case (int)GameEnterType.辩驳游戏: GAMES_PUSH.GetInstance().CommandStart(userid, (int)GameResultType.FAIL, game.Eloquence.eloquence_pass, gt); break;

            case (int)GameEnterType.老虎机: GAMES_PUSH.GetInstance().CommandStart(userid, (int)GameResultType.FAIL, game.Calculate.calculate_pass, gt); break;

            case (int)GameEnterType.花月茶道: GAMES_PUSH.GetInstance().CommandStart(userid, (int)GameResultType.FAIL, game.Tea.tea_pass, gt); break;

            case (int)GameEnterType.猜宝游戏:; GAMES_PUSH.GetInstance().CommandStart(userid, (int)GameResultType.FAIL, game.Ninjutsu.ninjutsu_pass, gt); break;

            case (int)GameEnterType.猎魂:; GAMES_PUSH.GetInstance().CommandStart(userid, (int)GameResultType.FAIL, game.Spirit.spirit_pass, gt); break;
            }
        }
Ejemplo n.º 7
0
        /// <summary>猎魂游戏</summary>
        public ASObject CommandStart(TGGSession session, ASObject data)
        {
#if DEBUG
            XTrace.WriteLine("{0}:{1}", "GAMES_SHOT_FINISH", "猎魂游戏");
#endif
            var score  = Convert.ToInt32(data.FirstOrDefault(m => m.Key == "score").Value);
            var pass   = Convert.ToInt32(data.FirstOrDefault(m => m.Key == "pass").Value);
            var player = session.Player.CloneEntity();

            var copyfamepass = Variable.BASE_COPYFAMEPASS.FirstOrDefault(m => m.type == pass);    //查询打气球基表数据
            if (copyfamepass == null)
            {
                return(Error((int)ResultType.BASE_TABLE_ERROR));
            }

            var game = session.Player.Game;
            if (game.GameType == (int)GameType.ACTIONGAME)  //闯关模式
            {
                //验证剩余次数
                var b = Common.GetInstance().CheckCount((int)GameEnterType.猎魂, player.UserExtend);
                if (!b)
                {
                    return(Common.GetInstance().Result((int)ResultType.GAME_COUNT_FAIL));
                }
                Common.GetInstance().CreateVariable(session.Player.User.id, (int)GameEnterType.猎魂);
            }


            if (score >= copyfamepass.score)  //过关处理
            {
                if (game.GameType == (int)GameType.ACTIONGAME)
                {
                    Common.GetInstance().UpdateMax(session.Player.User.id, (int)GameEnterType.猎魂, game.Spirit.spirit_pass);
                }
                game.Spirit.spirit_pass += 1;
                GAMES_PUSH.GetInstance().CommandStart(session.Player.User.id, (int)GameResultType.WIN, game.Spirit.spirit_pass, (int)GameEnterType.猎魂);
                return(new ASObject(Common.GetInstance().BuilData((int)ResultType.SUCCESS, game.Spirit.spirit_pass)));
            }
            return(UnPass(session.Player.User.id));
        }
Ejemplo n.º 8
0
 /// <summary>
 /// GAMES_PUSH单体模式
 /// </summary>
 public static GAMES_PUSH GetInstance()
 {
     return(_objInstance ?? (_objInstance = new GAMES_PUSH()));
 }