void NFCRecordLogic::AddRecord(const NF_SHARE_PTR<NFIObject>& object, const std::string &strRecordName, const NFMsg::RecordAddRowStruct &data) { NF_SHARE_PTR<NFIRecordManager> recordMgr = object->GetRecordManager(); NF_SHARE_PTR<NFDataList> varData = NF_SHARE_PTR<NFDataList>(NF_NEW NFDataList()); NF_SHARE_PTR<NFDataList> varInit = NF_SHARE_PTR<NFDataList>(NF_NEW NFDataList()); NF_SHARE_PTR<NFDataList> varTag = NF_SHARE_PTR<NFDataList>(NF_NEW NFDataList()); for(int j = 0; j < data.record_float_list_size(); j++) { varInit->AddFloat(0); varData->AddFloat(data.record_float_list(j).data()); } for(int j = 0; j < data.record_int_list_size(); j++) { varInit->AddInt(0); varData->AddInt(data.record_int_list(j).data()); } for(int j = 0; j < data.record_string_list_size(); j++) { varInit->AddString(""); varData->AddString(data.record_string_list(j).data()); } for(int j = 0; j < data.record_object_list_size(); j++) { varInit->AddObject(NFGUID()); varData->AddObject(NFINetModule::PBToNF(data.record_object_list(j).data())); } for(int j = 0; j < data.record_vector2_list_size(); j++) { varInit->AddVector2(NFVector2()); varData->AddVector2(NFINetModule::PBToNF(data.record_vector2_list(j).data())); } for(int j = 0; j < data.record_vector3_list_size(); j++) { varInit->AddVector3(NFVector3()); varData->AddVector3(NFINetModule::PBToNF(data.record_vector3_list(j).data())); } NF_SHARE_PTR<NFIRecord> record = recordMgr->GetElement(strRecordName); if(record == nullptr) { record = recordMgr->AddRecord(NFGUID(), strRecordName, varInit, varTag, 255); } record->AddRow(data.row(), *varData); }
bool NFCRecord::QueryRow(const int nRow, NFDataList& varList) { if (!ValidRow(nRow)) { return false; } if (!IsUsed(nRow)) { return false; } varList.Clear(); for (int i = 0; i < GetCols(); ++i) { NF_SHARE_PTR<NFData>& pVar = mtRecordVec.at(GetPos(nRow, i)); if (pVar) { varList.Append(*pVar); } else { switch (GetColType(i)) { case TDATA_INT: varList.Add(NFINT64(0)); break; case TDATA_FLOAT: varList.Add(0.0f); break; case TDATA_STRING: varList.Add(NULL_STR.c_str()); break; case TDATA_OBJECT: varList.Add(NFGUID()); break; case TDATA_VECTOR2: varList.Add(NFVector2()); break; case TDATA_VECTOR3: varList.Add(NFVector3()); break; default: return false; break; } } } if (varList.GetCount() != GetCols()) { return false; } return true; }
bool NFCCreateRoleModule::ConvertPBToPropertyManager(const NFMsg::ObjectPropertyList& pPropertyData, NF_SHARE_PTR<NFIPropertyManager> pProps) { if (pProps) { for (int i = 0; i < pPropertyData.property_int_list_size(); ++i) { const NFMsg::PropertyInt& xData = pPropertyData.property_int_list(i); if (pProps->ExistElement(xData.property_name())) { pProps->AddProperty(pProps->Self(), xData.property_name(), NFDATA_TYPE::TDATA_INT); } pProps->SetPropertyInt(xData.property_name(), xData.data()); } for (int i = 0; i < pPropertyData.property_float_list_size(); ++i) { const NFMsg::PropertyFloat& xData = pPropertyData.property_float_list(i); if (pProps->ExistElement(xData.property_name())) { pProps->AddProperty(pProps->Self(), xData.property_name(), NFDATA_TYPE::TDATA_FLOAT); } pProps->SetPropertyFloat(xData.property_name(), xData.data()); } for (int i = 0; i < pPropertyData.property_string_list_size(); ++i) { const NFMsg::PropertyString& xData = pPropertyData.property_string_list(i); if (pProps->ExistElement(xData.property_name())) { pProps->AddProperty(pProps->Self(), xData.property_name(), NFDATA_TYPE::TDATA_STRING); } pProps->SetPropertyString(xData.property_name(), xData.data()); } for (int i = 0; i < pPropertyData.property_object_list_size(); ++i) { const NFMsg::PropertyObject& xData = pPropertyData.property_object_list(i); if (pProps->ExistElement(xData.property_name())) { pProps->AddProperty(pProps->Self(), xData.property_name(), NFDATA_TYPE::TDATA_OBJECT); } pProps->SetPropertyObject(xData.property_name(), NFGUID(xData.data().svrid(), xData.data().index())); } for (int i = 0; i < pPropertyData.property_vector2_list_size(); ++i) { const NFMsg::PropertyVector2& xData = pPropertyData.property_vector2_list(i); if (pProps->ExistElement(xData.property_name())) { pProps->AddProperty(pProps->Self(), xData.property_name(), NFDATA_TYPE::TDATA_VECTOR2); } pProps->SetPropertyVector2(xData.property_name(), NFVector2(xData.data().x(), xData.data().y())); } for (int i = 0; i < pPropertyData.property_vector3_list_size(); ++i) { const NFMsg::PropertyVector3& xData = pPropertyData.property_vector3_list(i); if (pProps->ExistElement(xData.property_name())) { pProps->AddProperty(pProps->Self(), xData.property_name(), NFDATA_TYPE::TDATA_VECTOR3); } pProps->SetPropertyVector3(xData.property_name(), NFVector3(xData.data().x(), xData.data().y(), xData.data().z())); } } return true; }
NFVector2 zz() const { return NFVector2(this->z, this->z); }
NFVector2 yz() const { return NFVector2(this->y, this->z); }
NFVector2 xz() const { return NFVector2(this->x, this->z); }
NFVector2 zy() const { return NFVector2(this->z, this->y); }
NFVector2 yy() const { return NFVector2(this->y, this->y); }
NFVector2 xy() const { return NFVector2(this->x, this->y); }
NFVector2 zx() const { return NFVector2(this->z, this->x); }
NFVector2 yx() const { return NFVector2(this->y, this->x); }
NFVector2 xx() const { return NFVector2(this->x, this->x); }