资源简介

cocoscreator开发棋牌——十三水四色牌;语言:javascript;客户端+服务端+搭建文档。

资源截图

代码片段和文件信息

#include “jsb_socketio.hpp“

#include “cocos/scripting/js-bindings/jswrapper/SeApi.h“
#include “cocos/scripting/js-bindings/manual/jsb_conversions.hpp“
#include “cocos/scripting/js-bindings/manual/jsb_global.h“

#include “cocos/network/SocketIO.h“
#include “base/ccUTF8.h“
#include “base/CCDirector.h“

using namespace cocos2d;
using namespace cocos2d::network;

se::Class* __jsb_SocketIO_class = nullptr;

class JSB_SocketIODelegate : public Ref public SocketIO::SIODelegate
{
public:
    //c++11 map to callbacks
    typedef std::unordered_map JSB_SIOCallbackRegistry;

    JSB_SocketIODelegate()
    {
    }

    virtual ~JSB_SocketIODelegate()
    {
        CCLOGINFO(“In the destructor of JSB_SocketIODelegate(%p)“ this);
    }

    virtual void onConnect(SIOClient* client) override
    {
    }

    virtual void onMessage(SIOClient* client const std::string& data) override
    {
    }

    virtual void onClose(SIOClient* client) override
    {
        CCLOG(“JSB SocketIO::SIODelegate->onClose method called from native“);
        this->fireEventToscript(client “disconnect“ ““);
        if (getReferenceCount() == 1)
        {
            autorelease();
        }
        else
        {
            release();
        }
    }

    virtual void onerror(SIOClient* client const std::string& data) override
    {
        CCLOG(“JSB SocketIO::SIODelegate->onerror method called from native with data: %s“ data.c_str());
        this->fireEventToscript(client “error“ data);
    }

    virtual void fireEventToscript(SIOClient* client const std::string& eventName const std::string& data) override
    {
        CCLOG(“JSB SocketIO::SIODelegate->fireEventToscript method called from native with name ‘%s‘ data: %s“ eventName.c_str() data.c_str());

        se::scriptEngine::getInstance()->clearException();
        se::AutoHandleScope hs;

        if (cocos2d::Director::getInstance() == nullptr || cocos2d::scriptEngineManager::getInstance() == nullptr)
            return;

        auto iter = se::NativePtrToobjectMap::find(client); //FIXME: client probably be a new value with the same address as the old one it may cause undefined result.
        if (iter == se::NativePtrToobjectMap::end())
            return;

        se::Value dataVal;
        if (data.empty())
        {
            dataVal.setNull();
        }
        else
        {
            dataVal.setString(data);
        }

        JSB_SIOCallbackRegistry::iterator it = _eventRegistry.find(eventName);

        if (it != _eventRegistry.end())
        {
            const se::ValueArray& cbStruct = it->second;
            assert(cbStruct.size() == 2);
            const se::Value& callback = cbStruct[0];
            const se::Value& target = cbStruct[1];
            if (callback.isobject() && callback.toobject()->isFunction() && target.isobject())
            {
                se::ValueArray args;
                args.push_back(dat

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-03-02 14:16  奇点棋牌-十三水四色牌\
     目录           0  2018-01-05 17:29  奇点棋牌-十三水四色牌\qidiangame\
     目录           0  2018-03-06 13:19  奇点棋牌-十三水四色牌\qidiangame\client\
     目录           0  2017-12-22 17:12  奇点棋牌-十三水四色牌\qidiangame\client\assets\
     目录           0  2017-12-11 15:41  奇点棋牌-十三水四色牌\qidiangame\client\assets\anims\
     目录           0  2017-12-11 15:41  奇点棋牌-十三水四色牌\qidiangame\client\assets\anims\SSP\
     文件        5820  2017-12-11 15:41  奇点棋牌-十三水四色牌\qidiangame\client\assets\anims\SSP\dihu.anim
     文件          88  2018-03-06 13:19  奇点棋牌-十三水四色牌\qidiangame\client\assets\anims\SSP\dihu.anim.meta
     文件        8573  2017-12-11 15:41  奇点棋牌-十三水四色牌\qidiangame\client\assets\anims\SSP\fapai.anim
     文件          88  2018-03-06 13:19  奇点棋牌-十三水四色牌\qidiangame\client\assets\anims\SSP\fapai.anim.meta
     文件        3203  2017-12-11 15:41  奇点棋牌-十三水四色牌\qidiangame\client\assets\anims\SSP\hupai.anim
     文件          88  2018-03-06 13:19  奇点棋牌-十三水四色牌\qidiangame\client\assets\anims\SSP\hupai.anim.meta
     文件        6253  2017-12-11 15:41  奇点棋牌-十三水四色牌\qidiangame\client\assets\anims\SSP\jinlong.anim
     文件          88  2018-03-06 13:19  奇点棋牌-十三水四色牌\qidiangame\client\assets\anims\SSP\jinlong.anim.meta
     文件       39916  2017-12-11 15:41  奇点棋牌-十三水四色牌\qidiangame\client\assets\anims\SSP\kaishiyouxi3.anim
     文件          88  2018-03-06 13:19  奇点棋牌-十三水四色牌\qidiangame\client\assets\anims\SSP\kaishiyouxi3.anim.meta
     文件        7216  2017-12-11 15:41  奇点棋牌-十三水四色牌\qidiangame\client\assets\anims\SSP\liangsheng.anim
     文件          88  2018-03-06 13:19  奇点棋牌-十三水四色牌\qidiangame\client\assets\anims\SSP\liangsheng.anim.meta
     文件        1685  2017-12-11 15:41  奇点棋牌-十三水四色牌\qidiangame\client\assets\anims\SSP\mopai.anim
     文件          88  2018-03-06 13:19  奇点棋牌-十三水四色牌\qidiangame\client\assets\anims\SSP\mopai.anim.meta
     文件        5615  2017-12-11 15:41  奇点棋牌-十三水四色牌\qidiangame\client\assets\anims\SSP\tianhu.anim
     文件          88  2018-03-06 13:19  奇点棋牌-十三水四色牌\qidiangame\client\assets\anims\SSP\tianhu.anim.meta
     文件        2585  2017-12-11 15:41  奇点棋牌-十三水四色牌\qidiangame\client\assets\anims\SSP\yifanhu.anim
     文件          88  2018-03-06 13:19  奇点棋牌-十三水四色牌\qidiangame\client\assets\anims\SSP\yifanhu.anim.meta
     文件         108  2017-12-11 15:41  奇点棋牌-十三水四色牌\qidiangame\client\assets\anims\SSP.meta
     文件        1660  2017-12-11 15:41  奇点棋牌-十三水四色牌\qidiangame\client\assets\anims\angry.anim
     文件          88  2018-03-06 13:19  奇点棋牌-十三水四色牌\qidiangame\client\assets\anims\angry.anim.meta
     文件       15039  2017-12-11 15:41  奇点棋牌-十三水四色牌\qidiangame\client\assets\anims\bqys.anim
     文件          88  2018-03-06 13:19  奇点棋牌-十三水四色牌\qidiangame\client\assets\anims\bqys.anim.meta
     文件       17385  2017-12-11 15:41  奇点棋牌-十三水四色牌\qidiangame\client\assets\anims\buhua.anim
     文件          88  2018-03-06 13:19  奇点棋牌-十三水四色牌\qidiangame\client\assets\anims\buhua.anim.meta
............此处省略4827个文件信息

评论

共有 条评论