Exemplo n.º 1
0
    private static void proccessUpdate()
    {
        images = new List <string> ();

        for (int i = 0; i < helpUpdate.faqs.Length; i++)
        {
            HUDShader2HelpFaq faq = helpUpdate.faqs [i];
            for (int j = 0; j < faq.answer.Length; j++)
            {
                HUDShader2HelpFaqContent content = faq.answer [j];
                if (content.type == "image")
                {
                    images.Add(content.content);
                }
            }
        }

        checkImageDownload();
    }
Exemplo n.º 2
0
    //End Image Loading

    void OnGUI()
    {
        Rect r = position;

        scrollPos = GUILayout.BeginScrollView(scrollPos);

        GUIStyle nonbreakingLabelStyle;

        nonbreakingLabelStyle          = new GUIStyle();
        nonbreakingLabelStyle.wordWrap = true;

        if (help != null)
        {
            Texture2D logo = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets" + EDITORFOLDER + "Logo-Khodrin-hud-shader.png", typeof(Texture2D));
            GUI.DrawTexture(GUILayoutUtility.GetRect(300, 100), logo, ScaleMode.ScaleToFit);

            if (GUI.Button(GUILayoutUtility.GetRect(100, 20), "Look for FAQ updates"))
            {
                updateFAQ();
            }

            EditorGUILayout.LabelField("Version: " + help.version);
            EditorGUILayout.LabelField("FAQ Revision: " + help.revision);
            RectOffset rctOff = GUI.skin.label.padding;
            rctOff.left = 5;
            nonbreakingLabelStyle.padding = rctOff;
            GUILayout.Label(help.intro, nonbreakingLabelStyle, GUILayout.MaxWidth(position.width));
            EditorGUILayout.Space();
            rctOff = GUI.skin.label.padding;

            EditorGUILayout.LabelField("FAQ:");

            for (int i = 0; i < help.faqs.Length; i++)
            {
                HUDShader2HelpFaq faq = help.faqs [i];

                GUILayout.BeginVertical("HelpBox");
                GUILayout.BeginHorizontal();
                foldouts[i] = EditorGUILayout.Foldout(foldouts[i], faq.question);
                GUILayout.EndHorizontal();

                if (foldouts [i])
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.BeginVertical("GroupBox");

                    for (int j = 0; j < faq.answer.Length; j++)
                    {
                        HUDShader2HelpFaqContent content = faq.answer [j];
                        switch (content.type)
                        {
                        case "text":
                            GUILayout.Label(content.content, nonbreakingLabelStyle, GUILayout.MaxWidth(position.width));
                            GUILayout.Space(10);
                            break;

                        case "image":
                            Texture2D image = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets" + EDITORFOLDER + content.content, typeof(Texture2D));
                            if (GUI.Button(GUILayoutUtility.GetRect(128, 128), image))
                            {
                                HUDShader2WindowImage imageWindow = (HUDShader2WindowImage)EditorWindow.GetWindow(typeof(HUDShader2WindowImage), true, "Image");
                                imageWindow.image_path = "Assets" + EDITORFOLDER + content.content;
                                imageWindow.Show();
                            }
                            GUILayout.Space(10);
                            break;
                        }
                    }

                    GUILayout.EndVertical();
                    GUILayout.EndHorizontal();
                }

                GUILayout.EndVertical();
            }
        }
        else
        {
            EditorGUILayout.HelpBox("The helpfile could not be found. Make sure the file \"help.json\" is located in \"" + EDITORFOLDER + "\"", MessageType.Error);
        }

        GUILayout.EndScrollView();
    }