예제 #1
0
    public void RemovePanel <T>() where T : PanelBase, new()
    {
        var panel = MyGUIManager.GetInstance().GetOrCreatePanel <T>() as MyPanel;

        myPanels.Remove(panel);
        panel.Display(false);
    }
예제 #2
0
    public void AddPanel <T>() where T : PanelBase, new()
    {
        var panel = MyGUIManager.GetInstance().GetOrCreatePanel <T>() as MyPanel;

        myPanels.Add(panel);
        panel.Display(true);
    }
예제 #3
0
    public void ShowTips(int id)
    {
        TalkBase config = DB.TalkBaseMap[id];

        switch (config.taskType)
        {
        case TaskTypeDefs.tv:
            MyGUIManager.GetInstance().GetOrCreatePanel <TVTipsPanel>().Display(true);
            break;

        case TaskTypeDefs.task:
            var _task_panel = MyGUIManager.GetInstance().GetOrCreatePanel <MainTaskTipsPanel>();
            _task_panel.InitData(config, Vector2.zero);
            _task_panel.Display(true);
            break;

        case TaskTypeDefs.quanxiang:
            var panel = MyGUIManager.GetInstance().GetOrCreatePanel <WalkTipsPanel>();
            panel.InitData(config, Vector2.zero);
            panel.Display(true);
            break;

        case TaskTypeDefs.qipao:
            MyGUIManager.GetInstance().GetOrCreatePanel <QipaoTipsPanel>().Display(true);
            break;

        case TaskTypeDefs.pangbai:
            MyGUIManager.GetInstance().GetOrCreatePanel <PangbaiTipsPanel>().Display(true);
            break;

        default:
            Debug.LogError("ShowTips--没有定义该类型的tips");
            break;
        }
    }
예제 #4
0
    void BuildPanel()
    {
        //从res中获取预制体
        _gameObject = GameObject.Instantiate(Resources.Load <GameObject>(_panelResName));
        if (!_gameObject)
        {
            Debug.Log($"{_panelResName},Resources中找不到");
        }

        //加入管理
        MyGUIManager.GetInstance().AddPanelObject(this);
        canvas             = gameObject.GetComponent <Canvas>();
        canvas.renderMode  = RenderMode.ScreenSpaceCamera;
        canvas.worldCamera = Camera.main;
        InitPanel();


        if (_listener == null)
        {
            _listener = new MyPanelEventListener();
        }
        var eventBase = _gameObject.AddComponent <IUIEvent>();

        _listener.OnInit(this, eventBase);
    }
예제 #5
0
    private static void Log2UI(string text)
    {
        if (logPanel == null)
        {
            logPanel = MyGUIManager.GetInstance().GetOrCreatePanel <LogPanel>();
        }
        if (!logPanel.IsVisible)
        {
            logPanel.Display(true);
        }

        logPanel.UpdatePanel(text);
    }
예제 #6
0
    void BuildPanel()
    {
        //从res中获取预制体
        _gameObject = GameObject.Instantiate(Resources.Load <GameObject>("ui\\panel\\" + _panelResName));
        if (!_gameObject)
        {
            Debug.Log($"{_panelResName},Resources中找不到");
        }
        _gameObject.name = this._panelResName;
        _gameObject.transform.position = Vector3.zero;
        //加入管理
        MyGUIManager.GetInstance().AddPanelObject(this);

        if (_listener == null)
        {
            _listener = new MyPanelEventListener();
        }
        var eventBase = _gameObject.AddComponent <IUIEvent>();

        _listener.OnInit(this, eventBase);
    }
예제 #7
0
 public override void OnAppInit()
 {
     base.OnAppInit();
     MyGUIManager.GetInstance().GetOrCreatePanel <TestPanel>().Display(true);
 }