Init
This commit is contained in:
100
Assets/MindPowerSdk/Map/MPActiveMapSection.cs
Normal file
100
Assets/MindPowerSdk/Map/MPActiveMapSection.cs
Normal file
@ -0,0 +1,100 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MindPowerSdk
|
||||
{
|
||||
/// <summary>
|
||||
/// 单一贴图层
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct MPTileTex
|
||||
{
|
||||
public byte TexNo; // 贴图编号
|
||||
public byte AlphaNo; // Alpha图编号
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{TexNo},{AlphaNo}";
|
||||
}
|
||||
|
||||
public byte SetAlphaNo(byte alphaNo, bool reset = false)
|
||||
{
|
||||
if (reset)
|
||||
{
|
||||
this.AlphaNo = alphaNo;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.AlphaNo |= alphaNo;
|
||||
}
|
||||
|
||||
return alphaNo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
MPTileTex TexLayer[4]; // 最多4层重叠
|
||||
DWORD dwColor; // 左上角第一个顶点的颜色
|
||||
short sRegion; // 区域属性
|
||||
BYTE btIsland; // 岛屿属性
|
||||
BYTE btBlock[4]; // 4个分格的障碍记录
|
||||
|
||||
float fHeight; // 左上角第一个顶点的高度
|
||||
|
||||
//lemon add@2004.10.18
|
||||
DWORD dwTColor; // 临时顶点的颜色
|
||||
DWORD dwXColor; // 混合后的颜色
|
||||
*
|
||||
*/
|
||||
public unsafe struct MPTile
|
||||
{
|
||||
public MPTileTex[] TexLayer; // 最多4层重叠
|
||||
public short Color; // 左上角第一个顶点的颜色
|
||||
public short Region; // 区域属性
|
||||
public byte IsLand; // 岛屿属性
|
||||
public fixed byte Block[4]; // 4个分格的障碍记录
|
||||
|
||||
public float Height; // 左上角第一个顶点的高度
|
||||
|
||||
public int TColor; // 临时顶点颜色
|
||||
public int XColor; // 混合后的颜色
|
||||
|
||||
|
||||
public Color UniColor;
|
||||
|
||||
public void TileInfo_5To8(byte bt, uint dwNew)
|
||||
{
|
||||
byte* pbtTile = stackalloc byte[8];
|
||||
|
||||
pbtTile[0] = bt;
|
||||
pbtTile[1] = 15;
|
||||
pbtTile[2] = (byte)(dwNew >> 26);
|
||||
pbtTile[3] = (byte)((dwNew >> 22) & 0x000F);
|
||||
pbtTile[4] = (byte)((dwNew >> 16) & 63);
|
||||
pbtTile[5] = (byte)((dwNew >> 12) & 0x000F);
|
||||
pbtTile[6] = (byte)((dwNew >> 6) & 63);
|
||||
pbtTile[7] = (byte)((dwNew >> 2) & 0x000F);
|
||||
|
||||
this.TexLayer = new MPTileTex[4];
|
||||
for (int i = 0; i < 8; i += 2)
|
||||
{
|
||||
this.TexLayer[i / 2].TexNo = pbtTile[i];
|
||||
this.TexLayer[i / 2].AlphaNo = pbtTile[i + 1];
|
||||
}
|
||||
|
||||
//Debug.Log($"{TexLayer[0]}|{TexLayer[1]}|{TexLayer[2]}|{TexLayer[3]}");
|
||||
}
|
||||
}
|
||||
|
||||
public struct MPActiveMapSection
|
||||
{
|
||||
public MPTile[] TileData;
|
||||
public int X, Y; // MapSection所在的位置
|
||||
public int ActiveTime; // 最后一次使用的时间
|
||||
public int DataOffset; // 文件数据指针位置 = 0, 表示没有数据
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user