示例#1
0
    public void openUI(UIEnum e, BaseData data)
    {
        BaseUI baseUI = null;

        if (!uis.TryGetValue(e, out baseUI))
        {
            string path = UIPath.getUIPath(e);
            ResMgr.Instance.load(path, (obj) =>
            {
                GameObject go = obj as GameObject;
                if (go != null)
                {
                    baseUI = go.GetComponent <BaseUI>();
                    if (baseUI == null)
                    {
                        Type t = UIPath.getType(e);
                        baseUI = go.AddComponent(t) as BaseUI;
                    }
                    baseUI.setData(data);
                    uis.Add(e, baseUI);
                }
            });
        }
        else
        {
            baseUI.setData(data);
            baseUI.setActive(true);
        }
    }
示例#2
0
 /// <summary>
 /// 关闭,但不销毁一个OpenedUIs中的UI
 /// </summary>
 /// <param name="ui"></param>
 public void CloseUI(UIEnum ui)
 {
     if (OpenedUIs.ContainsKey(ui))
     {
         OpenedUIs[ui].SetActive(false);
     }
 }
示例#3
0
 public void closeUI(UIEnum e)
 {
     if (uis.ContainsKey(e))
     {
         uis[e].setActive(false);
     }
 }
示例#4
0
    /// <summary>
    /// 打开指定列表UI 并关闭其它UI
    /// </summary>
    /// <param name="uiEnum"></param>
    public void openUIByTypeAndCloseOther(List <UIEnum> uiEnumList)
    {
        if (listCanvas == null || listCanvas.Length == 0 || uiEnumList == null || uiEnumList.Count == 0)
        {
            return;
        }
        int canvasSize = listCanvas.Length;

        for (int i = 0; i < canvasSize; i++)
        {
            bool          isOpenUi    = false;
            BaseUIControl itemControl = listCanvas[i];
            for (int j = 0; j < uiEnumList.Count; j++)
            {
                UIEnum uiEnum = uiEnumList[j];
                string uiName = uiEnum.ToString();
                if (itemControl.name.Equals(uiName))
                {
                    isOpenUi = true;
                }
            }
            if (isOpenUi)
            {
                itemControl.openUI();
            }
            else
            {
                itemControl.closeUI();
            }
        }
    }
示例#5
0
 public void RegistBehavirous(UIEnum side, UIPanel obj)
 {
     if (side != UIEnum.None && !allSideObj.ContainsKey(side))
     {
         allSideObj.Add(side, obj);
     }
 }
示例#6
0
        public void OpenPanelAsync(UIEnum panel, Action openFinish = null, object param = null)
        {
            PanelType panelType = uiTypes[panel];
            string    prefab    = panelType.uiPrefab;

            if (this.uis.ContainsKey(prefab))
            {
                return;
            }
            ResourcesComponent resourcesComponent = ETModel.Game.Scene.GetComponent <ResourcesComponent>();

            resourcesComponent.LoadBundle(prefab.StringToAB());
            GameObject bundleGameObject = (GameObject)resourcesComponent.GetAsset(prefab.StringToAB(), prefab);

            resourcesComponent.UnloadBundle(prefab.StringToAB());
            GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject);

            UI ui = ComponentFactory.Create <UI, string, GameObject>(prefab, gameObject, false);

            UIBase uibase = (UIBase)ui.AddComponent(panelType.panelType);

            uibase.OnInit(param);

            this.uis.Add(ui.Name, ui);
            ui.GameObject.transform.SetParent(this.Root.transform, false);
            uibase.OnShow(param);


            //Add(ui);

            if (openFinish != null)
            {
                openFinish();
            }
        }
示例#7
0
 public UIPanel GetBehavirous(UIEnum side)
 {
     if (side != UIEnum.None && allSideObj.ContainsKey(side))
     {
         return(allSideObj[side]);
     }
     return(null);
 }
示例#8
0
        public IActionResult Index(UIEnum ui)
        {
            var vm = CreateVM <CodeGenVM>();

            vm.UI        = ui;
            vm.EntryDir  = AppDomain.CurrentDomain.BaseDirectory;
            vm.AllModels = GlobaInfo.AllModels.ToListItems(x => x.Name, x => x.AssemblyQualifiedName);
            return(View(vm));
        }
示例#9
0
        void ChangePanel(UIEnum uIEnum)
        {
            if (_uiEnum != UIEnum.None && _uiEnum != uIEnum)
            {
                _uiManager.GetBehavirous(_uiEnum).DisablePanel();
            }

            _uiEnum = uIEnum;

            _uiManager.GetBehavirous(_uiEnum).ShowPanel();
        }
 private void baseShowUI(bool isShow, UIEnum uIEnum)
 {
     if (isShow)
     {
         uiMasterControl.openUIByTypeAndCloseOther(uIEnum);
     }
     else
     {
         uiMasterControl.openUIByTypeAndCloseOther(UIEnum.GameMainUI);
     }
 }
