Beispiel #1
0
        public void ShowWnd(UIType t, object[] param = null)
        {
            UIWindowInfo info = null;

            if (mWindowInstanceList.ContainsKey(t))
            {
                UICache cache = mWindowInstanceList[t];
                mStackInstance.Push(cache.mInstance, cache.mInfo);
            }
            else
            {
                if (UIWindowConfig.WindowConfig.TryGetValue(t, out info))
                {
                    ResourcesManager.Instance.Load(t.ToString(), "UI", () =>
                    {
                        GameObject instan = ResourcesManager.Instance.GetResources <GameObject>(t.ToString());
                        instan            = NGUITools.AddChild(WindowRoot, instan);
                        mStackInstance.Push(instan, info);
                        UIBase owner = (UIBase)Activator.CreateInstance(info.Owner);
                        mWindowInstanceList.Add(t, new UICache(t, instan, info, owner));

                        owner.OnInit();
                        owner.OnParam(param);
                        owner.OnEnter();
                    });
                    //GameObject instan = UITools.LoadWnd( "Windows/" + info.GetResourcePath(), WindowRoot);//GameObject.Instantiate<GameObject>(Resources.Load<GameObject>(info.GetResourcePath()));
                }
                else
                {
                    Debug.Log(string.Format("WindowConfig Can't find type [{0}]", t.ToString()));
                }
            }
        }
Beispiel #2
0
        public async Task Close(UIType ui)
        {
            if (uiFormsDic.TryGetValue(ui.ToString(), out var uiInstance))
            {
                uiFormsDic.Remove(ui.ToString());
                var uiForm = uiInstance.GetComponent <UIForm>();
                await uiForm.Hide();

                Destroy(uiInstance);
            }
        }
Beispiel #3
0
        public ViewUITypeForm(UIType type)
        {
            InitializeComponent();

            string dir = Globals.imagesFolder + @"UserInterfaceSamples\" + type.ToString();

            this.Text = type.ToString();
            DirectoryInfo dirInfo = new DirectoryInfo(dir);

            files = dirInfo.GetFiles();
        }
Beispiel #4
0
        public void HideWnd(UIType t)
        {
            UICache cache = null;

            if (mWindowInstanceList.TryGetValue(t, out cache))
            {
                cache.mOwner.OnLeave();
                mStackInstance.Pop(t);

                Utility.LogColor("8080ff", string.Format("HideWnd {0}", t.ToString()));
            }
            else
            {
                Debug.Log(string.Format("mWindowInstanceList Can't find type [{0}]", t.ToString()));
            }
        }
Beispiel #5
0
 //关闭
 public void Hide(UIType uIType)
 {
     if (m_DataPool.ContainsKey(uIType))
     {
         m_DataPool[uIType].Hide();
         UnityTool.M_Debug("关闭" + uIType.ToString());
     }
 }
Beispiel #6
0
 //显示
 public void Show(UIType uIType)
 {
     if (m_DataPool.ContainsKey(uIType))
     {
         m_DataPool[uIType].Show();
         m_current = m_DataPool[uIType];
         UnityTool.M_Debug("显示" + uIType.ToString());
     }
 }
Beispiel #7
0
    /// <summary>
    /// AddShow the UI_Panel from the type.
    /// </summary>
    public void AddShow(GameObject parent, UIType type)
    {
        GameObject obj = PoolManager.Instance.GetUIFromPool(type);

        if (obj == null)
        {
            Debug.Log(type.ToString());
            GameObject o = UILoader.Instance.LoadUIPanel(parent, type.ToString());
            o.SetActive(true);
            showList.Add(o);
            PoolManager.instance.AddUIPool(o);
        }
        else
        {
            obj.SetActive(true);
            showList.Add(obj);
        }
    }
Beispiel #8
0
    public static T Load <T>(UIType uiType, bool active = true) where T : Component
    {
        string     path = "UI/" + uiType.ToString();
        GameObject obj  = Resources.Load <GameObject>(path);

        if (obj != null)
        {
            obj      = GameObject.Instantiate(obj);
            obj.name = uiType.ToString();
            obj.transform.SetParent(GameObject.Find("UIManager").transform);
            obj.SetActive(active);

            m_uiDic.Add(uiType, obj);

            return(obj.GetComponent <T>());
        }

        return(null);
    }
