Пример #1
0
    public void RandomStock()
    {
        ClearAll();
        string[] files = Directory.GetFiles(Application.dataPath + "/Data/stocks",
                                            "*.csv", SearchOption.AllDirectories);
        string randomStock = files[new System.Random().Next(0, files.Length - 1)];

        var stockPriceReader = new StockPriceReader();

        stockPriceReaderModel = stockPriceReader.ParsePrices(randomStock);
        stockText.text        = stockPriceReaderModel.name;

        int numAdd = 30;

        AddPrices(stockPriceReaderModel.prices.GetRange(currentIndex, numAdd));
        currentIndex += numAdd;
        UpdateCameraPosition();
    }
Пример #2
0
    public void OpenStock()
    {
        string extensions = "csv";
        string path       = FileBrowser.OpenSingleFile("Open File", "", extensions);

        if (path != "")
        {
            ClearAll();
            var stockPriceReader = new StockPriceReader();
            stockPriceReaderModel = stockPriceReader.ParsePrices(path);
            stockText.text        = stockPriceReaderModel.name;

            int numAdd = 30;
            AddPrices(stockPriceReaderModel.prices.GetRange(currentIndex, numAdd));
            currentIndex += numAdd;

            UpdateCameraPosition();
        }
        EventSystem.current.SetSelectedGameObject(null);
    }