コード例 #1
0
ファイル: ChorusTweak.cs プロジェクト: joosthoi1/Joost-tweaks
 void OnGUI()
 {
     if (chorusEnabled)
     {
         if (textFieldStyle == null)
         {
             textFieldStyle = new GUIStyle(GUI.skin.textField);
         }
         if (showArchiveError)
         {
             GUI.Box(new Rect(Screen.width / 3, Screen.height / 3, Screen.width / 4, Screen.height / 5), "Warning!");
             GUI.Label(new Rect(Screen.width / 3, (float)Screen.height * (3.0f / 8.0f), Screen.width / 4, Screen.height / 4), $"Archive files not currently supported, please unpack it manually at {archiveLocation}");
             if (GUI.Button(new Rect(Screen.width / 3 + Screen.width / 8, (float)Screen.height / 2, 40, 20), "Ok"))
             {
                 showArchiveError = false;
             }
         }
         textFieldStyle.fontSize = Screen.height / 54;
         //UpdateButton(new Rect((float)Screen.width/1.47f,(float)Screen.height*(1.0f/8.0f)+ (float)Screen.height * (1.0f / 20.0f)-15, 120,30), "Advanced Search", () => x(2));
         //UpdateButton(new Rect((float)Screen.width/1.30f,(float)Screen.height*(1.0f/8.0f)+ (float)Screen.height * (1.0f / 20.0f)-15, 120,30), "Randomizer", () => x(2));
         GUI.SetNextControlName("TextField");
         textFieldString = GUI.TextField(new Rect((float)Screen.width / 3, (float)Screen.height * (1.0f / 8.0f) + (float)Screen.height * (1.0f / 20.0f) - Screen.height / 72, (float)Screen.width / 3.0f, Screen.height / 36), textFieldString, textFieldStyle);
         if (Event.current.type == EventType.KeyUp && Event.current.keyCode == KeyCode.Return && GUI.GetNameOfFocusedControl() == "TextField")
         {
             DestroyScrollContent();
             chorusResults = ChorusAPI.CSearch(search: textFieldString);
             createScrollContent();
         }
         //Debug.Log(GUI.GetNameOfFocusedControl());
         scrollPosition = GUI.BeginScrollView(new Rect(Screen.width / 4, Screen.height / 4, Screen.width / 4 * 2, Screen.height / 4 * 2), scrollPosition, new Rect(0, 0, Screen.width / 4 * 2 - 20, Screen.height / 10 * chorusResults.songs.Count), false, true);
         GUI.EndScrollView();
     }
 }
コード例 #2
0
ファイル: ChorusTweak.cs プロジェクト: joosthoi1/Joost-tweaks
 void createScrollContent()
 {
     for (int i = 0; i < chorusResults.songs.Count; i++)
     {
         int index = i;
         contentImage.Add(CreateImage(canvasTransform, "contentImage", 1));
         contentDownload.Add(CreateTextButton(contentImage[i].transform, "downloadButton", uiFont, 0, new Color32(204, 144, 144, 255), new Color32(204, 144, 144, 255)));
         contentDownload[i].GetComponent <Button>().onClick.AddListener(() => ChorusAPI.DownloadFile(chorusResults.songs[index].directLinks, chorusResults.songs[index].name, this));
         songName.Add(CreateLabel(contentImage[i].transform, "songName", uiFont, 0));
         songAlbum.Add(CreateLabel(contentImage[i].transform, "songAlbum", uiFont, 0));
         songArtist.Add(CreateLabel(contentImage[i].transform, "songArtist", uiFont, 0));
         songTime.Add(CreateLabel(contentImage[i].transform, "songTime", uiFont, 0));
     }
 }
コード例 #3
0
ファイル: ChorusTweak.cs プロジェクト: joosthoi1/Joost-tweaks
 void CreateChorus()
 {
     chorusResults       = ChorusAPI.CSearch(type: 1);
     BackgroundImg       = CreateImage(canvasTransform, "background", 0);
     headerBackgroundImg = CreateImage(canvasTransform, "headerbackground", 2);
     footerForegroundImg = CreateImage(canvasTransform, "footerForeground", 2);
     headerForegroundImg = CreateImage(canvasTransform, "headerForeground", 4);
     chorusText          = CreateLabel(canvasTransform, "chorusLabel", uiFont, 5);
     chorusText.GetComponent <Text>().alignment = TextAnchor.MiddleLeft;
     //CreateButton();
     advButton  = CreateTextButton(headerForegroundImg.transform, "advSearch", uiFont, 0, new Color32(204, 144, 144, 255), new Color32(204, 144, 144, 255));
     randButton = CreateTextButton(headerForegroundImg.transform, "randomizer", uiFont, 0, new Color32(204, 144, 144, 255), new Color32(204, 144, 144, 255));
     advButton.GetComponent <Button>().onClick.AddListener(() => Randomizer());
     randButton.GetComponent <Button>().onClick.AddListener(() => Randomizer());
     createScrollContent();
 }
コード例 #4
0
ファイル: ChorusTweak.cs プロジェクト: joosthoi1/Joost-tweaks
 void Randomizer()
 {
     DestroyScrollContent();
     chorusResults = ChorusAPI.CSearch(type: 2);
     createScrollContent();
 }