Beispiel #9
0
        public void DestoryWnd(UIType t)
        {
            UICache cache = null;

            if (mWindowInstanceList.TryGetValue(t, out cache))
            {
                mStackInstance.Pop(t);
                mWindowInstanceList.Remove(t);

                //  TODO
                cache.mOwner = null;
                GameObject.Destroy(cache.mInstance);
                Utility.LogColor("8080ff", string.Format("DestoryWnd {0}", t.ToString()));
            }
            else
            {
                Debug.Log(string.Format("mWindowInstanceList Can't find type [{0}]", t.ToString()));
            }
        }
Beispiel #10
0
        public async Task <UIForm> Load(UIType ui)
        {
            var uiPrefab = await GameEntry.Resource.LoadAsync <GameObject>("UI/UIForms/" + ui.ToString());

            var uiInstance = Instantiate(uiPrefab);

            uiFormsDic.Add(ui.ToString(), uiInstance);
            uiInstance.transform.SetParent(UIParent);
            return(uiInstance.GetComponent <UIForm>());
        }
Beispiel #11
0
        /// <summary>
        /// Gets the user interface object.
        /// </summary>
        /// <returns>The user interface object.</returns>
        /// <param name="_uiType">_ui type.</param>
        public GameObject GetUIObject(UIType _uiType)
        {
            GameObject _retObj = null;

            if (!dicOpenUIs.TryGetValue(_uiType, out _retObj))
            {
                throw new Exception("dicOpenUIs TryGetValue Failure! _uiType :" + _uiType.ToString());
            }
            return(_retObj);
        }
Beispiel #12
0
        /// <summary>
        /// 关闭界面。
        /// </summary>
        /// <param name="uiType">User interface type.</param>
        public void CloseUI(UIType _uiType)
        {
            GameObject _uiObj = null;

            if (!dicOpenUIs.TryGetValue(_uiType, out _uiObj))
            {
                Debug.Log("dicOpenUIs TryGetValue Failure! _uiType :" + _uiType.ToString());
                return;
            }
            CloseUI(_uiType, _uiObj);
        }
        public string Serialize()
        {
            string structure = "{{\"UIType\":\"{0}\",\"RecordType\":\"{1}\",\"RecordId\":\"{2}\",\"Definition\":\"{3}\"}}";

            return(string.Format(
                       structure,
                       UIType.ToString(),
                       UIRecordType,
                       UIRecordId.ToString(),
                       UIDefinition));
        }
Beispiel #14
0
 public void Show(UIType type)
 {
     if (_typeToUIPanel.ContainsKey(type))
     {
         _typeToUIPanel[type].gameObject.SetActive(true);
     }
     else
     {
         Load(type, GetPath(type.ToString()));
     }
 }
Beispiel #15
0
    public GameObject GetUIFromPool(UIType type)
    {
        foreach (GameObject obj in UI_Pool)
        {
            if (obj.name == type.ToString())
            {
                return(obj);
            }
        }

        return(null);
    }
Beispiel #16
0
    /*
     * private void Parse()
     *  {
     *
     *          csvFile = ResourceManager.Singleton.LoadResource<TextAsset>(path);
     *          reader = new CSVReader(csvFile);
     *
     *          for (int y = 0; y < reader.CSVRows; ++y)
     *          {
     *      UIType _key = (UIType)Enum.Parse(typeof(UIType), reader.CSVGrid[0, y]);
     *                  string _val = reader.CSVGrid[1, y];
     *                  csvData.Add(_key, _val);
     *          }
     *  }
     */

    public string GetUIBaseGOName(UIType type)
    {
        string str = type.ToString();

        //return csvData[type];

        if (!csvData.ContainsKey(str))
        {
            Debug.LogError("CSV DOES NOT contain this UITYPE at UIBaseDataSystem.cs 50 line.");
            return(null);
        }

        return(csvData[str]["Script"]);
    }
Beispiel #17
0
        public async Task Open(UIType ui)
        {
            UIForm uiForm = null;

            if (uiFormsDic.TryGetValue(ui.ToString(), out var uiInstance))
            {
                uiForm = uiInstance.GetComponent <UIForm>();
            }
            else
            {
                uiForm = await Load(ui);
            }
            await uiForm.Show();
        }
