Exemple #1
0
    /// <summary>
    /// Start関数の実行順が不定のためProductRegisterクラスのStart関数が実行されるのを待つ
    /// </summary>
    /// <returns></returns>
    IEnumerator Wait()
    {
        while (true)
        {
            if (productRegister.getProductDatas().Count > 0)
            {
                break;
            }

            yield return(null);
        }

        foreach (string key in productRegister.getProductDatas().Keys)
        {
            StartCoroutine(SellProduct(key));
        }
    }
    void SetStatusText()
    {
        productRegister.getProductDatas();

        Dictionary <string, int> stockCount = productRegister.getNumberOfProducts();
        List <string>            stockName  = new List <string>();
        List <int> stockNum = new List <int>();

        foreach (var stock in stockCount)
        {
            stockName.Add(stock.Key);
            stockNum.Add(stock.Value);
        }

        for (int i = 0; i < stockCount.Count; i++)
        {
            this.stockName[i].text = stockName[i] + "個";
            this.stockNum[i].text  = stockNum[i].ToString() + "個";
        }

        maintenanceCost.text = factoryManager.PayMaintenance().ToString();

        Dictionary <string, int> productCount = factoryManager.Make();
        List <string>            proName      = new List <string>();
        List <int> proNum = new List <int>();

        foreach (var pro in productCount)
        {
            proName.Add(pro.Key);
            proNum.Add(pro.Value);
        }

        for (int i = 0; i < productCount.Count; i++)
        {
            productName[i].text = proName[i] + "個";
            productNum[i].text  = proNum[i].ToString() + "個";
        }
    }