예제 #1
0
 public static int MainMethod(string[] args)
 {
     dynamic mc = 3;
     var v = new MyClass02();
     bool rez = v == mc;
     rez &= !(v != mc);
     MyClass x = new MyClass();
     rez &= x == mc;
     rez &= !(x != mc);
     return rez ? 0 : 1;
 }
예제 #2
0
    void OnGUI()
    {
        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Reorderable List Example 2",
                                   new GUIStyle()
        {
            alignment = TextAnchor.MiddleCenter, fontSize = 15, fontStyle = FontStyle.Bold
        });
        EditorGUILayout.Space();
        scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
        rl.DoLayoutList();
        EditorGUILayout.EndScrollView();

        dropDownMenu = new GenericMenu();

        // If an item is selected in the list, make 'Add Next' and 'Add Last' options available
        if (rl.index >= 0)
        {
            dropDownMenu.AddItem(new GUIContent("Add Next"), false, AddNext, rl);
            dropDownMenu.AddItem(new GUIContent("Add Last"), false, AddLast, rl);
        }
        // If no item is selected in the list, disable 'Add Next' option
        else
        {
            dropDownMenu.AddDisabledItem(new GUIContent("Add Next"), false);
            dropDownMenu.AddItem(new GUIContent("Add Last"), false, AddLast, rl);
        }

        // If you want to print out the names from the reordered list.
        // This is to show that the list can be used after reodering.
        if (GUILayout.Button("Print list names"))
        {
            string s = "";
            for (int i = 0; i < rl.list.Count; i++)
            {
                MyClass02 mc = (MyClass02)rl.list[i];
                s += i < rl.list.Count - 1 ? mc.Name + ", " : mc.Name + ".";
            }
            Debug.Log(s);
        }
    }