private void _ShowMainMenu() { // Create main menu stuff CToolkitUI ui = CGame.ToolkitUI; CJSONParser json = new CJSONParser(); CJSONValue levelArray = json.Parse(CGame.DataDirectory + "campaign.txt"); GameObject button; if (levelArray != null) { int levelCount = 0; for (int i = 0; i < levelArray.GetCount(); ++i) { CJSONValue level = levelArray[i]; string levelName = level.GetString("name", "unknown"); string assetName = level.GetString("asset", "unknown"); bool playable = level.GetBool("playable"); bool visible = level.GetBool("visible"); if (visible) { button = ui.CreateMenuButton(_base, levelName + " (" + assetName + ".pwa)", () => { CGame.UIManager.PlaySound(CGame.PrimaryResources.AudioClips[15]); _PlayLevel(assetName); }, 1, playable); ui.SetTransform(button, 50, -100 - (levelCount++ *30), 512, 50); } } } /* * button = CreateButton(_base, "Sample (cutscene)", null); * ui.SetTransform(button, 50, -150, 256, 50); */ /* * button = CreateButton(_base, "Multiplayer", null); * ui.SetTransform(button, 50, -200, 256, 50); * * button = CreateButton(_base, "Options", null); * ui.SetTransform(button, 50, -250, 256, 50); */ button = ui.CreateMenuButton(_base, "Quit", _Exit); ui.SetTransform(button, 50, -30, 256, 50); }