Ejemplo n.º 1
0
    void RefreshDepth(GTWindow window)
    {
        EWindowType    type  = window.Type;
        List <UIPanel> pList = new List <UIPanel>();

        FindPanels(window, ref pList);

        List <UIPanel> aList = new List <UIPanel>();

        for (int i = 0; i < m_OpenWindows.Count; i++)
        {
            if (m_OpenWindows[i].Type == type)
            {
                FindPanels(m_OpenWindows[i], ref aList);
            }
        }
        for (int i = aList.Count - 1; i >= 0; i--)
        {
            if (aList[i] == null || aList[i].transform == null)
            {
                aList.RemoveAt(i);
            }
        }
        if (pList.Count >= 2)
        {
            pList.Sort(UIPanel.CompareFunc);
        }
        int stDepth = m_MinDepths[type];

        aList.ForEach(item => { stDepth = item.depth > stDepth ? item.depth : stDepth; });
        pList.ForEach(item => { stDepth += 2; item.depth = stDepth; });
        UIPanel.list.Sort(UIPanel.CompareFunc);
    }
Ejemplo n.º 2
0
        /*
         * https://docs.scipy.org/doc/scipy-0.19.1/reference/signal.html
         */
        public static float[] GenerateWindow(int size, EWindowType windowType)
        {
            float[] result = new float[size];
            switch (windowType)
            {
            case EWindowType.Rectangular:
                for (int i = 0; i < size; ++i)
                {
                    result[i] = 1.0f;
                }
                break;

            case EWindowType.Triangle:
                for (int i = 0; i < size; ++i)
                {
                    result[i] = i < size / 2.0f ? 2 * i / (size - 2) : (2 * size - 4 - 2 * i) / (size - 2);
                }
                break;

            case EWindowType.Hamming:
                for (int i = 0; i < size; ++i)
                {
                    result[i] = 0.54f - 0.46f * Mathf.Cos((2 * Mathf.PI * i) / (size - 1));
                }
                break;

            case EWindowType.Hanning:
                for (int i = 0; i < size; ++i)
                {
                    result[i] = 0.5f - 0.5f * Mathf.Cos((2 * Mathf.PI * i) / (size - 1));
                }
                break;

            case EWindowType.BlackMan:
                for (int i = 0; i < size; ++i)
                {
                    result[i] = (float)(0.42f - 0.5 * Mathf.Cos((2 * Mathf.PI * i) / size)) +
                                (float)(0.08 * Mathf.Cos(4 * Mathf.PI * i) / size);
                }
                break;

            case EWindowType.BlackmanHarris:
                for (int i = 0; i < size; ++i)
                {
                    result[i] = (float)((0.35875 - 0.48829 * Mathf.Cos((2 * Mathf.PI * i) / size)) +
                                        (0.14128 * Mathf.Cos(4 * Mathf.PI * i) / size) -
                                        (0.01168 * Mathf.Cos(6 * Mathf.PI * i / size)));
                }
                break;

            default:
                Debug.LogWarning("not implement yet now");
                break;
            }

            return(result);
        }
Ejemplo n.º 3
0
        public BaseWindow GetWindow(EWindowType type)
        {
            if (mWidowDic.ContainsKey(type))
            {
                return(mWidowDic[type]);
            }

            return(null);
        }
Ejemplo n.º 4
0
        public void ShowWindowOfType(EWindowType type)
        {
            BaseWindow window;

            if (!mWidowDic.TryGetValue(type, out window))
            {
                return;
            }
            window.Show();
        }
        public IWindow GetWindow(EWindowType windowType)
        {
            var window = _windows.ToList().Find(g => g.GetWindowType() == windowType);

            if (window == null)
            {
                return(GetWindow(EWindowType.MainWindow));
            }

            return(window);
        }