示例#11
0
    // isOnce是否是唯一性
    public bool PostMessage(UIEnum window, int message, System.Object param, bool isOnce = true)
    {
        UIWindowCenter group;

        if (!m_WndGroup.TryGetValue((int)window, out group) || group == null)
        {
            return(false);
        }
        group.OnPostMessage(message, param);
        return(true);
    }
示例#12
0
    public static string getUIPath(UIEnum e)
    {
        string path = null;

        switch (e)
        {
        case UIEnum.weaponSys:
            path = "UI/supplysUI";
            break;

        case UIEnum.weaponSysTips:
            path = "UI/weaponSysTips";
            break;

        case UIEnum.mainMeun:
            path = "UI/MainMeunUI";
            break;

        case UIEnum.skillUI:
            path = "UI/SkillUI";
            break;

        case UIEnum.mainPlayerUI:
            path = "UI/MainPlayerUI";
            break;

        case UIEnum.joyStickUI:
            path = "UI/JoyStickUI";
            break;

        case UIEnum.funcMenuUI:
            path = "UI/FuncMenuUI";
            break;

        case UIEnum.knapsack:
            path = "UI/KanpsackUI";
            break;

        case UIEnum.skillDetailUI:
            path = "UI/SkillDetailUI";
            break;

        case UIEnum.damageTipsUI:
            path = "UI/DamageTipsUI";
            break;

        default:
            Debug.Log("<color=red>没有这个UI枚举</color>");
            break;
        }
        return(path);
    }
示例#13
0
    //UI绑定脚本 对应枚举
    public static Type getType(UIEnum e)
    {
        Type t = null;

        switch (e)
        {
        case UIEnum.weaponSys:
            t = typeof(WeaponSysUI);
            break;

        case UIEnum.weaponSysTips:
            t = typeof(WeaponSysTips);
            break;

        case UIEnum.mainMeun:
            t = typeof(MainMeunUI);
            break;

        case UIEnum.skillUI:
            t = typeof(SkillUI);
            break;

        case UIEnum.mainPlayerUI:
            t = typeof(MainPlayerUI);
            break;

        case UIEnum.joyStickUI:
            t = typeof(JoyStickUI);
            break;

        case UIEnum.funcMenuUI:
            t = typeof(FuncMenuUI);
            break;

        case UIEnum.knapsack:
            t = typeof(KnapsackUI);
            break;

        case UIEnum.skillDetailUI:
            t = typeof(SkillDetailUI);
            break;

        case UIEnum.damageTipsUI:
            t = typeof(DamageTipsUI);
            break;

        default:
            Debug.Log("<color=red>没有这个UI枚举绑定脚本</color>");
            break;
        }
        return(t);
    }
示例#14
0
 private void SwitchTo(UIEnum next)
 {
     if (curUI == next)
     {
         listUI[(int)curUI].SetActive(!listUI[(int)curUI].activeSelf);
     }
     else
     {
         listUI[(int)curUI].SetActive(false);
         listUI[(int)next].SetActive(true);
         curUI = next;
     }
 }
示例#15
0
    public bool SendMessage(UIEnum window, int message, System.Object param)
    {
        UIWindowCenter group;

        if (m_WndGroup.TryGetValue((int)window, out group))
        {
            if (group == null)
            {
                return(false);
            }
            return(group.OnSendMessage(message, param));
        }
        return(false);
    }
示例#16
0
    public void OpenUI(UIEnum uiEnum)
    {
        switch (uiEnum)
        {
        case UIEnum.State:

            break;

        case UIEnum.Inventory:
            gameManager.InventoryController.Open();
            break;

        case UIEnum.Crafting:
            gameManager.CraftingController.Open();
            break;
        }
    }
示例#17
0
    /// <summary>
    /// 关闭指定UI
    /// </summary>
    /// <param name="uiEnum"></param>
    public void closeUIByType(UIEnum uiEnum)
    {
        if (listCanvas == null || listCanvas.Length == 0)
        {
            return;
        }
        int canvasSize = listCanvas.Length;

        for (int i = 0; i < canvasSize; i++)
        {
            BaseUIControl itemControl = listCanvas[i];
            string        uiName      = uiEnum.ToString();
            if (itemControl.name.Equals(uiName))
            {
                itemControl.closeUI();
            }
        }
    }
