示例#1
0
    public void SetItem()
    {
        if (SceneManager.GetActiveScene().name == "FirstDungeonScene")
        {
            List <Dictionary <string, object> > data = CSVReaderScript.Read("FirstBossItem_table");
            Bossname.text = "FirstBoss";
            Icon.transform.GetComponent <Image>().sprite = Dropitemicon[0];
            Itemname.text    = data[0]["Name"].ToString();
            Description.text = "가치: " + data[0]["Value"].ToString() + "    " + "종류: " + data[0]["Kind"].ToString() + "\n" + data[0]["Description"].ToString();
            First            = new Item(Dropitemicon[0], false, int.Parse(data[0]["Kind"].ToString()), data[0]["Name"].ToString(), int.Parse(data[0]["Value"].ToString()), 0f, 0f, 0f, 0, data[0]["Description"].ToString());
        }

        else if (SceneManager.GetActiveScene().name == "SecondDungeonScene")
        {
            List <Dictionary <string, object> > data = CSVReaderScript.Read("SecondBossItem_table");
            Bossname.text = "SecondBoss";
            Icon.transform.GetComponent <Image>().sprite = Dropitemicon[1];
            Itemname.text    = data[0]["Name"].ToString();
            Description.text = "가치: " + data[0]["Value"].ToString() + "    " + "종류: " + data[0]["Kind"].ToString() + "\n" + data[0]["Description"].ToString();
            Second           = new Item(Dropitemicon[1], false, int.Parse(data[0]["Kind"].ToString()), data[0]["Name"].ToString(), int.Parse(data[0]["Value"].ToString()), 0f, 0f, 0f, 0, data[0]["Description"].ToString());
        }

        else if (SceneManager.GetActiveScene().name == "ThirdDungeonScene")
        {
            List <Dictionary <string, object> > data = CSVReaderScript.Read("ThirdBossItem_table");
            Bossname.text = "ThirdBoss";
            Icon.transform.GetComponent <Image>().sprite = Dropitemicon[2];
            Itemname.text    = data[0]["Name"].ToString();
            Description.text = "가치: " + data[0]["Value"].ToString() + "    " + "종류: " + data[0]["Kind"].ToString() + "\n" + data[0]["Description"].ToString();
            Third            = new Item(Dropitemicon[2], false, int.Parse(data[0]["Kind"].ToString()), data[0]["Name"].ToString(), int.Parse(data[0]["Value"].ToString()), 0f, 0f, 0f, 0, data[0]["Description"].ToString());
        }
    }
示例#2
0
    void Start()
    {
        List <Dictionary <string, object> > data = CSVReaderScript.Read("weapon_table");

        for (var i = 0; i < data.Count; i++)
        {
            if (data[i]["Name"] != null)
            {
                Debug.Log("생성");
                input_temp = Instantiate(itemblock_prefeb, itemblock_parents.transform);
                input_temp.transform.GetChild(1).GetComponent <Text>().text = data[i]["Name"].ToString() + "\n 가치 :" + data[i]["Value"].ToString();
                input_temp.transform.GetChild(2).GetComponent <Text>().text = "공격력: " + data[i]["Damage"].ToString() + "\n" + "공격 속도: " + data[i]["Speed"].ToString();
                itemlist.Add(input_temp);
            }
        }

        this.gameObject.SetActive(false);
    }
    void Start()
    {
        List <Dictionary <string, object> > data = CSVReaderScript.Read("armor_table");

        if (itemblock_parents)
        {
            for (var i = 0; i < data.Count; i++)
            {
                if (data[i]["Name"] != null)
                {
                    input_temp = Instantiate(itemblock_prefeb, itemblock_parents.transform);
                    input_temp.transform.GetChild(1).GetComponent <Text>().text =
                        data[i]["Name"].ToString() + "\n 가치 :" + data[i]["Value"].ToString();
                    input_temp.transform.GetChild(2).GetComponent <Text>().text =
                        "방어력: " + data[i]["Defense"].ToString() + "\n" + "무게: " + data[i]["Weight"].ToString();

                    if (data[i]["Name"].ToString() == "1단계 방어구")
                    {
                        input_temp.transform.GetChild(0).GetComponent <Image>().sprite = itemicon[0];
                        input_temp.transform.GetComponent <Item>().image = itemicon[0];
                    }
                    else if (data[i]["Name"].ToString() == "2단계 방어구")
                    {
                        input_temp.transform.GetChild(0).GetComponent <Image>().sprite = itemicon[1];
                        input_temp.transform.GetComponent <Item>().image = itemicon[1];
                    }
                    else if (data[i]["Name"].ToString() == "3단계 방어구")
                    {
                        input_temp.transform.GetChild(0).GetComponent <Image>().sprite = itemicon[2];
                        input_temp.transform.GetComponent <Item>().image = itemicon[2];
                    }

                    input_temp.transform.GetComponent <Item>().name        = data[i]["Name"].ToString();
                    input_temp.transform.GetComponent <Item>().kind        = 1;
                    input_temp.transform.GetComponent <Item>().num         = 1;
                    input_temp.transform.GetComponent <Item>().armor       = float.Parse(data[i]["Defense"].ToString());
                    input_temp.transform.GetComponent <Item>().value       = int.Parse(data[i]["Value"].ToString());
                    input_temp.transform.GetComponent <Item>().description = data[i]["Description"].ToString();

                    itemlist.Add(input_temp);
                }
            }
        }
    }
    void Start()
    {
        MGR = new ManagerSingleton();
        UI  = new UISingleton();

        List <Dictionary <string, object> > data = CSVReaderScript.Read("potion_table");

        if (itemblock_parents)
        {
            for (var i = 0; i < data.Count; i++)
            {
                if (data[i]["Name"] != null)
                {
                    input_temp = Instantiate(itemblock_prefeb, itemblock_parents.transform);
                    input_temp.transform.GetChild(1).GetComponent <Text>().text =
                        data[i]["Name"].ToString() + "\n 가치 :" + data[i]["Value"].ToString();
                    input_temp.transform.GetChild(2).GetComponent <Text>().text =
                        "종류: " + data[i]["Kind"].ToString() + "\n" + "회복량: " + data[i]["Increase"].ToString();

                    if (data[i]["Kind"].ToString() == "HP")
                    {
                        input_temp.transform.GetChild(0).GetComponent <Image>().sprite = HPIMAGE;
                        kind     = 3;
                        value    = int.Parse(data[i]["Value"].ToString());
                        increase = float.Parse(data[i]["Increase"].ToString());
                        desc     = data[i]["Description"].ToString();
                        Item temp = new Item(HPIMAGE, true, kind, "HP포션", value, increase, 0, 0, 1, desc);
                        ItemList.Add(temp);
                    }
                    else if (data[i]["Kind"].ToString() == "MP")
                    {
                        input_temp.transform.GetChild(0).GetComponent <Image>().sprite = MPIMAGE;
                        kind     = 4;
                        value    = int.Parse(data[i]["Value"].ToString());
                        increase = float.Parse(data[i]["Increase"].ToString());
                        desc     = data[i]["Description"].ToString();
                        Item temp = new Item(HPIMAGE, true, kind, "MP포션", value, increase, 0, 0, 1, desc);
                        ItemList.Add(temp);
                    }
                }
            }
        }
    }