Skip to content

Commit 2c80b66

Browse files
committed
Merge commit 'f0f732cc90c0ac18cbe2e4644f69c2bbfcc6a2bd' into scgamex-v3
* commit 'f0f732cc90c0ac18cbe2e4644f69c2bbfcc6a2bd': [Android] fix FileUtils::listFiles with path 'assets/' (cocos2d#19457) Method to check if any IME dispatcher is active. (cocos2d#19451) fix the member parameter:_percent is always be 0 during the update process. (cocos2d#19419) [ci skip][AUTO]: updating luabinding & jsbinding & cocos_file.json automatically (cocos2d#19439) # Conflicts: # cocos/scripting/lua-bindings/auto/api/EventDispatcher.lua # cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp
2 parents 1e6ddc1 + f0f732c commit 2c80b66

File tree

5 files changed

+30
-4
lines changed

5 files changed

+30
-4
lines changed

Diff for: cocos/base/CCIMEDispatcher.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,13 @@ const std::string& IMEDispatcher::getContentText()
266266
return STD_STRING_EMPTY;
267267
}
268268

269+
bool IMEDispatcher::isAnyDelegateAttachedWithIME() const
270+
{
271+
if (!_impl)
272+
return false;
273+
return _impl->_delegateWithIme != nullptr;
274+
}
275+
269276
//////////////////////////////////////////////////////////////////////////
270277
// dispatch keyboard message
271278
//////////////////////////////////////////////////////////////////////////

Diff for: cocos/base/CCIMEDispatcher.h

+5
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ class CC_DLL IMEDispatcher
7878
* @lua NA
7979
*/
8080
const std::string& getContentText();
81+
82+
/**
83+
*@brief Returns if any delegate is attached with IME.
84+
*/
85+
bool isAnyDelegateAttachedWithIME() const;
8186

8287
//////////////////////////////////////////////////////////////////////////
8388
// dispatch keyboard notification

Diff for: cocos/platform/android/CCFileUtils-android.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ long FileUtilsAndroid::getFileSize(const std::string& filepath) const
307307
std::vector<std::string> FileUtilsAndroid::listFiles(const std::string& dirPath) const
308308
{
309309

310-
if(isAbsolutePath(dirPath)) return FileUtils::listFiles(dirPath);
310+
if(!dirPath.empty() && dirPath[0] == '/') return FileUtils::listFiles(dirPath);
311311

312312
std::vector<std::string> fileList;
313313
string fullPath = fullPathForDirectory(dirPath);

Diff for: extensions/assets-manager/AssetsManagerEx.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ void AssetsManagerEx::fileSuccess(const std::string &customId, const std::string
989989
// Reduce count only when unit found in _downloadUnits
990990
_totalWaitToDownload--;
991991

992-
_percentByFile = 100 * (float)(_totalToDownload - _totalWaitToDownload) / _totalToDownload;
992+
_percent = _percentByFile = 100 * (float)(_totalToDownload - _totalWaitToDownload) / _totalToDownload;
993993
// Notify progression event
994994
dispatchUpdateEvent(EventAssetsManagerEx::EventCode::UPDATE_PROGRESSION, "");
995995
}

Diff for: tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp

+16-2
Original file line numberDiff line numberDiff line change
@@ -1408,10 +1408,24 @@ void TestListFiles::onEnter()
14081408
this->addChild(cntLabel);
14091409
cntLabel->setPosition(winSize.width / 2, winSize.height / 3);
14101410
// writeTest
1411-
auto list = FileUtils::getInstance()->listFiles("fonts");
1411+
std::vector<std::string> listFonts = FileUtils::getInstance()->listFiles("fonts");
1412+
auto defaultPath = FileUtils::getInstance()->getDefaultResourceRootPath();
1413+
std::vector<std::string> list = FileUtils::getInstance()->listFiles (defaultPath);
14121414

14131415
char cntBuffer[200] = { 0 };
1414-
snprintf(cntBuffer, 200, "%d", list.size());
1416+
snprintf(cntBuffer, 200, "'fonts/' %d, $defaultResourceRootPath %d",listFonts.size(), list.size());
1417+
1418+
for(int i=0;i<listFonts.size();i++)
1419+
{
1420+
CCLOG("fonts/ %d: \t %s", i, listFonts[i].c_str());
1421+
}
1422+
1423+
for(int i=0;i<list.size();i++)
1424+
{
1425+
CCLOG("defResRootPath %d: \t %s", i, list[i].c_str());
1426+
}
1427+
1428+
14151429
cntLabel->setString(cntBuffer);
14161430

14171431
}

0 commit comments

Comments
 (0)