コード例 #1
0
    /// <summary>
    /// 更新单个热键
    /// </summary>
    /// <param name="key"></param>
    private void UpdateHotkeyElement(UIViewAction key)
    {
        if (key.State < 0 || key.State >= key.StateList.Count)
        {
            return;
        }

        Transform outer  = OwnerView.State.GetActionBox();
        Transform parent = outer ? outer : FindComponent <Transform>("Content/HotkeyBox");

        UIViewActionState keyState = key.StateList[key.State];

        OwnerView.AddHotKey(key.ID, keyState.Hotkey, (callback) => { key.FireEvent(callback); }, keyState.Time, parent, keyState.Text);
        OwnerView.SetHotKeyVisible(key.ID, key.Visible);
        OwnerView.SetHotKeyEnabled(key.ID, key.Enabled);
        OwnerView.SetHotKeyDescription(key.ID, keyState.Text);
    }