update
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#include "AppDelegate.h"
|
||||
#include "AppDelegate.h"
|
||||
#include "MainScene.h"
|
||||
#include "GameFrameBase.h"
|
||||
#include "LogoScene.h"
|
||||
@@ -19,9 +19,9 @@
|
||||
|
||||
USING_NS_CC;
|
||||
|
||||
/*******************************添加游戏****************************************/
|
||||
/*******************************注册游戏****************************************/
|
||||
|
||||
// 游戏选项
|
||||
// 游戏选项
|
||||
struct tagGameItem
|
||||
{
|
||||
WORD wKindID;
|
||||
@@ -31,19 +31,19 @@ struct tagGameItem
|
||||
|
||||
static tagGameItem s_GameList[] =
|
||||
{
|
||||
// 斗地主;
|
||||
// 斗地主;
|
||||
{ DDZ_KIND_ID, GAME_CREATE_SELECTOR(DDZ_SPACE::DDZGameScene::create), GAME_CREATE_NODE(nullptr) },
|
||||
// 万年麻将;
|
||||
// 万年麻将;
|
||||
{ WNMJ_SPACE::KIND_ID, GAME_CREATE_SELECTOR(WNMJ_SPACE::WN_GameScene::create), GAME_CREATE_NODE(nullptr) },
|
||||
// 牛牛;
|
||||
// 牛牛;
|
||||
{ NN_KIND_ID, GAME_CREATE_SELECTOR(NiuNiu_SPACE::NNGameScene::create), GAME_CREATE_NODE(nullptr) },
|
||||
// 打炸;
|
||||
// 打炸;
|
||||
{ DZ_KIND_ID, GAME_CREATE_SELECTOR(DZ_SPACE::DZGameScene::create), GAME_CREATE_NODE(nullptr) },
|
||||
// 十三张;
|
||||
// 十三水;
|
||||
{ SSS_KIND_ID, GAME_CREATE_SELECTOR(SSS_SPACE::SSSGameScene::create), GAME_CREATE_NODE(nullptr) },
|
||||
// 炸金花;
|
||||
// 炸金花;
|
||||
{ ZJH_KIND_ID, GAME_CREATE_SELECTOR(ZJH_SPACE::ZJHGameScene::create), GAME_CREATE_NODE(nullptr) },
|
||||
// 跑得快;
|
||||
// 跑得快;
|
||||
{ PDK_KIND_ID, GAME_CREATE_SELECTOR(PDK_SPACE::PDKGameScene::create), GAME_CREATE_NODE(nullptr) },
|
||||
};
|
||||
/******************************************************************************/
|
||||
@@ -55,7 +55,7 @@ AppDelegate::AppDelegate()
|
||||
|
||||
AppDelegate::~AppDelegate()
|
||||
{
|
||||
//// 释放语音;
|
||||
//// 释放资源;
|
||||
//YvVoiceManager::GetInstance()->Cleanup();
|
||||
|
||||
if (m_dispathMsgNode != NULL)
|
||||
@@ -104,7 +104,7 @@ bool AppDelegate::applicationDidFinishLaunching() {
|
||||
// set FPS. the default value is 1.0/60 if you don't call this
|
||||
director->setAnimationInterval(1.0f / 60);
|
||||
|
||||
//增加资源搜索路径
|
||||
//设置资源搜索路径
|
||||
//FileUtils::getInstance()->addSearchPath("UI/");
|
||||
//FileUtils::getInstance()->addSearchPath("NCMJ/");
|
||||
|
||||
@@ -114,7 +114,7 @@ bool AppDelegate::applicationDidFinishLaunching() {
|
||||
|
||||
GlobalJosn::getInstance()->loadConfig();
|
||||
|
||||
//设置永不关屏
|
||||
//设置常亮不锁屏
|
||||
Device::setKeepScreenOn(true);
|
||||
|
||||
// create a scene. it's an autorelease object
|
||||
@@ -174,7 +174,7 @@ void AppDelegate::applicationWillEnterForeground() {
|
||||
|
||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32)
|
||||
|
||||
//设置永不关屏
|
||||
//设置常亮不锁屏
|
||||
Device::setKeepScreenOn(true);
|
||||
|
||||
Scene* pScene = Director::getInstance()->getRunningScene();
|
||||
@@ -202,10 +202,10 @@ void AppDelegate::applicationWillEnterForeground() {
|
||||
|
||||
void AppDelegate::initGameConfig()
|
||||
{
|
||||
// 添加游戏
|
||||
// 注册游戏
|
||||
int gameCount = sizeof(s_GameList) / sizeof(tagGameItem);
|
||||
for (int i = 0; i < gameCount; i++)
|
||||
{
|
||||
CGameCreator::getInstance()->addGame(s_GameList[i].wKindID, CGameCreator::PRIVATE, s_GameList[i].create, s_GameList[i].createNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,19 +29,19 @@
|
||||
#define VERSION_EFFICACY 0 //效验版本;
|
||||
#define VERSION_FRAME_SDK INTERFACE_VERSION(6,3) //框架版本;
|
||||
|
||||
#define LOGON_SERVER_ADDRESS "47.100.47.128" //登录服务器地址;
|
||||
#define WEB_SERVER_ADDRESS "http://queyi.ppxq.net" //WEB服务器地址;
|
||||
#define LOGON_SERVER_ADDRESS "121.40.40.53" //登录服务器地址;
|
||||
#define WEB_SERVER_ADDRESS "http://queyi.ppxq.net" //WEB服务器地址;
|
||||
|
||||
//#define LOGON_SERVER_ADDRESS "106.15.35.78" //登录服务器地址;
|
||||
//#define WEB_SERVER_ADDRESS "http://106.15.35.78:8066" //WEB服务器地址;
|
||||
//#define LOGON_SERVER_ADDRESS "47.100.47.128" //登录服务器地址;
|
||||
//#define WEB_SERVER_ADDRESS "http://queyi.ppxq.net" //WEB服务器地址;
|
||||
|
||||
#define PAY_TO_PLAYER_HTTP_ADDRESS "http://queyi.ppxq.net/Lobby/PayToPlayer" //转账给玩家;
|
||||
#define PAY_LOG_HTTP_ADDRESS "http://queyi.ppxq.net/Lobby/GetPayLog" //充值记录;
|
||||
#define GET_NICKNAME_HTTP_ADDRESS "http://queyi.ppxq.net/Lobby/GetPlayerNickName" //获取昵称;
|
||||
#define DUI_HUAN_HTTP_ADDRESS "http://queyi.ppxq.net/duihuan.html" //兑换地址;
|
||||
#define GONG_HUI_HTTP_ADDRESS "http://queyi.ppxq.net/gonghui.html" //公会地址;
|
||||
#define HEAD_HTTP_ADDRESS "http://qy.ppxq.net/b.php?id=%d" //公会地址;
|
||||
#define SHARE_HTTP_ADDRESS "http://queyi.ppkdy.com/qy.html" //分享地址;
|
||||
#define HEAD_HTTP_ADDRESS "http://queyi.ppxq.net/b.php?id=%d" //头像地址;
|
||||
#define SHARE_HTTP_ADDRESS "http://queyi.ppxq.net/qy.html" //分享地址;
|
||||
|
||||
#define LOGON_SERVER_PORT 10086 //登录服务器端口;
|
||||
//#define LOGON_SERVER_PORT 10090 //登录服务器端口;
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
//////////////////////////////////////////////////////////////
|
||||
#include <assert.h>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
|
||||
#ifndef ASSERT
|
||||
#define ASSERT(f) assert(f)
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
#include "Utility.h"
|
||||
#include "Utility.h"
|
||||
#include "ui/CocosGUI.h"
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||
#include "iconv.h"
|
||||
#else
|
||||
#include <jni.h>
|
||||
#include "platform/android/jni/JniHelper.h"
|
||||
#endif
|
||||
#include "Helps.h"
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* 计算utf8字符串长度
|
||||
* @param utf8 utf8字符串
|
||||
* @return 字符串长度
|
||||
* 获取utf8字符串长度
|
||||
* @param utf8 utf8字符串
|
||||
* @return 字符串长度
|
||||
*/
|
||||
int utf8_len(const char *utf8)
|
||||
{
|
||||
@@ -34,9 +39,9 @@ int utf8_cmp(const char* str1, const char* str2)
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算ucs2字符串长度
|
||||
* @param ucs2 ucs2字符串
|
||||
* @return 字符串长度
|
||||
* 获取ucs2字符串长度
|
||||
* @param ucs2 ucs2字符串
|
||||
* @return 字符串长度
|
||||
*/
|
||||
int ucs2_len(const unsigned short* ucs2)
|
||||
{
|
||||
@@ -70,15 +75,36 @@ int code_convert(const char *from_charset, const char *to_charset, const char *i
|
||||
return 0;
|
||||
#endif
|
||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32)
|
||||
iconv_t cd;
|
||||
const char *temp = inbuf;
|
||||
const char **pin = &temp;
|
||||
char **pout = &outbuf;
|
||||
memset(outbuf,0,outlen);
|
||||
cd = iconv_open(to_charset,from_charset);
|
||||
if(cd==0) return -1;
|
||||
if(-1==iconv(cd, (char **)(pin),&inlen,pout,&outlen)) return -1;
|
||||
iconv_close(cd);
|
||||
JNIEnv* env = cocos2d::JniHelper::getEnv();
|
||||
if (!env) return -1;
|
||||
|
||||
jbyteArray inputBytes = env->NewByteArray(inlen);
|
||||
env->SetByteArrayRegion(inputBytes, 0, inlen, (const jbyte*)inbuf);
|
||||
|
||||
jstring fromCharset = env->NewStringUTF(from_charset);
|
||||
jstring toCharset = env->NewStringUTF(to_charset);
|
||||
|
||||
jclass stringClass = env->FindClass("java/lang/String");
|
||||
jmethodID ctor = env->GetMethodID(stringClass, "<init>", "([BLjava/lang/String;)V");
|
||||
jobject jstr = env->NewObject(stringClass, ctor, inputBytes, fromCharset);
|
||||
|
||||
jmethodID getBytes = env->GetMethodID(stringClass, "getBytes", "(Ljava/lang/String;)[B");
|
||||
jbyteArray outputBytes = (jbyteArray)env->CallObjectMethod(jstr, getBytes, toCharset);
|
||||
|
||||
if (outputBytes) {
|
||||
jsize outputLen = env->GetArrayLength(outputBytes);
|
||||
if ((size_t)outputLen < outlen) {
|
||||
env->GetByteArrayRegion(outputBytes, 0, outputLen, (jbyte*)outbuf);
|
||||
}
|
||||
env->DeleteLocalRef(outputBytes);
|
||||
}
|
||||
|
||||
env->DeleteLocalRef(jstr);
|
||||
env->DeleteLocalRef(toCharset);
|
||||
env->DeleteLocalRef(fromCharset);
|
||||
env->DeleteLocalRef(inputBytes);
|
||||
env->DeleteLocalRef(stringClass);
|
||||
return 0;
|
||||
#endif
|
||||
return 0;
|
||||
@@ -87,9 +113,9 @@ int code_convert(const char *from_charset, const char *to_charset, const char *i
|
||||
namespace utility
|
||||
{
|
||||
/**
|
||||
* 计算utf8字符串长度
|
||||
* @param utf8 utf8字符串
|
||||
* @return 字符串长度
|
||||
* 获取utf8字符串长度
|
||||
* @param utf8 utf8字符串
|
||||
* @return 字符串长度
|
||||
*/
|
||||
int utf8_len(std::string utf8)
|
||||
{
|
||||
@@ -99,15 +125,15 @@ namespace utility
|
||||
{
|
||||
return 0;
|
||||
unsigned int i;
|
||||
unsigned long nBytes=0;//UFT8可用1-6个字节编码,ASCII用一个字节
|
||||
unsigned long nBytes=0;//UFT8可用1-6个字节编码,ASCII用一个字节
|
||||
unsigned char chr;
|
||||
int bAllAscii=1; //如果全部都是ASCII, 说明不是UTF-8
|
||||
int bAllAscii=1; //如果全部都是ASCII, 说明不是UTF-8
|
||||
for(i=0;i<length;i++)
|
||||
{
|
||||
chr= *(str+i);
|
||||
if( (chr&0x80) != 0 ) // 判断是否ASCII编码,如果不是,说明有可能是UTF-8,ASCII用7位编码,但用一个字节存,最高位标记为0,o0xxxxxxx
|
||||
if( (chr&0x80) != 0 ) // 判断是否ASCII编码,如果不是,说明有可能是UTF-8,ASCII用7位编码,用一个字节存,最高位标记为0,o0xxxxxxx
|
||||
bAllAscii= 0;
|
||||
if(nBytes==0) //如果不是ASCII码,应该是多字节符,计算字节数
|
||||
if(nBytes==0) //如果不是ASCII码,应该是多字节符,计算字节数
|
||||
{
|
||||
if(chr>=0x80)
|
||||
{
|
||||
@@ -128,7 +154,7 @@ namespace utility
|
||||
nBytes--;
|
||||
}
|
||||
}
|
||||
else //多字节符的非首字节,应为 10xxxxxx
|
||||
else //多字节符的非首字节,应为 10xxxxxx
|
||||
{
|
||||
if( (chr&0xC0) != 0x80 )
|
||||
{
|
||||
@@ -137,11 +163,11 @@ namespace utility
|
||||
nBytes--;
|
||||
}
|
||||
}
|
||||
if( nBytes > 0 ) //违返规则
|
||||
if( nBytes > 0 ) //违反规则
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if( bAllAscii ) //如果全部都是ASCII, 说明不是UTF-8
|
||||
if( bAllAscii ) //如果全部都是ASCII, 说明不是UTF-8
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -184,7 +210,7 @@ namespace utility
|
||||
return strRet;
|
||||
}
|
||||
|
||||
/*gbk转为UTF16*/
|
||||
/*gbk转为UTF16*/
|
||||
std::string a2l(const char *inbuf)
|
||||
{
|
||||
size_t inlen = strlen(inbuf);
|
||||
@@ -197,7 +223,7 @@ namespace utility
|
||||
}
|
||||
|
||||
|
||||
/*utf16转为UTF8*/
|
||||
/*utf16转为UTF8*/
|
||||
std::string l2u(const char *inbuf)
|
||||
{
|
||||
size_t inlen = ucs2_len((const unsigned short*)&inbuf[0]);
|
||||
@@ -270,7 +296,7 @@ namespace utility
|
||||
pSprFace->setAnchorPoint(Vec2(0, 0));
|
||||
pSprFace->setFlippedY(true);
|
||||
|
||||
// 头像剪切
|
||||
// 头像遮罩
|
||||
auto textureCache = Director::getInstance()->getTextureCache();
|
||||
auto texMask = textureCache->addImage("Platform/lobby/head_mask.png");
|
||||
CC_ASSERT(texMask != nullptr);
|
||||
@@ -407,7 +433,7 @@ namespace utility
|
||||
}
|
||||
}
|
||||
|
||||
//超出宽度用星号代替(参数:昵称,字体文件,字体大小,超出宽度)
|
||||
//根据宽度截取昵号长度(参数:昵称,字体文件名,字体大小,限定宽度)
|
||||
std::string getShortName(const std::string& strName, const std::string& strFont, float fFontSize, float fOverWidth)
|
||||
{
|
||||
size_t nCount = strName.size();
|
||||
@@ -435,7 +461,7 @@ namespace utility
|
||||
|
||||
if (fTotalWidth >= fOverWidth)
|
||||
{
|
||||
return strName.substr(0, i - (bChinese ? 3 : 1)) + a_u8("…");
|
||||
return strName.substr(0, i - (bChinese ? 3 : 1)) + a_u8("...");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -466,7 +492,7 @@ namespace utility
|
||||
|
||||
if (nTempNum > nFontNum)
|
||||
{
|
||||
return strName.substr(0, i - (bChinese ? 3 : 1)) + a_u8("…");
|
||||
return strName.substr(0, i - (bChinese ? 3 : 1)) + a_u8("...");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,17 +512,17 @@ namespace utility
|
||||
std::string GetUserLevel(SCORE lGrade)
|
||||
{
|
||||
static std::string Levels[] = {
|
||||
"等级:雀蛋",
|
||||
"等级:雀仔",
|
||||
"等级:雀头",
|
||||
"等级:铜雀",
|
||||
"等级:银雀",
|
||||
"等级:金雀",
|
||||
"等级:雀王",
|
||||
"等级:雀皇",
|
||||
"等级:雀仙",
|
||||
"等级:雀圣",
|
||||
"等级:雀神"
|
||||
"等级:雀民",
|
||||
"等级:雀士",
|
||||
"等级:雀头",
|
||||
"等级:铜雀",
|
||||
"等级:银雀",
|
||||
"等级:金雀",
|
||||
"等级:雀侠",
|
||||
"等级:雀杰",
|
||||
"等级:雀王",
|
||||
"等级:雀圣",
|
||||
"等级:雀神"
|
||||
};
|
||||
|
||||
static SCORE lLevels[] = { 200, 500, 1000, 2000, 4000, 6000, 10000, 15000, 20000, 30000 };
|
||||
@@ -527,4 +553,4 @@ namespace utility
|
||||
|
||||
return Helps::MD5Encrypt(timeString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "aes.h"
|
||||
#include "coAes.h"
|
||||
#include <cstring>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
static void aes_encrypt_data( aes_context *ctx, const std::string& ins, std::string& outs)
|
||||
|
||||
Reference in New Issue
Block a user