예제 #1
0
        //メッセージウィンドを変更
        internal void ChangeCurrentWindow(string name)
        {
            //設定なしならなにもしない
            if (string.IsNullOrEmpty(name))
            {
                return;
            }

            if (CurrentWindow != null && CurrentWindow.Name == name)
            {
                //変化なし
                return;
            }
            else
            {
                AdvMessageWindow window;
                if (!ActiveWindows.TryGetValue(name, out window))
                {
                    //アクティブなウィンドウにない場合、全ウィンドウから検索
                    if (!AllWindows.TryGetValue(name, out window))
                    {
                        //全ウィンドウにもない場合どうしようもないので、デフォルトウィンドウを
                        Debug.LogWarning(name + "is not found in window manager");
                        name   = DefaultActiveWindowNameList[0];
                        window = AllWindows[name];
                    }
                    //非アクティブなウィンドウと交換
                    if (CurrentWindow != null)
                    {
                        ActiveWindows.Remove(CurrentWindow.Name);
                    }
                    ActiveWindows.Add(name, window);

                    //登録されたイベントを呼ぶ
                    CalllEventActiveWindows();
                }
                LastWindow    = CurrentWindow;
                CurrentWindow = window;
                //登録されたイベントを呼ぶ
                if (LastWindow != null)
                {
                    LastWindow.ChangeCurrent(false);
                }
                CurrentWindow.ChangeCurrent(true);
                OnChangeCurrentWindow.Invoke(this);
            }
        }