Esempio n. 1
0
        public void ShowWindow(string name, object param = null)
        {
            XDebug.Log(XUIConst.Tag, $"ShowWindow {name}");
            XUIWindow window = null;

            if (m_dictWindows.ContainsKey(name))
            {
                window = m_dictWindows[name];
            }
            else
            {
                var paramBundle = new XUIParamBundle();
                paramBundle.AssetLoader        = AssetLoader;
                paramBundle.LocalizationLoader = LocalizationLoader;
                paramBundle.EventManager       = EventManager;
                paramBundle.MsgManager         = MsgManager;
                paramBundle.uiRoot             = uiRoot;
                paramBundle.TextureManager     = TextureManager;

                window = XObjectPool.Alloc <XUIWindow>();
                window.Init(this, paramBundle, name, param);
                m_listWindows.Add(window);
                m_dictWindows.Add(name, window);
            }
            window.DstState = XUIWindow.EnumState.Show;
            window.openTick = Time.realtimeSinceStartup;
        }
Esempio n. 2
0
 public void Term()
 {
     if (m_param != null)
     {
         XObjectPool.Free(m_param);
         m_param = null;
     }
 }
 public override void OnEnter(object obj)
 {
     for (int i = 0; i < m_node.children.Count; ++i)
     {
         m_hehaviors.Add(XObjectPool.Alloc <XBTBehavior>());
     }
     m_runEnter = true;
 }
Esempio n. 4
0
    public override void TickUI(float elapsedTime)
    {
        m_time += elapsedTime;

        var param = XObjectPool.Alloc <SampleView1.Param>();

        param.Name = m_time.ToString("f2");
        m_view.SampleView.SetData(param);
    }
 public override void OnLeave(object obj)
 {
     foreach (var behavior in m_hehaviors)
     {
         behavior.Stop(obj);
         XObjectPool.Free(behavior);
     }
     m_hehaviors.Clear();
 }
Esempio n. 6
0
 public void SetData(object param)
 {
     if (m_param != null)
     {
         XObjectPool.Free(m_param);
         m_param = null;
     }
     m_param = param as PARAM;
     SetData(m_view, m_param);
 }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            m_EventManager.PostEvent("test1", 100);
        }
        if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            m_EventManager.PostEvent("test2", 100, 200);
        }
        if (Input.GetKeyDown(KeyCode.Alpha3))
        {
            m_EventManager.PostEvent("test3", 100, 200, 300);
        }
        if (Input.GetKeyDown(KeyCode.Alpha4))
        {
            m_EventManager.PostEvent <XSampleEvent1>("test4", (evt) => { evt.value = 999; });
        }

        if (Input.GetKeyDown(KeyCode.L))
        {
            XDebug.Log("XObjectPool", XObjectPool.DumpLog());
        }
    }
Esempio n. 8
0
    protected override void ShowUI(View view)
    {
        var param = XObjectPool.Alloc <SampleView1.Param>();

        m_view.SampleView.SetData(param);
    }
Esempio n. 9
0
 public static T AllocParam <T>() where T : class, IXPoolable, new()
 {
     return(XObjectPool.Alloc <T>());
 }
Esempio n. 10
0
 public static void Free <T>(T obj) where T : class
 {
     XObjectPool.Free(obj);
 }