Beispiel #18
0
    public static UIBase Spawn(UIType uiType)
    {
        UIBase uiBase;

        if (Instance.uiDict.TryGetValue(uiType, out uiBase))
        {
            GameObject ob = Instantiate(uiBase.gameObject);
            return(ob.GetComponent <UIBase>());
        }
        else
        {
            Debug.LogError("Null prefab: " + uiType.ToString());
            return(null);
        }
    }
Beispiel #19
0
    public IEnumerator ShowUIpanel(UIType _type, UnityAction <GameObject> loadFinishHandler = null, float daly = 0)
    {
        yield return(new WaitForSeconds(daly));

        MyDebug.Log(_type.ToString());
        ResourcesLoader.Load <GameObject>(UIResources[_type], (goo) => {
            var go  = Instantiate(goo);
            var win = go.GetComponent <UIWindow>();
            win.GetComponent <Canvas>().sortingOrder = SortingOrder + 5;
            windows.Push(win);
            if (loadFinishHandler != null)
            {
                loadFinishHandler(go);
            }
        });
    }
Beispiel #20
0
    /// <summary>
    /// 获得斗地主小物件显示层
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="uiType"></param>
    /// <param name="cType"></param>
    /// <returns></returns>
    public T Get <T>(UIType uiType, CharacterType cType) where T : Component
    {
        string childName = uiType.ToString();
        //找到类型父物体
        Transform parent = transform.Find(childName);
        //找到该父物体下对应玩家的UI物体
        string    childName2 = cType.ToString();
        Transform go         = parent.Find(childName2);
        T         t          = go.GetComponent <T>();

        if (t == null)
        {
            t = go.gameObject.AddComponent <T>();
        }
        return(t);
    }
Beispiel #21
0
        /// <summary>
        /// 关闭界面。
        /// </summary>
        /// <param name="uiType">User interface type.</param>
        public void CloseUI(UIType _uiType)
        {
            if (dicOpenUIsCache.ContainsKey(_uiType))
            {
                dicOpenUIs.Remove(_uiType);
                dicOpenUIsCache[_uiType].SetActive(false);
                return;
            }
            GameObject _uiObj = null;

            if (!dicOpenUIs.TryGetValue(_uiType, out _uiObj))
            {
                Debug.Log("dicOpenUIs TryGetValue Failure! _uiType :" + _uiType.ToString());
                return;
            }

            CloseUI(_uiType, _uiObj);
        }
Beispiel #22
0
    public BasePanel PushPanel(UIType type)
    {
        if (panelDict == null)
        {
            panelDict = new Dictionary <UIType, BasePanel>();
        }

        BasePanel panel = null;

        if (panelDict.ContainsKey(type))
        {
            panel = panelDict[type];
        }
        else
        {
            panel = GetPanel(type, type.ToString());
            panelDict.Add(type, panel);
        }
        panel.OnEnter();
        return(panel);
    }
Beispiel #23
0
        /// <summary>
        /// Gets the type of the prefab path by.
        /// </summary>
        /// <returns>The prefab path by type.</returns>
        /// <param name="_uiType">_ui type.</param>
        public static string GetPrefabPathByType(UIType _uiType)
        {
            string _uiPrefab = string.Empty;

            switch (_uiType)
            {
            case UIType.TestOne:
                _uiPrefab = "TestUIOne";
                break;

            case UIType.TestTwo:
                _uiPrefab = "TestUITwo";
                break;

            case UIType.Login:
                _uiPrefab = "LoginView";
                break;

            case UIType.Waiting:
                _uiPrefab = "WaitingView";
                break;

            case UIType.AlertWindow:
                _uiPrefab = "WinView";
                break;

            case UIType.ShopEditor:
                _uiPrefab = "ShopView";
                break;

            case UIType.CompEditor:
                _uiPrefab = "MainView";
                break;

            default:
                Debug.Log("Not Find EnumUIType! type: " + _uiType.ToString());
                break;
            }
            return(UI_PREFAB + _uiPrefab);
        }
