Ejemplo n.º 1
0
    private void Awake()
    {
        m_ItemCsv = CsvLoader.LoadCsvBy2DimensionArray("Csv/Item_Table");

        int i = 0;

        for (int j = 0; i < m_LampItemCells.Length; ++i, ++j)
        {
            m_LampItemCells[j].Initialize(m_LampSprites[j], ItemCategory.LAMP, j, m_ItemCsv[i + 1, 2], int.Parse(m_ItemCsv[i + 1, 8]), DataManager.GetHaveItem(ItemCategory.LAMP, j));
            m_LampItemCells[j].m_OnClickedEvent.AddListener(OnStoreItemCellClicked);
        }

        for (int j = 0; i < m_LampItemCells.Length + m_NutrientsItemCells.Length; ++i, ++j)
        {
            m_NutrientsItemCells[j].Initialize(m_NutrientsSprites[j], ItemCategory.NUTRIENTS, j, m_ItemCsv[i + 1, 2], int.Parse(m_ItemCsv[i + 1, 8]), DataManager.GetHaveItem(ItemCategory.NUTRIENTS, j));
            m_NutrientsItemCells[j].m_OnClickedEvent.AddListener(OnStoreItemCellClicked);
        }

        for (int j = 0; i < m_LampItemCells.Length + m_NutrientsItemCells.Length + m_SprinklerItemCells.Length; ++i, ++j)
        {
            m_SprinklerItemCells[j].Initialize(m_SprinklerSprites[j], ItemCategory.SPRINKLER, j, m_ItemCsv[i + 1, 2], int.Parse(m_ItemCsv[i + 1, 8]), DataManager.GetHaveItem(ItemCategory.SPRINKLER, j));
            m_SprinklerItemCells[j].m_OnClickedEvent.AddListener(OnStoreItemCellClicked);
        }

        for (int j = 0; i < m_LampItemCells.Length + m_NutrientsItemCells.Length + m_SprinklerItemCells.Length + m_ETCItemCells.Length; ++i, ++j)
        {
            m_ETCItemCells[j].Initialize(m_ETCSprites[j], ItemCategory.ETC, j, m_ItemCsv[i + 1, 2], int.Parse(m_ItemCsv[i + 1, 8]), true);
            m_ETCItemCells[j].m_OnClickedEvent.AddListener(OnStoreItemCellClicked);
        }
    }
Ejemplo n.º 2
0
    static ItemInfoDictionary()
    {
        string[,] ArmorArray  = CsvLoader.LoadCsvBy2DimensionArray("Csv/DataTable_Item_CK_Armor");
        string[,] WeaponArray = CsvLoader.LoadCsvBy2DimensionArray("Csv/DataTable_Item_CK_Weapon");

        for (int i = 2; i < WeaponArray.GetLength(0); ++i)
        {
            Weapon temp = new Weapon(
                int.Parse(WeaponArray[i, (int)(Weapon.WeaponAttribute.ID)]),
                WeaponArray[i, (int)(Weapon.WeaponAttribute.Name)],
                int.Parse(WeaponArray[i, (int)(Weapon.WeaponAttribute.Require_Level)]),
                WeaponArray[i, (int)(Weapon.WeaponAttribute.Image_File)],
                int.Parse(WeaponArray[i, (int)(Weapon.WeaponAttribute.S_Dmg)]),
                int.Parse(WeaponArray[i, (int)(Weapon.WeaponAttribute.S_Agi)]),
                int.Parse(WeaponArray[i, (int)(Weapon.WeaponAttribute.Cri)]),
                int.Parse(WeaponArray[i, (int)(Weapon.WeaponAttribute.CriDmg)]),
                int.Parse(WeaponArray[i, (int)(Weapon.WeaponAttribute.S_Str)]),
                int.Parse(WeaponArray[i, (int)(Weapon.WeaponAttribute.S_Dex)])
                );
            WeaponDictionary.Add(temp.M_ID, temp);
        }

        for (int i = 2; i < ArmorArray.GetLength(0); ++i)
        {
            Armor temp = new Armor(
                int.Parse(ArmorArray[i, (int)(Armor.ArmorAttribute.ID)]),
                ArmorArray[i, (int)(Armor.ArmorAttribute.Name)],
                int.Parse(ArmorArray[i, (int)(Armor.ArmorAttribute.Require_Level)]),
                ArmorArray[i, (int)(Armor.ArmorAttribute.Image_File)],
                int.Parse(ArmorArray[i, (int)(Armor.ArmorAttribute.S_HP)]),
                int.Parse(ArmorArray[i, (int)(Armor.ArmorAttribute.S_Def)]),
                int.Parse(ArmorArray[i, (int)(Armor.ArmorAttribute.S_Will)]),
                int.Parse(ArmorArray[i, (int)(Armor.ArmorAttribute.S_Str)]),
                int.Parse(ArmorArray[i, (int)(Armor.ArmorAttribute.S_Dex)])
                );

            ArmorDictionary.Add(temp.M_ID, temp);
        }
    }
Ejemplo n.º 3
0
 private void Awake()
 {
     m_CharacterInfoCsv = CsvLoader.LoadCsvBy2DimensionArray("Csv/NPC_Table");
 }
Ejemplo n.º 4
0
 private void Awake()
 {
     m_PlantCsv = CsvLoader.LoadCsvBy2DimensionArray("Csv/PlantMasterTable");
 }
Ejemplo n.º 5
0
    // Start is called before the first frame update
    void Start()
    {
        string[,] result = CsvLoader.LoadCsvBy2DimensionArray("Csv/My_Paradise_Shop");

        int[] ElementCnt = { 0, 0, 0, 0 };
        int   select     = 0;

        for (int i = 0; i < result.GetLength(0); ++i)
        {
            if (result[i, 0] == "거실")
            {
                select = 0;
            }
            else if (result[i, 0] == "주방")
            {
                select = 1;
            }
            else if (result[i, 0] == "침실")
            {
                select = 2;
            }
            else if (result[i, 0] == "욕실")
            {
                select = 3;
            }


            if (int.TryParse(result[i, 7], out int s))
            {
                GameObject go = Instantiate(ShopElement, ScrollRect[select].content.transform);
                go.GetComponent <RectTransform>().anchoredPosition = new Vector3(0, -Gap * ElementCnt[select], 0);

                if (Resources.Load("Tile/Furniture/" + result[i, 3]) is Tile)
                {
                    List <Tile> tiles = new List <Tile>();
                    for (int j = 3; j < 7; ++j)
                    {
                        if (Resources.Load("Tile/Furniture/" + result[i, j]) is Tile)
                        {
                            tiles.Add(Resources.Load("Tile/Furniture/" + result[i, j]) as Tile);
                        }
                        else
                        {
                            break;
                        }
                    }
                    go.GetComponent <ShopElement>().SetElement(result[i, 2], s,
                                                               FurnitureItem.StringToItemTheme(result[i, 0]),
                                                               FurnitureItem.StringToItemCategory(result[i, 1]),
                                                               tiles.ToArray());
                }
                else
                {
                    Debug.Log(result[i, 3] + ": Can't loading");
                }
                ++ElementCnt[select];
            }
        }
        for (int i = 0; i < 4; ++i)
        {
            ScrollRect[i].content.GetComponent <RectTransform>().sizeDelta = new Vector2(ScrollRect[i].content.GetComponent <RectTransform>().sizeDelta.x, Gap * ElementCnt[i]);
        }
    }