Esempio n. 1
0
    // load boards from save file.
    public void LoadBoard2(string filename, Transform[] board)
    {
        int card_index = 0;

        // access all string arrays in the save file.
        string[] board_data = SaveLoadController.LoadBoard(filename);

        // transfer saved boards into the board selector screen.
        for (int i = 0; i < board_data.Length; i++)
        {
            if (board_data[i] == "Blank2" || board_data[i] == "Blank3")
            {
                board[i].GetComponent <Image>().sprite = Resources.Load <Sprite>("Blank2");
            }
            else
            {
                // search for cards using the string aquired from the save file.
                while (_card_img[card_index].name != board_data[i])
                {
                    card_index++;
                }

                board[i].GetComponent <Image>().sprite = _card_img[card_index];
                card_index = 0;
            }
        }
    }
    // load board from save file to display on the WinInfo screen.
    private void LoadBoard(string filename, Transform[] board)
    {
        string[] _board_data = SaveLoadController.LoadBoard(filename + ".sav");

        // insert cards into board.
        int card_index = 0;

        for (int i = 0; i < _board_data.Length; i++)
        {
            if (_board_data[i] == "Blank2" || _board_data[i] == "Blank3")
            {
                board[i].GetComponent <Image>().sprite = Resources.Load <Sprite>("Blank2");
            }
            else
            {
                while (_board_data[i] != card_img_winInfo[card_index].name)
                {
                    card_index++;
                }
                Debug.Log(i);
                board[i].GetComponent <Image>().sprite = card_img_winInfo[card_index];
                card_index = 0;
            }
        }
    }
Esempio n. 3
0
    // call this if loading the board will affect selected cards on board creation.
    public static void LoadBoards(bool[,] already_picked)
    {
        string[] board_data;
        for (int i = 0; i < boards.Length; i++)
        {
            string filename = "board" + (i + 1) + ".sav";
            board_data       = SaveLoadController.LoadBoard(filename);
            boards[i].isFull = true;

            int card_i = 0;
            if (board_data != null)
            {
                foreach (string cardname in board_data)
                {
                    boards[i].cards[card_i].GetComponent <Image>().sprite = Resources.Load <Sprite>(cardname);
                    if (cardname == "Blank2" || cardname == "Blank3")
                    {
                        boards[i].isFull = false;
                    }
                    //already_picked[ i, dict[cardname] ] = true;

                    card_i++;
                }
            }
            else if (board_data == null)
            {
                boards[i].cards[card_i].GetComponent <Image>().sprite = Resources.Load <Sprite>("Blank2");
                boards[i].isFull = false;
                card_i++;
            }

            //Debug.Log(i + "::" + boards[i].isFull);
        }
    }
Esempio n. 4
0
    // load board on index.
    public static void LoadBoard()
    {
        string filename = "AI" + (index_ai) + "_board.sav";

        string[] board_data = SaveLoadController.LoadBoard(filename);

        int card_i = 0;

        foreach (string cardname in board_data)
        {
            if (board_data != null)
            {
                boards[won_index].cards[card_i].GetComponent <Image>().sprite = Resources.Load <Sprite>(cardname);
            }
            else if (board_data == null)
            {
                boards[won_index].cards[card_i].GetComponent <Image>().sprite = Resources.Load <Sprite>("Blank2");
            }

            card_i++;
        }
    }
Esempio n. 5
0
    // call this if you only need to load cards into the boards without affecting card selectors.
    public static void LoadBoards()
    {
        string[] board_data;
        for (int i = 0; i < boards.Length; i++)
        {
            string filename = "board" + (i + 1) + ".sav";
            board_data = SaveLoadController.LoadBoard(filename);

            int card_i = 0;
            foreach (string cardname in board_data)
            {
                if (board_data != null)
                {
                    boards[i].cards[card_i].GetComponent <Image>().sprite = Resources.Load <Sprite>(cardname);
                }
                else if (board_data == null)
                {
                    boards[i].cards[card_i].GetComponent <Image>().sprite = Resources.Load <Sprite>("Blank2");
                }

                card_i++;
            }
        }
    }