elemPropertyData.cpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #include "elemPropertyData.h"
  2. #include "plisthpp/redream.h"
  3. ElemPropertyData::ElemPropertyData()
  4. {
  5. //TODO: 把默认图标变成程序内部资源
  6. iconPath = ":/icon/icon/菜狗.png";
  7. dropConfig = 0;
  8. }
  9. bool ElemPropertyData::isSingleContainerKey(QString poolKey,QString newKey)
  10. {
  11. int index = getPoolIndex(poolKey);
  12. for(const auto &i:container[index].table){
  13. if(newKey == i.key){
  14. return false;
  15. }
  16. }
  17. return true;
  18. }
  19. bool ElemPropertyData::isSingleChildElemName(QString newName)
  20. {
  21. for(const auto &i:childElem){
  22. if(newName == i.name){
  23. return false;
  24. }
  25. }
  26. return true;
  27. }
  28. int ElemPropertyData::getAnimIndex(QString animName)
  29. {
  30. for(int i=0;i<statusEffect.size();i++){
  31. if(statusEffect[i].name == animName){
  32. return i;
  33. }
  34. }
  35. return -1;
  36. }
  37. int ElemPropertyData::getCollAnimIndex(QString name)
  38. {
  39. for(int i=0;i<collAnim.size();i++){
  40. if(collAnim[i].name == name){
  41. return i;
  42. }
  43. }
  44. return -1;
  45. }
  46. int ElemPropertyData::getStatusValIndex(QString statusVal)
  47. {
  48. for(int i=0;i<statusConfig.size();i++){
  49. if(statusConfig[i].statusValue == statusVal){
  50. return i;
  51. }
  52. }
  53. return -1;
  54. }
  55. int ElemPropertyData::getPoolIndex(QString poolName)
  56. {
  57. for(int i=0;i<container.size();i++){
  58. if(container[i].poolName == poolName){
  59. return i;
  60. }
  61. }
  62. return -1;
  63. }
  64. QList<QString> ElemPropertyData::getTimelineList(QString filePath)
  65. {
  66. if(timelineListMap.find(filePath) == timelineListMap.end()){
  67. QList<QString> list = Redream::getInstance()->getTimelineFromRedream(filePath.toStdString());
  68. timelineListMap[filePath] = list;
  69. return list;
  70. }
  71. return timelineListMap[filePath];
  72. }