Ejemplo n.º 6
0
 private bool IsContains(EWindowType type)
 {
     for (int i = 0; i < _stack.Count; i++)
     {
         UIWindow window = _stack[i];
         if (window.WindowType == type)
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 7
0
 private UIWindow GetWindow(EWindowType type)
 {
     for (int i = 0; i < _stack.Count; i++)
     {
         UIWindow window = _stack[i];
         if (window.WindowType == type)
         {
             return(window);
         }
     }
     return(null);
 }
Ejemplo n.º 8
0
 public static float[] GenerateWindow(int size, EWindowType windowType)
 {
     float[] result = new float[size];
     switch (windowType)
     {
     case EWindowType.Hamming:
         for (int i = 0; i < size; ++i)
         {
             result[i] = 0.53836f - 0.46164f * Mathf.Cos((2 * Mathf.PI * i) / (size - 1));
         }
         break;
     }
     return(result);
 }
Ejemplo n.º 9
0
    /// <summary>
    /// 预加载窗口
    /// </summary>
    public UIWindow PreloadWindow(EWindowType type)
    {
        // 如果窗口已经存在
        if (IsContains(type))
        {
            return(null);
        }

        GameLogger.Log($"Preload window {type}");
        UIWindow window = _creater.CreateInstance(type);

        Push(window);
        window.InternalClose();
        window.InternalLoad(OnWindowPrepare);
        return(window);
    }
Ejemplo n.º 10
0
    void CloseAllWindowByType(EWindowType type)
    {
        List <GTWindow> list = null;

        mOpenWindows.TryGetValue(type, out list);
        if (list == null)
        {
            return;
        }
        for (int i = 0; i < list.Count; i++)
        {
            if (!list[i].HasParentWindow)
            {
                list[i].Hide();
            }
        }
    }
Ejemplo n.º 11
0
    /// <summary>
    /// 创建类的实例
    /// </summary>
    /// <param name="windowType">窗口类型</param>
    /// <returns>如果类型没有在程序集里定义会发生异常</returns>
    public UIWindow CreateInstance(EWindowType windowType)
    {
        UIWindow window = null;

        if (_types.TryGetValue(windowType, out Type type))
        {
            WindowAttribute attribute = Attribute.GetCustomAttribute(type, typeof(WindowAttribute)) as WindowAttribute;
            window = (UIWindow)Activator.CreateInstance(type);
            window.Init(attribute.WindowType, attribute.WindowLayer);
        }

        if (window == null)
        {
            throw new KeyNotFoundException($"{nameof(UIWindow)} {windowType} is not define in assembly {_assemblyName}");
        }

        return(window);
    }
Ejemplo n.º 12
0
    /// <summary>
    /// 关闭窗口
    /// </summary>
    /// <param name="type">窗口类型</param>
    public void CloseWindow(EWindowType type)
    {
        UIWindow window = GetWindow(type);

        if (window != null)
        {
            if (window.DontDestroy)
            {
                window.InternalClose();
            }
            else
            {
                window.InternalDestroy();
                Pop(window);
                OnSortWindowDepth(window.WindowLayer);
                OnSetWindowVisible(window.WindowLayer);
            }
        }
    }
Ejemplo n.º 13
0
    private bool IsTopWindow(EWindowType type, EWindowLayer layer)
    {
        UIWindow lastOne = null;

        for (int i = 0; i < _stack.Count; i++)
        {
            if (_stack[i].WindowLayer == layer)
            {
                lastOne = _stack[i];
            }
        }

        if (lastOne == null)
        {
            return(false);
        }

        return(lastOne.WindowType == type);
    }
Ejemplo n.º 14
0
    /// <summary>
    /// 打开窗口
    /// </summary>
    /// <param name="type">窗口类型</param>
    /// <param name="userData">用户数据</param>
    public void OpenWindow(EWindowType type, System.Object userData = null)
    {
        UIWindow window;

        // 如果窗口已经存在
        if (IsContains(type))
        {
            window = GetWindow(type);
            Pop(window);             //弹出旧窗口
        }
        else
        {
            // 创建窗口类
            window = _creater.CreateInstance(type);
        }

        Push(window);
        window.InternalOpen(userData);
        window.InternalLoad(OnWindowPrepare);
    }
Ejemplo n.º 15
0
    public void     CloseWindow(EWindowID windowID)
    {
        GTWindow window = mAllWindows[windowID];

        if (window == null)
        {
            return;
        }
        EWindowType type = window.Type;

        window.Close();
        List <GTWindow> list = null;

        mOpenWindows.TryGetValue(type, out list);
        if (list != null)
        {
            list.Remove(window);
        }
        DealWindowStack(window, false);
    }
        public IWindow SetGameScreen(EWindowType windowType, EWindowType prevWindowType = EWindowType.None, params string[] args)
        {
            var oldWindow = _window;

            _window = GetWindow(windowType);

            oldWindow?.Show(false);

            if (oldWindow != null)
            {
                prevWindowType = prevWindowType == EWindowType.None ? oldWindow.GetWindowType() : prevWindowType;
            }

            _window.SetPrevWindow(prevWindowType);

            _window.Setup(this, args);

            _window.Show(true);

            OnActionChangeWindow?.Invoke();

            return(_window);
        }
Ejemplo n.º 17
0
 public void SetFocusedWindow(EWindowType eWindowType, CGameID gameID, UInt64 ulUnk)
 {
     this.GetFunction <NativeSetFocusedWindowECU>(this.Functions.SetFocusedWindow37)(this.ObjectAddress, eWindowType, gameID.ConvertToUint64(), ulUnk);
 }
 public WindowAttribute(EWindowType type, EWindowLayer layer)
 {
     WindowType  = type;
     WindowLayer = layer;
 }
Ejemplo n.º 19
0
 public void SetPrevWindow(EWindowType windowType) => _prevWindowType = windowType;
Ejemplo n.º 20
0
 public void Init(EWindowType type, EWindowLayer layer)
 {
     WindowType  = type;
     WindowLayer = layer;
 }
Ejemplo n.º 21
0
 public void SetFocusedWindow(EWindowType eWindowType, UInt32 uUnk)
 {
     this.GetFunction <NativeSetFocusedWindowEU>(this.Functions.SetFocusedWindow34)(this.ObjectAddress, eWindowType, uUnk);
 }
Ejemplo n.º 22
0
 public void SetControllerOVerrideMode(EWindowType eWindowType, CGameID gameID, string szUnk)
 {
     this.GetFunction <NativeSetControllerOVerrideModeECS>(this.Functions.SetControllerOVerrideMode43)(this.ObjectAddress, eWindowType, gameID.ConvertToUint64(), szUnk);
 }