示例#1
0
//-------------------------------------------------------------------------------------
static PyObject* __py_genUUID64(PyObject *self, void *closure)	
{
	static int8 check = -1;

	if(check < 0)
	{
		if(g_componentGlobalOrder <= 0 || g_componentGlobalOrder > 65535)
		{
			WARNING_MSG(fmt::format("globalOrder({}) is not in the range of 0~65535, genUUID64 is not safe, "
				"in the multi process may be repeated.\n", g_componentGlobalOrder));
		}

		check = 1;
	}

	return PyLong_FromUnsignedLongLong(genUUID64());
}
示例#2
0
//-------------------------------------------------------------------------------------
bool Baseapp::createClientProxies(Proxy* base, bool reload)
{
	// 将通道代理的关系与该entity绑定, 在后面通信中可提供身份合法性识别
	base->getClientMailbox()->getChannel()->proxyID(base->getID());
	
	// 重新生成一个ID
	if(reload)
		base->rndUUID(genUUID64());

	// 让客户端知道已经创建了proxices, 并初始化一部分属性
	Mercury::Bundle bundle;
	bundle.newMessage(ClientInterface::onCreatedProxies);
	bundle << base->rndUUID();
	bundle << base->getID();
	bundle << base->ob_type->tp_name;
	base->getClientMailbox()->postMail(bundle);

	base->initClientBasePropertys();

	// 本应该由客户端告知已经创建好entity后调用这个接口。
	if(!reload)
		base->onEntitiesEnabled();
	return true;
}
示例#3
0
static PyObject* __py_genUUID64(PyObject *self, void *closure)	
{
	return PyLong_FromUnsignedLongLong(genUUID64());
}