Beispiel #1
0
 private static bool Prefix(TurnBasedModeUIController __instance)
 {
     if (settings.turnBasedCombatStartDelay == 4f)
     {
         return(true);
     }
     if (__instance.m_CombatStartWindowVM == null)
     {
         __instance.HideTurnPanel();
         __instance.m_CombatStartWindowVM = new CombatStartWindowVM(new Action(__instance.HideCombatStartWindow));
         __instance.m_Config.CombatStartWindowView.Bind(__instance.m_CombatStartWindowVM);
         object p = DelayedInvoker.InvokeInTime(new Action(__instance.HideCombatStartWindow), settings.turnBasedCombatStartDelay, true);
     }
     return(false);
 }
    private void OnEnable()
    {
        _exampleScript = (DelayedInvoker)target;

        // Invoke on Start field *************************

        InvokeOnStart = serializedObject.FindProperty("InvokeOnStart");

        // EventDelayPairs field *************************

        EventDelayPairs = serializedObject.FindProperty("EventDelayPairs");

        list = new ReorderableList(serializedObject, EventDelayPairs)
        {
            draggable          = true,
            displayAdd         = true,
            displayRemove      = true,
            drawHeaderCallback = rect => {
                EditorGUI.LabelField(rect, "DelayedEvents");
            },
            drawElementCallback = (rect, index, sel, act) => {
                var element = EventDelayPairs.GetArrayElementAtIndex(index);

                var unityEvent = element.FindPropertyRelative("unityEvent");
                var delay      = element.FindPropertyRelative("Delay");


                EditorGUI.PropertyField(new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight), delay);

                rect.y += EditorGUIUtility.singleLineHeight;

                EditorGUI.PropertyField(new Rect(rect.x, rect.y, rect.width, EditorGUI.GetPropertyHeight(unityEvent)), unityEvent);
            },
            elementHeightCallback = index => {
                var element = EventDelayPairs.GetArrayElementAtIndex(index);

                var unityEvent = element.FindPropertyRelative("unityEvent");

                var height = EditorGUI.GetPropertyHeight(unityEvent) + EditorGUIUtility.singleLineHeight;

                return(height);
            }
        };
    }