123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- #include "elemPropertyData.h"
- #include "plisthpp/redream.h"
- ElemPropertyData::ElemPropertyData()
- {
- iconPath = ":/icon/icon/菜狗.png";
- dropConfig = 0;
- }
- int ElemPropertyData::getKeyIndex(int poolIndex, QString key)
- {
- for(int i = 0;i<container[poolIndex].table.size();i++){
- if(key == container[poolIndex].table[i].key){
- return i;
- }
- }
- return -1;
- }
- int ElemPropertyData::getChildElemIndex(QString childElemName)
- {
- for(int i=0;i<childElem.size();i++){
- if(childElemName == childElem[i].name){
- return i;
- }
- }
- return -1;
- }
- int ElemPropertyData::getAnimIndex(QString animName)
- {
- for(int i=0;i<statusEffect.size();i++){
- if(statusEffect[i].name == animName){
- return i;
- }
- }
- return -1;
- }
- int ElemPropertyData::getCollAnimIndex(QString name)
- {
- for(int i=0;i<collAnim.size();i++){
- if(collAnim[i].name == name){
- return i;
- }
- }
- return -1;
- }
- int ElemPropertyData::getStatusValIndex(QString statusVal)
- {
- for(int i=0;i<statusConfig.size();i++){
- if(statusConfig[i].statusValue == statusVal){
- return i;
- }
- }
- return -1;
- }
- int ElemPropertyData::getPoolIndex(QString poolName)
- {
- for(int i=0;i<container.size();i++){
- if(container[i].poolName == poolName){
- return i;
- }
- }
- return -1;
- }
- QList<QString> ElemPropertyData::getTimelineList(QString filePath)
- {
- if(timelineListMap.find(filePath) == timelineListMap.end()){
- QList<QString> list = Redream::getInstance()->getTimelineFromRedream(filePath.toStdString());
- timelineListMap[filePath] = list;
- return list;
- }
- return timelineListMap[filePath];
- }
- void ElemPropertyData::readFundData(const QJsonObject &json)
- {
- if(json.contains("labelName") && json["labelName"].isString()){
- labelName = json["labelName"].toString();
- }
- if(json.contains("size") && json["size"].isString()){
- size = json["size"].toString();
- }
- if(json.contains("maxLayer") && json["maxLayer"].isString()){
- maxLayer = json["maxLayer"].toString();
- }
- if(json.contains("score") && json["score"].isString()){
- score = json["score"].toString();
- }
- if(json.contains("dropConfig") && json["maxLayer"].isDouble()){
- dropConfig = json["dropConfig"].toInt();
- }
- if(json.contains("iconPath") && json["iconPath"].isString()){
- iconPath = json["iconPath"].toString();
- }
- }
- void ElemPropertyData::writeFundData(QJsonObject &json) const
- {
- json["labelName"] = labelName;
- json["size"] = size;
- json["maxLayer"] = maxLayer;
- json["score"] = score;
- json["dropConfig"] = dropConfig;
- json["iconPath"] = iconPath;
- }
|