Beispiel #24
0
        /// <summary>
        /// Gets the type of the user interface script by.
        /// </summary>
        /// <returns>The user interface script by type.</returns>
        /// <param name="_uiType">_ui type.</param>
        public static System.Type GetUIScriptByType(UIType _uiType)
        {
            System.Type _scriptType = null;
            switch (_uiType)
            {
            case UIType.TestOne:
                _scriptType = typeof(TestOne);
                break;

            case UIType.TestTwo:
                _scriptType = typeof(TestTwo);
                break;

            case UIType.Login:
                _scriptType = typeof(LoginView);
                break;

            case UIType.Waiting:
                _scriptType = typeof(WaitingView);
                break;

            case UIType.AlertWindow:
                _scriptType = typeof(AlertWindowView);
                break;

            case UIType.ShopEditor:
                _scriptType = typeof(ShopView);
                break;

            case UIType.CompEditor:
                _scriptType = typeof(CompView);
                break;

            default:
                Debug.Log("Not Find EnumUIType! type: " + _uiType.ToString());
                break;
            }
            return(_scriptType);
        }
Beispiel #25
0
        public void Pop(UIType type)
        {
            StackData data = FindDataByType(ref type);

            if (data != null)
            {
                StackChunk chunk;
                if (mChunkWindow.TryGetValue(data.mInfo.WinType, out chunk))
                {
                    chunk.Pop(data);
                    mListWindow.Remove(data);
                    OnPopTrigger(ref data);
                }
                else
                {
                    Debug.LogError(string.Format("Can't find chunk [{0}], Key [{1}]", data.mInfo.WinType.ToString(), data.mInfo.Key.ToString()));
                }
            }
            else
            {
                Debug.Log(string.Format("Can't find type : {0}", type.ToString()));
            }
        }
Beispiel #26
0
    public static void CreatUI(string UIWindowName, string UIcameraKey, UIType UIType, UILayerManager UILayerManager, bool isAutoCreatePrefab)
    {
        GameObject uiGo = new GameObject(UIWindowName);

        Type         type      = EditorTool.GetType(UIWindowName);
        UIWindowBase uiBaseTmp = uiGo.AddComponent(type) as UIWindowBase;

        uiGo.layer = LayerMask.NameToLayer("UI");

        uiBaseTmp.m_UIType = UIType;

        Canvas canvas = uiGo.AddComponent <Canvas>();

        if (EditorExpand.isExistShortLayer(UIType.ToString()))
        {
            canvas.overrideSorting  = true;
            canvas.sortingLayerName = UIType.ToString();
        }

        uiGo.AddComponent <GraphicRaycaster>();

        RectTransform ui = uiGo.GetComponent <RectTransform>();

        ui.sizeDelta = Vector2.zero;
        ui.anchorMin = Vector2.zero;
        ui.anchorMax = Vector2.one;

        GameObject BgGo = new GameObject("BG");

        BgGo.layer = LayerMask.NameToLayer("UI");
        RectTransform Bg = BgGo.AddComponent <RectTransform>();

        Bg.SetParent(ui);
        Bg.sizeDelta = Vector2.zero;
        Bg.anchorMin = Vector2.zero;
        Bg.anchorMax = Vector2.one;

        GameObject rootGo = new GameObject("root");

        rootGo.layer = LayerMask.NameToLayer("UI");
        RectTransform root = rootGo.AddComponent <RectTransform>();

        root.SetParent(ui);
        root.sizeDelta = Vector2.zero;
        root.anchorMin = Vector2.zero;
        root.anchorMax = Vector2.one;

        uiBaseTmp.m_bgMask = BgGo;
        uiBaseTmp.m_uiRoot = rootGo;

        if (UILayerManager)
        {
            UILayerManager.SetLayer(uiBaseTmp);
        }

        if (isAutoCreatePrefab)
        {
            string Path = "Resources/UI/" + UIWindowName + "/" + UIWindowName + ".prefab";
            FileTool.CreatFilePath(Application.dataPath + "/" + Path);
            PrefabUtility.CreatePrefab("Assets/" + Path, uiGo, ReplacePrefabOptions.ConnectToPrefab);
        }

        ProjectWindowUtil.ShowCreatedAsset(uiGo);
    }
