Пример #1
0
    private void displayClueList(GUIStyle style_Yellow_01)
    {
        AP_Clue myScript = (AP_Clue)target;

        for (var i = 0; i < clueList.arraySize; i++)
        {
            EditorGUILayout.BeginVertical(style_Yellow_01);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Clue " + i + ":", GUILayout.Width(50));

            EditorGUILayout.LabelField("Lock :", GUILayout.Width(40));
            EditorGUILayout.PropertyField(clueList.GetArrayElementAtIndex(i).FindPropertyRelative("b_Lock"), new GUIContent(""), GUILayout.Width(30));



            if (GUILayout.Button("Add New Language", GUILayout.Width(120)))
            {
                clueList.GetArrayElementAtIndex(i).FindPropertyRelative("txt_Clue").arraySize++;
                clueList.GetArrayElementAtIndex(i).FindPropertyRelative("spriteClue").arraySize++;
            }
            if (GUILayout.Button("-", GUILayout.Width(30)))
            {
                clueList.DeleteArrayElementAtIndex(i);
                break;
            }
            EditorGUILayout.EndHorizontal();


            for (var j = 0; j < clueList.GetArrayElementAtIndex(i).FindPropertyRelative("txt_Clue").arraySize; j++)
            {
                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("-", GUILayout.Width(20)))
                {
                    clueList.GetArrayElementAtIndex(i).FindPropertyRelative("txt_Clue").DeleteArrayElementAtIndex(j);
                    clueList.GetArrayElementAtIndex(i).FindPropertyRelative("spriteClue").DeleteArrayElementAtIndex(j);
                    break;
                }
                EditorGUI.BeginChangeCheck();
                string tmpString = EditorGUILayout.TextArea(clueList.GetArrayElementAtIndex(i).FindPropertyRelative("txt_Clue").GetArrayElementAtIndex(j).stringValue, GUILayout.Height(50));


                if (EditorGUI.EndChangeCheck())
                {
                    clueList.GetArrayElementAtIndex(i).FindPropertyRelative("txt_Clue").GetArrayElementAtIndex(j).stringValue = tmpString;
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("", GUILayout.Width(20));
                EditorGUILayout.PropertyField(clueList.GetArrayElementAtIndex(i).FindPropertyRelative("spriteClue").GetArrayElementAtIndex(j), new GUIContent(""));
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndVertical();
        }


        if (GUILayout.Button("Add New Clue"))
        {
            clueList.arraySize++;
        }
    }
Пример #2
0
    public bool b_ActivateDoubleTapIcon = true;    // True : ACtivated the double tap UI icon if game is played on mobile platform

    private void Start()
    {
        _actionsWhenPuzzleIsSolved = GetComponent <actionsWhenPuzzleIsSolved>();                                   // Access actionsWhenPuzzleIsSolved component
        // GameObject tmp = GameObject.Find("Canvas_PlayerInfos");

        GameObject Grp_canvas = GameObject.Find("Grp_Canvas");

        Transform[] allTransform = Grp_canvas.GetComponentsInChildren <Transform>(true);

        UIVariousFunctions canvas_PlayerInfos = null;

        foreach (Transform obj in allTransform)
        {
            if (obj.name == "Canvas_PlayerInfos")
            {
                canvas_PlayerInfos = obj.gameObject.GetComponent <UIVariousFunctions>();   // Access to the UIVariousFunctions script
            }
            if (obj.name == "btn_Clue")
            {
                iconPuzzleClue = obj.gameObject;
            }
        }



        if (canvas_PlayerInfos)
        {
            GameObject tmp2 = canvas_PlayerInfos.obj_PuzzleNotAvailable;
            if (tmp2)
            {
                iconPuzzleNotAvailable = tmp2;                                              // Access object PuzzleNotAvailable
            }
            tmp2 = canvas_PlayerInfos.obj_ResetPuzzle;
            if (tmp2)
            {
                iconResetPuzzle = tmp2;                                                     // Access object iconResetPuzzle
            }
            tmp2 = canvas_PlayerInfos.obj_Btn_Mobile_ExitPuzzle;
            if (tmp2)
            {
                iconMobile_ExitPuzzle = tmp2;                                                     // Access object iconMobile_ExitPuzzle
            }
        }


        //Find if a ClueBox is attached to the puzzle
        allTransform = GetComponentsInChildren <Transform>(true);
        foreach (Transform obj in allTransform)
        {
            if (obj.name == "ClueBox")
            {
                objClueBox = obj.gameObject.GetComponent <AP_Clue>();   // Access to the AP_Clue script
                break;
            }
        }
    }