Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.1 kB
3
Indexable
Never
public class UI
{
    
}
public class Manager
{
    private Dictionary<UI, int> flags = new Dictionary<UI, int>();

    public void TryHideByFlag(UI u)
    {
        flags[u]--;
        if (flags[u]< 0)
        {
            // hide ui
        }
    }
    
    public void TryShowByFlag(UI u)
    {
        flags[u]++;
        if (flags[u] >= 0)
        {
            flags[u] = 0;
            // show ui
        }
    }
   
    void OpenUI(UI u)
    {
        // 根据表里的互斥关系处理,,,
        List<UI> mutexUI = new List<UI>();
        foreach (var ui in mutexUI)
        {
            TryHideByFlag(u);
        }
    }
    void CloseUI(UI u)
    {
        // 根据表里的互斥关系处理,,,
        List<UI> mutexUI = new List<UI>();
        foreach (var ui in mutexUI)
        {
            TryShowByFlag(u);
        }
    }
    // 根据相机状态处理,,,
    void CameraState(int a)
    {
        if (a == 1)
        {
            // TryShowByFlag(xxxui);
        }

        if (a == 2)
        {
            // TryHideByFlag(xxxui);
        }
    }
}