Пример #1
0
        void DrawFileSwitch(Rect rect)
        {
            if (thisSystemIsReady)
            {
                IPlayerDataManager playerDataManager = playerDataManagerAdaptor.GetPlayerDataManager();

                string[] filePaths = playerDataManager.GetFilePaths();

                string[] buttonTexts           = CreateFilesNameArray(filePaths);
                int      prevSelectedFileIndex = thisSelectedFileIndex;
                thisSelectedFileIndex = GUI.SelectionGrid(
                    rect,
                    thisSelectedFileIndex,
                    buttonTexts,
                    filePaths.Length
                    );
                if (thisSelectedFileIndex > filePaths.Length - 1)
                {
                    thisSelectedFileIndex = filePaths.Length - 1;
                }

                if (thisSelectedFileIndex != prevSelectedFileIndex)
                {
                    playerDataManager.SetFileIndex(thisSelectedFileIndex);
                }
                prevSelectedFileIndex = thisSelectedFileIndex;
            }
            else
            {
                GUI.Box(
                    rect,
                    "ready the system to load files"
                    );
            }
        }