Exemplo n.º 1
0
        public void Update()
        {
            if (_allUIView == null || _allUIView.Count <= 0)
            {
                return;
            }

            float deltaTime = Time.deltaTime;

            for (UI_TYPE type = UI_TYPE.UI_NONE; type < UI_TYPE.UI_MAX; ++type)
            {
                BaseUIView baseUIView = null;
                if (_allUIView.TryGetValue(type, out baseUIView))
                {
                    baseUIView.Core(deltaTime);

                    if (baseUIView.IsNeedDestroy())
                    {
                        _allUIView.Remove(type);
                        _backUIViewQueue.Remove(baseUIView);
                        _openUIViewQueue.Remove(baseUIView);
                        baseUIView.Hide();
                        baseUIView.Release();
                        GameObject.Destroy(baseUIView.gameObject);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public BaseUIView OpenUIView(UI_TYPE uiType, object param = null)
        {
            BaseUIView baseUIView = null;

            if (!_allUIView.TryGetValue(uiType, out baseUIView))
            {
                string     uiAssetPath = GetUIAssetPathByUIType(uiType);
                GameObject goUI        = GameObject.Instantiate(Resources.Load <GameObject>(uiAssetPath));
                baseUIView = goUI.GetComponent <BaseUIView>();
                _allUIView.Add(uiType, baseUIView);
            }
            else
            {
                if (!baseUIView.IsClose())
                {
                    baseUIView.Hide();
                }
            }

            if (baseUIView.IsNeedBack())
            {
                for (int i = 0, len = _backUIViewQueue.Count; i < len; ++i)
                {
                    BaseUIView tempUIView = _backUIViewQueue[i];
                    if (tempUIView.Equals(baseUIView))
                    {
                        _backUIViewQueue.RemoveAt(i);
                        break;
                    }
                }

                _backUIViewQueue.Add(baseUIView);
            }

            if (_openUIViewQueue.Contains(baseUIView))
            {
                _openUIViewQueue.Remove(baseUIView);
            }
            _openUIViewQueue.Add(baseUIView);

            ChangeUIViewParent(baseUIView);

            HideOldView();
            baseUIView.UIType = uiType;
            if (baseUIView.IsShowAfterOpenEffect)
            {
                baseUIView.UIParam = param;
                baseUIView.ShowOpenEffect();
            }
            else
            {
                baseUIView.Show(param);
            }
            baseUIView.ChangeCameraRenderTexture(true);
            baseUIView.ChangeCanvasLayer(UILayer);
            baseUIView.ChangeGraphicRaycasterState(true);
            RefreshUISortingOrder();

            return(baseUIView);
        }
Exemplo n.º 3
0
        public void Release()
        {
            if (_allUIView == null)
            {
                return;
            }

            for (UI_TYPE i = UI_TYPE.UI_NONE; i < UI_TYPE.UI_MAX; ++i)
            {
                BaseUIView uiView = null;
                if (_allUIView.TryGetValue(i, out uiView))
                {
                    if (uiView != null)
                    {
                        if (!uiView.IsClose())
                        {
                            uiView.Hide();
                        }
                        uiView.Release();
                        GameObject.Destroy(uiView.gameObject);
                    }
                }
            }

            _UICamera = null;
            _allUIView.Clear();
            _backUIViewQueue.Clear();
            Resources.UnloadUnusedAssets();
        }
Exemplo n.º 4
0
 public UIWindow CreateWindow(UI_TYPE type)
 {
     if (m_windowDict.ContainsKey(type))
     {
         return(m_windowDict[type]);
     }
     else
     {
         for (int i = 0; i < m_windowList.Count; i++)
         {
             if (m_windowList[i].type == type)
             {
                 GameObject win = Instantiate(m_windowList[i].window.gameObject, transform);
                 if (win != null)
                 {
                     UIWindow UIwindow = win.GetComponent <UIWindow>();
                     if (UIwindow != null)
                     {
                         m_windowDict.Add(type, UIwindow);
                         CheckTopWindow();
                         return(UIwindow);
                     }
                 }
             }
         }
         return(null);
     }
 }
Exemplo n.º 5
0
        private void SetMainFrame(UI_TYPE a)
        {
            switch (a)
            {
            case UI_TYPE.UI_NONE:
                grd_setting.Visibility = Visibility.Collapsed;
                grd_input.Visibility   = Visibility.Collapsed;
                grd_output.Visibility  = Visibility.Collapsed;
                break;

            case UI_TYPE.UI_SETTING:
                grd_setting.Visibility = Visibility.Visible;
                grd_input.Visibility   = Visibility.Collapsed;
                grd_output.Visibility  = Visibility.Collapsed;
                findport();
                break;

            case UI_TYPE.UI_INPUT:
                grd_setting.Visibility = Visibility.Collapsed;
                grd_input.Visibility   = Visibility.Visible;
                grd_output.Visibility  = Visibility.Collapsed;
                break;

            case UI_TYPE.UI_OUTPUT:
                grd_setting.Visibility = Visibility.Collapsed;
                grd_input.Visibility   = Visibility.Collapsed;
                grd_output.Visibility  = Visibility.Visible;
                break;

            default:
                break;
            }
        }
Exemplo n.º 6
0
    public void OpenSingleWindow(UI_TYPE type)
    {
        if (m_windowDict.ContainsKey(type))
        {
            m_windowDict[type].Open();
        }
        else
        {
            UIWindow win = CreateWindow(type);
            if (win != null)
            {
                win.Open();
            }
        }

        foreach (UIWindow w in m_windowDict.Values)
        {
            if (w.TYPE != type)
            {
                if (w.TYPE == UI_TYPE.Loading)
                {
                    return;
                }
                w.Close();
            }
            else
            {
                w.Open();
            }
        }

        CheckTopWindow();
    }
Exemplo n.º 7
0
        public void CloseUIView(UI_TYPE uiType)
        {
            BaseUIView baseUIView = null;

            if (_allUIView.TryGetValue(uiType, out baseUIView))
            {
                CloseUIView(baseUIView);
            }
        }
Exemplo n.º 8
0
    public UIWindow GetWindow(UI_TYPE type)
    {
        if (m_windowDict.ContainsKey(type))
        {
            return(m_windowDict[type]);
        }

        return(null);
    }
Exemplo n.º 9
0
        private string GetUIAssetPathByUIType(UI_TYPE uiType)
        {
            string assetPath = string.Empty;

            if (!CommonUIData.DICT_UI_PATHS.TryGetValue(uiType, out assetPath))
            {
                throw new System.IndexOutOfRangeException(uiType.ToString());
            }
            return(assetPath);
        }
Exemplo n.º 10
0
        public BaseUIView FindUIViewByUIType(UI_TYPE uiType)
        {
            BaseUIView baseUIView = null;

            if (_allUIView.TryGetValue(uiType, out baseUIView))
            {
                return(baseUIView);
            }

            return(null);
        }
Exemplo n.º 11
0
        public bool IsUIOpen(UI_TYPE uiType)
        {
            BaseUIView baseUIView = null;

            if (_allUIView.TryGetValue(uiType, out baseUIView))
            {
                return(!baseUIView.IsClose());
            }

            return(false);
        }
Exemplo n.º 12
0
 public void DestroyWindow(UI_TYPE type)
 {
     if (m_windowDict.ContainsKey(type))
     {
         UIWindow window = m_windowDict[type];
         if (window != null)
         {
             Destroy(window);
         }
         m_windowDict.Remove(type);
     }
 }
Exemplo n.º 13
0
        public bool IsUIBackHide(UI_TYPE uiType)
        {
            BaseUIView baseUIView = null;

            if (_allUIView.TryGetValue(uiType, out baseUIView))
            {
                int index = _backUIViewQueue.LastIndexOf(baseUIView);
                return(index < (_backUIViewQueue.Count - 1));
            }

            return(false);
        }
Exemplo n.º 14
0
 public void CloseWindow(UI_TYPE type)
 {
     if (m_windowDict.ContainsKey(type))
     {
         UIWindow window = m_windowDict[type];
         if (window != null)
         {
             m_windowDict[type].Close();
         }
         else
         {
             m_windowDict.Remove(type);
         }
     }
 }
Exemplo n.º 15
0
 public void OpenWindow(UI_TYPE type)
 {
     if (m_windowDict.ContainsKey(type))
     {
         m_windowDict[type].Open();
     }
     else
     {
         UIWindow win = CreateWindow(type);
         if (win != null)
         {
             win.Open();
         }
     }
     CheckTopWindow();
 }
Exemplo n.º 16
0
    //========================================================
    //public関数

    //--指定したボタンのアクティブかどうかを変更する関数
    public void ChangeActive(UI_TYPE userInterface, bool isActive)
    {
        switch (userInterface)
        {
        case UI_TYPE.MOVE_BUTTON:
            _moveButton.interactable = isActive;
            _moveButton.gameObject.SetActive(isActive);
            break;

        case UI_TYPE.EFFECT_BUTTON:
            _effectButton.interactable = isActive;
            _effectButton.gameObject.SetActive(isActive);
            break;

        case UI_TYPE.BACK_BUTTON:
            _backButton.interactable = isActive;
            _backButton.gameObject.SetActive(isActive);
            break;

        case UI_TYPE.ATTACK_BUTTON:
            _attackButton.interactable = isActive;
            _attackButton.gameObject.SetActive(isActive);
            break;

        case UI_TYPE.TURN_END_BUTTON:
            _turnEndButton.interactable = isActive;
            _turnEndButton.gameObject.SetActive(isActive);
            break;

        case UI_TYPE.MULLIGAN_PANEL:
            //_mulliganPanel内のボタンのアクティブ化変更処理-----------------------------
            Button[] yesNoButtons = _mulliganPanel.GetComponentsInChildren <Button> ();
            for (int i = 0; i < yesNoButtons.Length; i++)
            {
                yesNoButtons [i].interactable = isActive;
            }
            //-------------------------------------------------------------------------
            _mulliganPanel.SetActive(isActive);
            break;

        default:
            break;
        }
    }
Exemplo n.º 17
0
 public override void Read()
 {
     E_ui               = (E_UI)ReadShort();
     Name               = ReadString();
     Prefab             = ReadString();
     UI_Type            = (UI_TYPE)ReadShort();
     Script             = ReadString();
     MoreOpen           = ReadBool();
     NotBeClear         = ReadInt();
     ShowMask           = ReadInt();
     IsTouchEffect      = ReadBool();
     IsCloseWorldCamera = ReadBool();
     IsShowLoading      = ReadBool();
     TopFilter          = ReadBool();
     Special            = ReadBool();
     BGM         = ReadInt();
     SE          = ReadInt();
     IsAnimation = ReadInt();
 }
Exemplo n.º 18
0
        public UIWindow setWindow(string name, GameObject go, UI_LAYER layer, UI_TYPE ui_type)
        {
            switch (ui_type)
            {
            case UI_TYPE.COMMON:
                go.transform.parent = commonUIAnchor_.transform;
                break;

            case UI_TYPE.LOGIN:
                go.transform.parent        = loginUIAnchor_.transform;
                go.transform.localPosition = Vector3.zero;
                break;

            case UI_TYPE.MAIN:
                go.transform.parent = mainUIPanel_.transform;
                break;

            case UI_TYPE.Movie:
                go.transform.parent = moviePanel_.transform;
                break;
            }
            UIWindow win = go.GetComponent <UIWindow>();

            if (win != null)
            {
                win.windowName = name;
                if (!windowList_.ContainsKey(name))
                {
                    windowList_.Add(name, win);
                }
                else
                {
                    windowList_[name] = win;
                }
            }
            setLayer(go, layer);
            go.SetActive(false);
            go.transform.localScale = new Vector3(1, 1, 1);
            go.name = name;
            return(win);
        }
Exemplo n.º 19
0
        public void CloseUIView()
        {
            if (_backUIViewQueue == null || _backUIViewQueue.Count <= 0)
            {
                return;
            }

            int        lastIndex   = _backUIViewQueue.Count - 1;
            BaseUIView closeUIView = _backUIViewQueue[lastIndex];
            UI_TYPE    closeUIType = closeUIView.UIType;

            _backUIViewQueue.RemoveAt(lastIndex);
            CloseUIView(closeUIView);

            if (lastIndex > 0)
            {
                BaseUIView showUIView = _backUIViewQueue[lastIndex - 1];
                ChangeUIViewParent(showUIView);
                showUIView.ChangeCameraRenderTexture(true);
                showUIView.ChangeCanvasLayer(UILayer);
                showUIView.ChangeGraphicRaycasterState(true);
                showUIView.Back();
            }
        }
Exemplo n.º 20
0
    /// <summary>
    /// UI
    /// </summary>
    /// <param name="type"></param>
    public void ChangeUI(UI_TYPE type)
    {
        //	表示中のUIをすべて削除
        foreach (var go in UIActiveList)
        {
            Destroy(go);
        }
        //	アクティブなUIリストをクリアに
        UIActiveList.Clear();

        //	親オブジェクト
        GameObject parent = null;
        //	子オブジェクト
        GameObject child = null;

        //	UIのタイプによって挙動を追加
        //hack: ウンコード
        //diary: 少しでもまともなUIに近づけたい(無断実装)明日締め切り……夜中3時……
        switch (type)
        {
        case UI_TYPE.DEMO_UI:
            //	UIのアクティブリストに追加
            UIActiveList.Add(Instantiate(UIList[(int)UI_TYPE.DEMO_UI]));
            break;

        case UI_TYPE.TITLE_UI:
            UIActiveList.Add(Instantiate(UIList[(int)UI_TYPE.TITLE_UI]));
            break;

        case UI_TYPE.TITLE_UI_TITLE:
            //	タイトルUI(キャンバス)を親
            parent = Instantiate(UIList[(int)UI_TYPE.TITLE_UI]);
            //	タイトル画面を子に
            child = Instantiate(UIList[(int)UI_TYPE.TITLE_UI_TITLE]);
            //	親オブジェクトの子にする
            child.transform.SetParent(parent.transform, false);
            //	リストに追加
            UIActiveList.Add(parent);
            UIActiveList.Add(child);

            break;

        case UI_TYPE.TITLE_UI_PLAYER_SELECT:
            parent = Instantiate(UIList[(int)UI_TYPE.TITLE_UI]);
            child  = Instantiate(UIList[(int)UI_TYPE.TITLE_UI_PLAYER_SELECT]);
            child.transform.SetParent(parent.transform, false);
            UIActiveList.Add(parent);
            UIActiveList.Add(child);
            break;

        case UI_TYPE.TITLE_UI_STAGE_INFO:
            parent = Instantiate(UIList[(int)UI_TYPE.TITLE_UI]);
            child  = Instantiate(UIList[(int)UI_TYPE.TITLE_UI_STAGE_INFO]);
            child.transform.SetParent(parent.transform, false);
            UIActiveList.Add(parent);
            UIActiveList.Add(child);
            break;

        case UI_TYPE.ITEM_INFO_UI:
            parent = Instantiate(UIList[(int)UI_TYPE.ITEM_INFO_UI]);
            UIActiveList.Add(parent);
            parent.GetComponent <Canvas>().worldCamera = FindObjectOfType <Camera>();
            break;

        case UI_TYPE.ITEM_INFO_UI_KEDAMA:
            break;

        case UI_TYPE.ITEM_INFO_UI_ITEM:
            break;

        default: break;
        }
    }
Exemplo n.º 21
0
 private RectTransform GetUI(UI_TYPE type)
 {
     return(UI[(int)type]);
 }
Exemplo n.º 22
0
        //同步加载窗口
        public UIWindow loadWindowSync(string winName, string srcName, UI_LAYER layer, UI_TYPE ui_type)
        {
            AssetBundleInfo abInfo = AssetBundleManager.Instance.LoadSync(srcName);
            GameObject      go     = GameObject.Instantiate(abInfo.mainObject) as GameObject;
            UIWindow        win    = setWindow(winName, go, layer, ui_type);

            return(win);
        }
Exemplo n.º 23
0
        public void addToLoadingList(string name, string path, string resName, bool isInAssetList, UI_LAYER layer, UI_TYPE ui_type)
        {
            WindowLoadingData data = new WindowLoadingData();

            data.name = name;
            data.path = path;
            if (isInAssetList)
            {
                data.resName = resName;
            }
            data.layer   = layer;
            data.ui_type = ui_type;
            _loadList.Add(name, data);
        }
Exemplo n.º 24
0
 public void onNomralUI()
 {
     uiType = UI_TYPE.NORMAL;
     updateUI();
 }
Exemplo n.º 25
0
 public void onDonwloadUI()
 {
     uiType = UI_TYPE.DOWNLOAD;
     progressImage.fillAmount = 0;
     updateUI();
 }
Exemplo n.º 26
0
 public void onPickUI()
 {
     uiType = UI_TYPE.PICK;
     updateUI();
 }
Exemplo n.º 27
0
 private RectTransform GetUI(UI_TYPE type)
 {
     return UI[(int)type];
 }