Skip to content

Commit

Permalink
Merge commit 'f0f732cc90c0ac18cbe2e4644f69c2bbfcc6a2bd' into scgamex-v3
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
stevetranby committed Mar 5, 2019
2 parents 1e6ddc1 + f0f732c commit 2c80b66
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 4 deletions.
7 changes: 7 additions & 0 deletions cocos/base/CCIMEDispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,13 @@ const std::string& IMEDispatcher::getContentText()
return STD_STRING_EMPTY;
}

bool IMEDispatcher::isAnyDelegateAttachedWithIME() const
{
if (!_impl)
return false;
return _impl->_delegateWithIme != nullptr;
}

//////////////////////////////////////////////////////////////////////////
// dispatch keyboard message
//////////////////////////////////////////////////////////////////////////
Expand Down
5 changes: 5 additions & 0 deletions cocos/base/CCIMEDispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ class CC_DLL IMEDispatcher
* @lua NA
*/
const std::string& getContentText();

/**
*@brief Returns if any delegate is attached with IME.
*/
bool isAnyDelegateAttachedWithIME() const;

//////////////////////////////////////////////////////////////////////////
// dispatch keyboard notification
Expand Down
2 changes: 1 addition & 1 deletion cocos/platform/android/CCFileUtils-android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ long FileUtilsAndroid::getFileSize(const std::string& filepath) const
std::vector<std::string> FileUtilsAndroid::listFiles(const std::string& dirPath) const
{

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

std::vector<std::string> fileList;
string fullPath = fullPathForDirectory(dirPath);
Expand Down
2 changes: 1 addition & 1 deletion extensions/assets-manager/AssetsManagerEx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ void AssetsManagerEx::fileSuccess(const std::string &customId, const std::string
// Reduce count only when unit found in _downloadUnits
_totalWaitToDownload--;

_percentByFile = 100 * (float)(_totalToDownload - _totalWaitToDownload) / _totalToDownload;
_percent = _percentByFile = 100 * (float)(_totalToDownload - _totalWaitToDownload) / _totalToDownload;
// Notify progression event
dispatchUpdateEvent(EventAssetsManagerEx::EventCode::UPDATE_PROGRESSION, "");
}
Expand Down
18 changes: 16 additions & 2 deletions tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1408,10 +1408,24 @@ void TestListFiles::onEnter()
this->addChild(cntLabel);
cntLabel->setPosition(winSize.width / 2, winSize.height / 3);
// writeTest
auto list = FileUtils::getInstance()->listFiles("fonts");
std::vector<std::string> listFonts = FileUtils::getInstance()->listFiles("fonts");
auto defaultPath = FileUtils::getInstance()->getDefaultResourceRootPath();
std::vector<std::string> list = FileUtils::getInstance()->listFiles (defaultPath);

char cntBuffer[200] = { 0 };
snprintf(cntBuffer, 200, "%d", list.size());
snprintf(cntBuffer, 200, "'fonts/' %d, $defaultResourceRootPath %d",listFonts.size(), list.size());

for(int i=0;i<listFonts.size();i++)
{
CCLOG("fonts/ %d: \t %s", i, listFonts[i].c_str());
}

for(int i=0;i<list.size();i++)
{
CCLOG("defResRootPath %d: \t %s", i, list[i].c_str());
}


cntLabel->setString(cntBuffer);

}
Expand Down

0 comments on commit 2c80b66

Please sign in to comment.