示例#1
0
    public void LoadGameData(string dataFile)
    {
        //------------------------------ PROVISIONAL--------------------//
        //dataFile = "D2Config";

        //-------------------------------------------------------------//

        TextAsset lvlData = Resources.Load <TextAsset>(dataFile);

        string[] data = lvlData.text.Split(new char[] { '\n' });
        for (int i = 1; i < data.Length - 1; i++)
        {
            string[] row = data[i].Split(new char[] { ';' });

            if (dataFile == "STROOPConfig")
            {
                STROOPData game = new STROOPData();
                if (row[1] != "")
                {
                    int.TryParse(row[0], out game.lvl);
                    for (int x = 1; x < row.Length; x++)
                    {
                        game.dataValues[x - 1] = row[x];
                    }
                }

                levelsStroop.Add(game);
            }
            else
            {
                if (dataFile == "D2Config")
                {
                    D2Data gameD2 = new D2Data();
                    if (row[1] != "")
                    {
                        int.TryParse(row[0], out gameD2.lvl);
                        for (int x = 1; x < row.Length; x++)
                        {
                            gameD2.dataValues[x - 1] = row[x];
                            // print(row[x]);
                        }
                    }
                    levels.Add(gameD2);
                }
                if (dataFile == "SombrasConfig")
                {
                    //////SEGUIR AQUI
                    //print("Cargar fichero configuracion figuras");
                }
            }
        }
        if (dataFile == "STROOPConfig")
        {
            this.gameObject.GetComponentInChildren <STROOP_GenerateLvl>().LevelToGenerate(0);
        }
    }
 public static byte[] Build(D2Data.UnitType type, uint uid, byte movementtype, int targetX, int targetY, byte unknown12, int currentX, int currentY)
 {
     byte[] buffer = {0x0F,(byte)type,
                         (byte)uid,(byte)(uid>>8),(byte)(uid>>16),(byte)(uid>>24),
                         (byte)movementtype,
                         (byte)targetX,(byte)(targetX >>8),
                         (byte)targetY,(byte)(targetY >>8),
                         unknown12,
                         (byte)currentX,(byte)(currentX >>8),
                         (byte)currentY,(byte)(currentY >>8)
                     };
     return buffer;
 }
 public PlayerMove(D2Data.UnitType type, uint uid, byte movementtype, int targetX, int targetY, byte unknown12, int currentX, int currentY)
     : base(Build(type,uid,movementtype,targetX,targetY,unknown12,currentX,currentY ))
 {
     this.currentX =currentX;
     this.currentY = currentY;
     this.movementType = movementtype;
     this.targetX = targetX;
     this.targetY = targetY;
     this.uid = uid;
     this.unitType = type;
     this.unknown12 = unknown12;
 }