Beispiel #1
0
 public BaseRoleInfo(InfoNode vi)
 {
     RoleID     = vi.GetValueInt("ID");
     Name       = vi.GetValue("NAME");
     PrefabName = vi.GetValue("PREFABNAME");
     Sex        = vi.GetValueInt("SEX");
     MaxHp      = vi.GetValueInt("MAXHP");
     Attack     = vi.GetValueInt("ATTACK");
     Width      = vi.GetValueFloat("WIDTH");
     Height     = vi.GetValueFloat("HEIGHT");
     VelocityX  = vi.GetValueFloat("VELX");
     VelocityY  = vi.GetValueFloat("VELY");
     BaseInfo   = vi;
 }
Beispiel #2
0
 public MapDataNode(InfoNode node)
 {
     ID           = node.GetValueInt("ID");
     Name         = node.GetValue("NAME");
     Type         = (eMapAreaType)node.GetValueInt("TYPE");
     ScaleRatio   = node.GetValueFloat("SCALERATIO");
     SmallMapName = node.GetValue("SMALLMAP");
     MapMusicName = node.GetValue("BGM");
     MapAreaMinX  = node.GetValueFloat("MINX");
     MapAreaMaxX  = node.GetValueFloat("MAXX");
     MapAreaMinY  = node.GetValueFloat("MINY");
     MapAreaMaxY  = node.GetValueFloat("MAXY");
     MoodDecrease = node.GetValueFloat("MOODDEC");
     InitPosX     = node.GetValueFloat("INITPOSX");
     InitPosY     = node.GetValueFloat("INITPOSY");
     Width        = (int)(MapAreaMaxX - MapAreaMinX) + 1;
     Height       = (int)(MapAreaMaxY - MapAreaMinY) + 1;
 }
Beispiel #3
0
    public ColliderDataNode(InfoNode node)
    {
        name           = node.GetValue("NAME");
        bodyType       = node.GetValueInt("BODYTTYPE");
        bodyCreateType = node.GetValueInt("CREATETYPE");
        string posStr = node.GetValue("POSITION");

        if (!string.IsNullOrEmpty(posStr))
        {
            string[] posArr = posStr.Split(';');
            if (posArr.Length > 1)
            {
                position = new Vector2(float.Parse(posArr[0]), float.Parse(posArr[1]));
            }
        }
        sizeX  = node.GetValueFloat("SIZEX");
        sizeY  = node.GetValueFloat("SIZEY");
        radius = node.GetValueFloat("RADIUS");
        if (bodyCreateType == (int)eBodyCreateType.Polygon)
        {
            string verticesStr = node.GetValue("VERTICES");
            if (!string.IsNullOrEmpty(verticesStr))
            {
                string[] verticesArr = verticesStr.Split('=');
                if (verticesArr.Length > 0)
                {
                    vertices = new List <Vector2>();
                    for (int i = 0; i < verticesArr.Length; i++)
                    {
                        string   verticeStr = verticesArr[i];
                        string[] verticeArr = verticeStr.Split(';');
                        if (verticeArr.Length > 1)
                        {
                            Vector2 vertice = new Vector2(float.Parse(verticeArr[0]), float.Parse(verticeArr[1]));
                            vertices.Add(vertice);
                        }
                    }
                }
            }
        }
        else if (bodyCreateType == (int)eBodyCreateType.Edge)
        {
            string startPosStr = node.GetValue("STARTPOS");
            if (!string.IsNullOrEmpty(startPosStr))
            {
                string[] startPosArr = startPosStr.Split(';');
                if (startPosArr.Length > 1)
                {
                    startPos = new Vector2(float.Parse(startPosArr[0]), float.Parse(startPosArr[1]));
                }
            }
            string endPosStr = node.GetValue("ENDPOS");
            if (!string.IsNullOrEmpty(endPosStr))
            {
                string[] endPosArr = endPosStr.Split(';');
                if (endPosArr.Length > 1)
                {
                    endPos = new Vector2(float.Parse(endPosArr[0]), float.Parse(endPosArr[1]));
                }
            }
        }

        isBreakable   = node.GetValueBool("ISBREAKABLE");
        breakMainName = node.GetValue("BREAKMAINNAME");
        filterType    = node.GetValueInt("FILTERTYPE");
        isActive      = node.GetValueBool("ISACTIVE");

        isSensor   = node.GetValueBool("ISSENSOR");
        speedRatio = node.GetValueFloat("SPEEDRATIO");
        isOneWay   = node.GetValueBool("ISONEWAY");
        string oneWayDirStr = node.GetValue("ONEWAYDIR");

        if (!string.IsNullOrEmpty(oneWayDirStr))
        {
            string[] arr = oneWayDirStr.Split(';');
            if (arr.Length > 1)
            {
                oneWayDir = new Vector2(float.Parse(arr[0]), float.Parse(arr[1]));
            }
        }
        isStuckDir = node.GetValueBool("ISSTUCKDIR");
        string forceDirStr = node.GetValue("FORCEDOR");

        if (!string.IsNullOrEmpty(forceDirStr))
        {
            string[] arr = forceDirStr.Split(';');
            if (arr.Length > 1)
            {
                forceDir = new Vector2(float.Parse(arr[0]), float.Parse(arr[1]));
            }
        }
    }