示例#18
0
    /// <summary>
    /// 获取UI
    /// </summary>
    /// <param name="uiName"></param>
    public T getUIByType <T>(UIEnum uiEnum) where T : BaseUIControl
    {
        if (listCanvas == null || listCanvas.Length == 0)
        {
            return(null);
        }
        int canvasSize = listCanvas.Length;

        for (int i = 0; i < canvasSize; i++)
        {
            BaseUIControl itemCanvas = listCanvas[i];
            string        uiName     = uiEnum.ToString();
            if (itemCanvas.name.Equals(uiName))
            {
                return((T)itemCanvas);
            }
        }
        return(null);
    }
示例#19
0
    /// <summary>
    /// UI是否展示
    /// </summary>
    public bool isShowUI(UIEnum uiEnum)
    {
        if (listCanvas == null || listCanvas.Length == 0)
        {
            return(false);
        }
        int canvasSize = listCanvas.Length;

        for (int i = 0; i < canvasSize; i++)
        {
            BaseUIControl itemControl = listCanvas[i];
            string        uiName      = uiEnum.ToString();
            if (itemControl.name.Equals(uiName))
            {
                return(itemControl.isShowUI());
            }
        }
        return(false);
    }
示例#20
0
    public GameObject OpenUI(UIEnum ui)
    {
        GameObject uiNode;

        //如果当前已打开过的UI列表有,则重新打开
        if (OpenedUIs.TryGetValue(ui, out uiNode))
        {
            uiNode.gameObject.SetActive(true);
            return(uiNode);
        }
        //否则从Prefebs中加载
        else
        {
            string     path = string.Format("Prefabs/UI/{0}", ui.ToString());
            GameObject UI   = Resources.Load(path) as GameObject;
            uiNode = Instantiate(UI, UIRoot);
            // uiNode.SetActive(false);

            OpenedUIs.Add(ui, uiNode);
            return(uiNode);
        }
    }
示例#21
0
 private void Start()
 {
     Debug.Log("start");
     curUI = UIEnum.login;
     DontDestroyOnLoad(gameObject);
 }
示例#22
0
 //UI是否是打开的
 public bool isOpen(UIEnum e)
 {
     return(uis.ContainsKey(e) && uis[e].gameObject.activeSelf);
 }
示例#23
0
 /// <summary>
 /// 获取UI
 /// </summary>
 /// <param name="uiEnum"></param>
 /// <returns></returns>
 public T GetUI <T>(UIEnum uiEnum) where T : BaseUIComponent
 {
     return(GetUI <T>(uiEnum.GetEnumName()));
 }
示例#24
0
 /// <summary>
 /// 根据枚举刷新UI
 /// </summary>
 /// <param name="uiEnum"></param>
 public void RefreshUI(UIEnum uiEnum, int layer = -1)
 {
     RefreshUI(uiEnum.GetEnumName(), layer);
 }
示例#25
0
 /// <summary>
 /// 通过UI的枚举开启UI并关闭其他UI
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="ui"></param>
 /// <returns></returns>
 public T OpenUIAndCloseOther <T>(UIEnum uiEnum, Action <T> actionBeforeOpen = null, int layer = -1) where T : BaseUIComponent
 {
     return(OpenUIAndCloseOther <T>(uiEnum.GetEnumName(), actionBeforeOpen, layer));
 }
示例#26
0
 /// <summary>
 /// 通过UI的枚举关闭UI
 /// </summary>
 /// <param name="uiEnum"></param>
 public void CloseUI(UIEnum uiEnum)
 {
     CloseUI(uiEnum.GetEnumName());
 }
示例#27
0
    /// <summary>
    /// 开启UI
    /// </summary>
    /// <param name="uiEnum"></param>
    public T OpenUI <T>(UIEnum uiEnum) where T : BaseUIComponent
    {
        string uiName = uiEnum.GetEnumName();

        return(OpenUI <T>(uiName));
    }
示例#28
0
 /// <summary>
 /// 根据UI的枚举获取UI列表
 /// </summary>
 /// <param name="uiEnum"></param>
 /// <returns></returns>
 public List <BaseUIComponent> GetUIList(UIEnum uiEnum)
 {
     return(GetUIList(uiEnum.GetEnumName()));
 }
示例#29
0
        //public void Add(UI ui)
        //{
        //    //ui.GameObject.GetComponent<Canvas>().worldCamera = this.Camera.GetComponent<Camera>();

        //    this.uis.Add(ui.Name, ui);
        //    //ui.Parent = this;

        //    ui.GameObject.transform.SetParent(this.Root.transform, false);
        //}

        public void Close(UIEnum panel)
        {
            PanelType panelType = uiTypes[panel];

            this.Remove(panelType.uiPrefab);
        }
示例#30
0
        public UI Get(UIEnum panel)
        {
            PanelType panelType = uiTypes[panel];

            return(Get(panelType.uiPrefab));
        }