Code Monkey home page Code Monkey logo

poker's Introduction

斗地主

此项目为测试NB在Websocket方面应用的练手项目,所以没有做严格的安全处理和功能测试,仅供参考和学习。 如果你想帮助完善,欢迎PR!

环境要求

  1. Linux/MAC, PHP 7.0 +, PHP-Sqlite, Redis
  2. Swoole 2.1.3 +
  3. NB Framework

安装

1.下载项目

git clone https://github.com/nbcx/poker.git
cd ./poker/server
git clone https://github.com/nbcx/framework.git nb

or

git clone https://github.com/nbcx/poker.git
cd ./poker/server
composer install

2.运行,需要确保你的redis安装并启动。

cd bin

./server start

根据你的php安装方式,上面的命令可能执行错误,你可以用你自己完整的php路径方式启动:

/usr/bin/php server start

3.浏览器访问http://127.0.0.1:9503,如果显示API文档,则表示成功!

测试

源码目录下的client是一个简单的web功能测试客户端,直接打开index.html注册登录就可以使用。 当然,你也可以用nginx来访问,只需这样配置一下:

server {
    listen 80;
    server_name xxxxx.cn;
    index index.html;
    root /home/www/poker/client/;

    location ~ .*\.(svg|woff2|map|html|woff|ttf|ico|css|js|gif|jpg|jpeg|png|bmp|swf)$ {
        expires 90d;
    }
}

功能

  • 登录注册
  • 房间列表
  • 创建房间和密码房间
  • 进入房间和退出房间
  • 游戏准备和取消准备
  • 抢地主
  • 发牌
  • 出牌以及出牌规则验证和大小比较
  • 房间聊天
  • 上线下线通知
  • 出牌等待时间不能超过规定时间
  • 托管

技术交流

QQ群: 1985508

poker's People

Contributors

nbcx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

poker's Issues

Uncaught ErrorException: could not find driver in Pool.php

Hi, I have installed the game according to the installation instructions, I have also installed redis but I get error when starting the server ./server start.
Here is the error message, please help me to solve this.
Regards

listen address       0.0.0.0
listen port          9503
worker num           2
task worker num      2
swoole version       4.2.12

connection open: 1
connection open: 2
connection open: 3
PHP Fatal error:  Uncaught ErrorException: could not find driver in www/poker/server/nb/src/Pool.php:127
Stack trace:
#0 www/poker/server/nb/src/server/Http.php(102): nb\server\assist\Swoole->error(Object(PDOException))
#1 {main}
  thrown in www/poker/server/nb/src/Pool.php on line 127
PHP Fatal error:  Uncaught ErrorException: could not find driver in www/poker/server/nb/src/Pool.php:127```

regards

Online demo?

Hi,
Can you please put up an online demo?
I would appreciate it :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.