Beispiel #27
0
 //Actually do what ever the buttons should do.
 //last in animation row
 //what happens when the button is pressed should go here. ect play-btn pressed, start game
 private void FadeOutOver()
 {
     App.Instance.animations.Open(openNext.ToString(), 0);
 }
Beispiel #28
0
 //查找UI物体
 public GameObject FindUI(UIType uIType)
 {
     return(m_Canvas.transform.Find(uIType.ToString()).gameObject);
 }
Beispiel #29
0
        private ViewBase AddViewBaseComponent(GameObject go, UIType uiType)
        {
            ViewBase value = null;

            switch (uiType)
            {
            case UIType.Background:
                value                  = go.AddComponent <MainBackgroundView>();
                value.uiMenuDepth      = UIMenuDepth.Background;
                value.uiTransitionMode = UITransitionMode.None;
                break;

            case UIType.MainLeftBar:
                value                  = go.AddComponent <MainLeftBarView>();
                value.uiMenuDepth      = UIMenuDepth.LayerThree;
                value.uiTransitionMode = UITransitionMode.None;
                break;

            case UIType.MainTopBar:
                value                  = go.AddComponent <MainTopBarView>();
                value.uiMenuDepth      = UIMenuDepth.LayerFour;
                value.uiTransitionMode = UITransitionMode.None;
                break;

            case UIType.MainBottomBar:
                value                  = go.AddComponent <MainBottomBarView>();
                value.uiMenuDepth      = UIMenuDepth.LayerThree;
                value.uiTransitionMode = UITransitionMode.None;
                break;

            case UIType.MainMenu:
                value                  = go.AddComponent <MainMenuView>();
                value.uiMenuDepth      = UIMenuDepth.LayerOne;
                value.uiTransitionMode = UITransitionMode.Low;
                break;

            case UIType.StoreScreen:
                value                  = go.AddComponent <StoreView>();
                value.uiMenuDepth      = UIMenuDepth.LayerOne;
                value.uiTransitionMode = UITransitionMode.Middle;
                break;

            case UIType.StorePopUpUI:
                value                  = go.AddComponent <StorePopUpView>();
                value.uiMenuDepth      = UIMenuDepth.LayerFive;
                value.uiTransitionMode = UITransitionMode.None;
                break;

            case UIType.PlayerInfoUI:
                value                  = go.AddComponent <PlayerInfoView>();
                value.uiMenuDepth      = UIMenuDepth.LayerOne;
                value.uiTransitionMode = UITransitionMode.All;
                break;

            case UIType.ArmyManagementScreen:
                value                  = go.AddComponent <ArmyManagementView>();
                value.uiMenuDepth      = UIMenuDepth.LayerOne;
                value.uiTransitionMode = UITransitionMode.Middle;
                break;

            case UIType.LoginScreen:
                value                  = go.AddComponent <LoginView>();
                value.uiMenuDepth      = UIMenuDepth.LayerOne;
                value.uiTransitionMode = UITransitionMode.All;
                break;

            case UIType.BattleScreen:
                value                  = go.AddComponent <BattleView>();
                value.uiMenuDepth      = UIMenuDepth.LayerOne;
                value.uiTransitionMode = UITransitionMode.All;
                break;

            case UIType.SettingScreen:
                value                  = go.AddComponent <SettingView>();
                value.uiMenuDepth      = UIMenuDepth.LayerFive;
                value.uiTransitionMode = UITransitionMode.None;
                break;

            case UIType.FightMatchScreen:
                value                  = go.AddComponent <FightMatchView>();
                value.uiMenuDepth      = UIMenuDepth.LayerTwo;
                value.uiTransitionMode = UITransitionMode.All;
                break;

            case UIType.BlackMarketScreen:
                value                  = go.AddComponent <BlackMarketView>();
                value.uiMenuDepth      = UIMenuDepth.LayerOne;
                value.uiTransitionMode = UITransitionMode.Low;
                break;

            case UIType.BattleResultScreen:
                value                  = go.AddComponent <BattleResultView>();
                value.uiMenuDepth      = UIMenuDepth.LayerTwo;
                value.uiTransitionMode = UITransitionMode.All;
                break;

            case UIType.RuneMainUI:
                value                  = go.AddComponent <RuneMainView>();
                value.uiMenuDepth      = UIMenuDepth.LayerOne;
                value.uiTransitionMode = UITransitionMode.Middle;
                break;

            case UIType.UnitMainUI:
                value                  = go.AddComponent <UnitMainView>();
                value.uiMenuDepth      = UIMenuDepth.LayerOne;
                value.uiTransitionMode = UITransitionMode.Middle;
                break;

            case UIType.UnitInfoUI:
                value                  = go.AddComponent <UnitInfoView>();
                value.uiMenuDepth      = UIMenuDepth.LayerTwo;
                value.uiTransitionMode = UITransitionMode.Middle;
                break;

            case UIType.ChatMainUI:
                value                  = go.AddComponent <ChatMainView>();
                value.uiMenuDepth      = UIMenuDepth.LayerTwo;
                value.uiTransitionMode = UITransitionMode.All;
                break;

            case UIType.PlayerBagView:
                value                  = go.AddComponent <PlayerBagView>();
                value.uiMenuDepth      = UIMenuDepth.LayerOne;
                value.uiTransitionMode = UITransitionMode.Middle;
                break;

            case UIType.GainItemView:
                value                  = go.AddComponent <GainItemView>();
                value.uiMenuDepth      = UIMenuDepth.LayerFive;
                value.uiTransitionMode = UITransitionMode.None;
                break;

            case UIType.SocialScreen:
                value                  = go.AddComponent <SocialView>();
                value.uiMenuDepth      = UIMenuDepth.LayerOne;
                value.uiTransitionMode = UITransitionMode.Middle;
                break;

            case UIType.MailPopUpUI:
                value                  = go.AddComponent <MailPopUpView>();
                value.uiMenuDepth      = UIMenuDepth.LayerFive;
                value.uiTransitionMode = UITransitionMode.None;
                break;

            case UIType.RankView:
                value                  = go.AddComponent <RankView>();
                value.uiMenuDepth      = UIMenuDepth.LayerOne;
                value.uiTransitionMode = UITransitionMode.Middle;
                break;

            case UIType.BulletinBoardUI:
                value                  = go.AddComponent <BulletinBoardView>();
                value.uiMenuDepth      = UIMenuDepth.LayerFour;
                value.uiTransitionMode = UITransitionMode.None;
                break;

            case UIType.SignView:
                value                  = go.AddComponent <SignView>();
                value.uiMenuDepth      = UIMenuDepth.LayerFive;
                value.uiTransitionMode = UITransitionMode.None;
                break;

            case UIType.TutorialModeUI:
                value                  = go.AddComponent <TutorialModeView>();
                value.uiMenuDepth      = UIMenuDepth.LayerOne;
                value.uiTransitionMode = UITransitionMode.Low;
                break;

            case UIType.PlayBackUI:
                value                  = go.AddComponent <PlayBackView>();
                value.uiMenuDepth      = UIMenuDepth.LayerOne;
                value.uiTransitionMode = UITransitionMode.All;
                break;

            default:
                DebugUtils.LogError(DebugUtils.Type.UI, string.Format("UnKnow uiType! type = {0}", uiType.ToString()));
                return(null);
            }
            value.uiType = uiType;
            return(value);
        }
Beispiel #30
0
 public override string ToString()
 {
     return(">Name:" + name + ",ID:" + id + ",Type:" + type.ToString() + ",ShowMode:" + mode.ToString() + ",Collider:" + collider.ToString());
 }
Beispiel #31
0
 public void Pop( UIType type )
 {
     StackData data = FindDataByType(ref type);
     if (data != null)
     {
         StackChunk chunk;
         if (mChunkWindow.TryGetValue(data.mInfo.WinType, out chunk)) 
         {
             chunk.Pop(data);
             mListWindow.Remove(data);
             OnPopTrigger( ref data);
         }
         else
         {
             Debug.LogError(string.Format("Can't find chunk [{0}], Key [{1}]", data.mInfo.WinType.ToString(), data.mInfo.Key.ToString()));
         }
     }
     else
         Debug.Log(string.Format("Can't find type : {0}", type.ToString()));
 }