Ejemplo n.º 1
0
    public void stairDraw(int x, int y, int z, int num)
    {
        board_data_list.Clear();
        for (int j = 0; j < 60; j++)
        {
            for (int i = 0; i < 20; i++)
            {
                int height;
                int stairCount = 0;
                if ((i < (9.5 - z)) || ((9.5 + z) < i))
                {
                    height = 0;
                }
                else
                {
                    if (j > x)
                    {
                        height = y;
                    }
                    else
                    {
                        for (int p = 0; p < 10; p++)
                        {
                            if (positionOfStep(x, num, p) <= j && j < positionOfStep(x, num, p + 1))
                            {
                                stairCount = p;
                            }
                        }
                        height = sumOfStep(y, num, stairCount);
                    }
                }

                board_data_list.Add(new Pin_Data(i, j, height));
            }
        }
        BoardData = new Board_Data(20, 60, board_data_list);

        string JsonBoardData = JsonConvert.SerializeObject(BoardData, setting);

        File.WriteAllText(Application.dataPath + "/Resources/MatrixData/currentMatrix.json", JsonBoardData);
    }
Ejemplo n.º 2
0
    public void resetBoard()
    {
        JsonSerializerSettings setting = new JsonSerializerSettings();

        setting.Formatting            = Formatting.Indented;
        setting.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
        Board_Data      resetBoardData;
        List <Pin_Data> reset_board_data_list = new List <Pin_Data>();

        for (int j = 0; j < mapLength; j++)
        {
            for (int i = 0; i < mapWidth; i++)
            {
                reset_board_data_list.Add(new Pin_Data(i, j, 1));
            }
        }
        resetBoardData = new Board_Data(mapWidth, mapLength, reset_board_data_list);
        string  JsonBoardData = JsonConvert.SerializeObject(resetBoardData, setting);
        JObject jobj          = JObject.Parse(JsonBoardData);

        sendToQueue(jobj);
    }
Ejemplo n.º 3
0
 public void updateNextMatrix(JObject jobj)
 {
     nextBoardData = new Board_Data(mapWidth, mapLength, new List <Pin_Data>());
     nextBoardData.JObjectTOTotalData(jobj);
     nextPlay = true;
 }
Ejemplo n.º 4
0
 public void firstMatrix(JObject jobj)
 {
     totalBoardData = new Board_Data(mapWidth, mapLength, new List <Pin_Data>());
     totalBoardData.JObjectTOTotalData(jobj);
 }