示例#1
0
unsigned int MkLineShape::AddLine(const MkArray<MkFloat2>& vertices)
{
	unsigned int count = 0;
	unsigned int vSize = vertices.GetSize();

	if (vSize > 1) // 최소 두개는 존재해야 가능
	{
		unsigned int index = m_LocalVertices.GetSize();

		if (vertices[0] != vertices[1])
		{
			m_LocalVertices.PushBack(vertices[0]);
		}

		for (unsigned int i=1; i<vSize; ++i)
		{
			const MkFloat2& begin = vertices[i - 1];
			const MkFloat2& end = vertices[i];
			if (begin != end)
			{
				m_LocalVertices.PushBack(vertices[i]); // current

				m_Indices.PushBack(index); // last
				++index;
				m_Indices.PushBack(index); // current

				++count;
			}
		}
	}
	return count;
}
示例#2
0
void MkFileSystem::SetSystemSetting(const MkDataNode& node)
{
	// chunk size
	unsigned int chunkSizeInMB;
	if (node.GetData(L"ChunkSizeInMB", chunkSizeInMB, 0))
	{
		SetChunkSizeGuideline(chunkSizeInMB);
	}

	// comp limit
	unsigned int percentageForCompressing;
	if (node.GetData(L"PercentageForCompressing", percentageForCompressing, 0))
	{
		SetPercentageForCompressing(percentageForCompressing);
	}

	// name rule
	MkStr prefix, extension;
	if (node.GetData(L"Prefix", prefix, 0) && node.GetData(L"Extension", extension, 0))
	{
		SetChunkFileNamingRule(prefix, extension);
	}

	// filtering
	MkArray<MkStr> filterBuffer;
	MkArray<MkPathName> exceptionFilter;
	if (node.GetData(L"ExceptionFilter", filterBuffer))
	{
		exceptionFilter.Reserve(filterBuffer.GetSize());
		MK_INDEXING_LOOP(filterBuffer, i)
		{
			exceptionFilter.PushBack(filterBuffer[i]);
		}
示例#3
0
bool MkWindowFactory::_IsMsgBoxButton(const MkArray<MkHashStr>& callerPath, const MkHashStr& msgBoxName, const MkHashStr& buttonName)
{
	return ((callerPath.GetSize() == 3) && // title -> body -> button
		(callerPath[0] == msgBoxName) &&
		(callerPath[1] == BodyFrameName) &&
		(callerPath[2] == buttonName));
}
示例#4
0
	virtual void SendNodeReportTypeEvent(ePA_SceneNodeEvent eventType, MkArray<MkHashStr>& path, MkDataNode* argument)
	{
		if ((eventType == ePA_SNE_CursorLBtnReleased) && (path.GetSize() == 1))
		{
			if (path[0] == BattleBtnName)
			{
				MK_PAGE_MGR.SetMoveMessage(GamePage::AppLobby::Condition::Battle);
				return;
			}
		}
	
		MkWindowManagerNode::SendNodeReportTypeEvent(eventType, path, argument);
	}
示例#5
0
SupplementDef::eResult SupplementDef::GetResult(const MkArray<eUnit>& units, MkArray<unsigned int>& targetIndice)
{
	unsigned int unitSize = units.GetSize();

	// 유효성 검증
	MK_CHECK(unitSize <= ADEF_MAX_COMBINATION_SLOT_SIZE, L"입력된 unit 갯수가 " + MkStr(ADEF_MAX_COMBINATION_SLOT_SIZE) + L"개를 넘음 : " + MkStr(unitSize))
		return eR_None;

	MK_INDEXING_LOOP(units, i)
	{
		eUnit unit = units[i];
		MK_CHECK((unit == eU_Void) || IsNormalUnit(unit), L"입력된 unit list의 " + MkStr(i) + L"번째에 비정상 unit 존재 : " + MkStr(unit))
			return eR_None;
	}
示例#6
0
void MkDataPack::GetValidUnitList(const MkDataPack& source, MkArray<MkHashStr>& keyList) const
{
	keyList.Clear();
	MkArray<MkHashStr> myOwn;
	GetUnitKeyList(myOwn);
	if (!myOwn.Empty())
	{
		keyList.Reserve(myOwn.GetSize());
		MK_INDEXING_LOOP(myOwn, i)
		{
			const MkHashStr& currKey = myOwn[i];
			if (!(source.IsValidKey(currKey) && source.Equals(currKey, *m_UnitTable[currKey])))
			{
				keyList.PushBack(currKey); // 자신에게만 속하거나 값이 다른 key
			}
		}
	}
示例#7
0
void MkWindowThemedNode::SendNodeCommandTypeEvent(ePA_SceneNodeEvent eventType, MkDataNode* argument)
{
	switch (eventType)
	{
	case ePA_SNE_ChangeTheme:
		{
			MkArray<MkHashStr> names;
			if (argument->GetDataEx(ArgKey_ChangeTheme, names) && (names.GetSize() == 2))
			{
				if (names[0].Empty() || (names[0] == m_ThemeName))
				{
					SetThemeName(names[1]);
				}
			}
		}
		break;
	}
	
	MkVisualPatternNode::SendNodeCommandTypeEvent(eventType, argument);
}
示例#8
0
bool MkFileChunk::AttachOriginalFiles
(const MkPathName& chunkFilePath, MkFilePathListContainer& filePathListContainer, MkArray<MkPathName>& memberFilePathList,
 unsigned int chunkSizeGuideline, unsigned int percentageForCompressing, bool createNewChunk)
{
	memberFilePathList.Clear();

	MkArray<MkPathName>& relativeFilePathList = filePathListContainer.GetRelativeFilePathList();
	unsigned int startCount = relativeFilePathList.GetSize();
	MK_CHECK(startCount > 0, L"파일 경로 리스트가 비어 " + m_AbsoluteChunkFilePath + L" 청크 파일 구성 불가")
		return false;

	if (createNewChunk)
	{
		MK_CHECK(!chunkFilePath.IsDirectoryPath(), chunkFilePath + L" 청크 파일 경로 오류")
			return false;

		Clear();

		// 새 청크 파일 이름
		m_AbsoluteChunkFilePath.ConvertToRootBasisAbsolutePath(chunkFilePath);
	}

	// 크기 예약
	m_BlockList.Reserve(m_BlockList.GetSize() + startCount);
	memberFilePathList.Reserve(startCount);

	// 인터페이스 생성. createNewChunk에 따라 청크 파일 생성
	MkInterfaceForFileWriting chunkFileInterface;
	if (!chunkFileInterface.SetUp(m_AbsoluteChunkFilePath, createNewChunk))
		return false;

	// 새 청크 파일의 경우 블록 카운트를 기록하기 위한 태그 공간 확보
	if (createNewChunk)
	{
		m_ChunkSize = sizeof(unsigned int);
		_AddCountTag(chunkFileInterface, m_ChunkSize);
	}

	// 뒤에서부터 앞으로 순회
	MK_INDEXING_RLOOP(relativeFilePathList, i)
	{
		const MkPathName& currPath = filePathListContainer.GetRelativeFilePath(i);

		MkFileBlock& currBlock = m_BlockList.PushBack();
		unsigned int blockSize = currBlock.SetUpFromOriginalFileAndAttachToChunkFile
			(filePathListContainer.GetAbsoluteOriginalFilePath(i), currPath, chunkFileInterface, percentageForCompressing, filePathListContainer.GetOuterWrittenTime(i));

		if (blockSize == 0)
		{
			if (createNewChunk)
			{
				m_AbsoluteChunkFilePath.DeleteCurrentFile();
			}
			return false;
		}

		memberFilePathList.PushBack(currPath);

		++m_AvailableBlockCount;

		m_ChunkSize += blockSize;
		if (m_ChunkSize >= chunkSizeGuideline)
			break;
	}

	chunkFileInterface.Clear();

	// 블록 카운트 수정
	MkInterfaceForFileTag<unsigned int> ftInterface;
	if (!ftInterface.SetUp(m_AbsoluteChunkFilePath))
	{
		if (createNewChunk)
		{
			m_AbsoluteChunkFilePath.DeleteCurrentFile();
		}
		return false;
	}

	ftInterface.Overwrite(m_BlockList.GetSize(), 0);
	ftInterface.Clear();

	// 청크에 구성된 파일들을 리스트에서 삭제
	filePathListContainer.PopBack(memberFilePathList.GetSize());
	return true;
}
示例#9
0
void MkImageInfo::SetUp(const MkInt2& imageSize, const MkDataNode* node)
{
	Clear();

	// ready to uv converting
	MkFloat2 fImageSize(static_cast<float>(imageSize.x), static_cast<float>(imageSize.y));

	// empty subset
	Subset& emptySubset = m_Subsets.Create(MkHashStr::EMPTY);
	emptySubset.rectSize = fImageSize;
	emptySubset.uv[MkFloatRect::eLeftTop] = MkFloat2::Zero;
	emptySubset.uv[MkFloatRect::eRightTop] = MkFloat2(1.f, 0.f);
	emptySubset.uv[MkFloatRect::eLeftBottom] = MkFloat2(0.f, 1.f);
	emptySubset.uv[MkFloatRect::eRightBottom] = MkFloat2(1.f, 1.f);

	if (node == NULL)
		return;

	// group
	node->GetDataEx(GROUP_KEY, m_Group, 0);

	// parse nodes
	MkArray<MkHashStr> keyList;
	node->GetChildNodeList(keyList);
	MK_INDEXING_LOOP(keyList, i)
	{
		const MkHashStr& childName = keyList[i];
		const MkDataNode& childNode = *node->GetChildNode(childName);

		do
		{
			// 필수 key로 subset/sequence 종류 판단
			if (childNode.IsValidKey(SIZE_KEY)) // subset
			{
				MkInt2 position;
				childNode.GetData(POSITION_KEY, position, 0);

				MkInt2 size;
				childNode.GetData(SIZE_KEY, size, 0);
				MK_CHECK(size.IsPositive(), childName.GetString() + L" 노드의 " + SIZE_KEY.GetString() + L" 값 오류")
					break;

				MkInt2 table(1, 1);
				childNode.GetData(TABLE_KEY, table, 0);
				MK_CHECK(table.IsPositive(), childName.GetString() + L" 노드의 " + TABLE_KEY.GetString() + L" 값 오류")
					break;

				MkFloat2 fSubsetSize(static_cast<float>(size.x), static_cast<float>(size.y));
				MkFloat2 fUVSize(fSubsetSize.x / fImageSize.x, fSubsetSize.y / fImageSize.y);

				// single subset
				if ((table.x == 1) && (table.y == 1))
				{
					_RegisterSubset(childName, fSubsetSize, position, fImageSize, fUVSize);
				}
				// multi subset
				else
				{
					MkInt2 offset = size;
					childNode.GetData(OFFSET_KEY, offset, 0);

					MkInt2 currPivot = position;
					for (int y = 0; y < table.y; ++y)
					{
						for (int x = 0; x < table.x; ++x)
						{
							_RegisterSubset(childName.GetString() + MkStr(y * table.x + x), fSubsetSize, currPivot, fImageSize, fUVSize);
							currPivot.x += offset.x;
						}
						currPivot.x = position.x;
						currPivot.y += offset.y;
					}
				}
			}
			else if (childNode.IsValidKey(TOTAL_RANGE_KEY) && childNode.IsValidKey(SUBSET_LIST_KEY)) // sequence
			{
				float totalRange = 0.f;
				childNode.GetData(TOTAL_RANGE_KEY, totalRange, 0);
				MK_CHECK(totalRange > 0.f, childName.GetString() + L" 노드의 " + TOTAL_RANGE_KEY.GetString() + L" 값 오류")
					break;

				MkArray<MkHashStr> subsetList;
				childNode.GetDataEx(SUBSET_LIST_KEY, subsetList);
				MK_CHECK(!subsetList.Empty(), childName.GetString() + L" 노드의 " + SUBSET_LIST_KEY.GetString() + L" 값 오류")
					break;

				MkArray<float> timeList;
				childNode.GetData(TIME_LIST_KEY, timeList);

				bool loop = true;
				childNode.GetData(LOOP_KEY, loop, 0);

				// time list 검증 및 자동생성
				if (timeList.Empty())
				{
					timeList.Reserve(subsetList.GetSize());
					float oneFrameTime = totalRange / static_cast<float>(subsetList.GetSize());
					float timeStamp = 0.f;
					MK_INDEXING_LOOP(subsetList, j)
					{
						timeList.PushBack(timeStamp);
						timeStamp += oneFrameTime;
					}
				}