Пример #1
0
        void UpdateMessages()
        {
            var messages = Lib.GetMessages();

            for (int i = 0; i < messages.Length; ++i)
            {
                var message = messages[i];
                var id      = message.windowId;
                switch (message.type)
                {
                case MessageType.WindowAdded: {
                    var window = AddWindow(id);
                    if (window.isAlive && window.isDesktop)
                    {
                        desktops_.Add(id);
                        onDesktopAdded.Invoke(window);
                    }
                    else
                    {
                        onWindowAdded.Invoke(window);
                    }
                    break;
                }

                case MessageType.WindowRemoved: {
                    var window = Find(id);
                    if (window != null)
                    {
                        window.isAlive = false;
                        if (window.parentWindow != null)
                        {
                            window.parentWindow.onChildRemoved.Invoke(window);
                        }
                        windows.Remove(id);
                        if (window.isAlive && window.isDesktop)
                        {
                            desktops_.Remove(id);
                            onDesktopRemoved.Invoke(window);
                        }
                        else
                        {
                            onWindowRemoved.Invoke(window);
                        }
                    }
                    break;
                }

                case MessageType.WindowCaptured: {
                    var window = Find(id);
                    if (window != null)
                    {
                        window.onCaptured.Invoke();
                    }
                    break;
                }

                case MessageType.WindowSizeChanged: {
                    var window = Find(id);
                    if (window != null)
                    {
                        window.onSizeChanged.Invoke();
                    }
                    break;
                }

                case MessageType.IconCaptured: {
                    var window = Find(id);
                    if (window != null)
                    {
                        window.onIconCaptured.Invoke();
                    }
                    break;
                }

                case MessageType.CursorCaptured: {
                    cursor.onCaptured.Invoke();
                    break;
                }

                default: {
                    break;
                }
                }
            }
        }
Пример #2
0
 void UpdateWindowInfo()
 {
     cursorWindowId_ = Lib.GetWindowIdUnderCursor();
 }
Пример #3
0
 void OnDisable()
 {
     Lib.SetLogFunc(null);
     Lib.SetErrorFunc(null);
 }
Пример #4
0
 void OnEnable()
 {
     Lib.SetLogFunc(onDebugLog);
     Lib.SetErrorFunc(onDebugErr);
 }
Пример #5
0
 void OnApplicationQuit()
 {
     Resources.UnloadUnusedAssets();
     Lib.Finalize();
 }
Пример #6
0
 void Awake()
 {
     Lib.SetDebugMode(debugMode);
     Lib.Initialize();
     renderEventFunc_ = Lib.GetRenderEventFunc();
 }