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; }
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; }
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(); }
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()); } }
protected override void ShowUI(View view) { var param = XObjectPool.Alloc <SampleView1.Param>(); m_view.SampleView.SetData(param); }
public static T AllocParam <T>() where T : class, IXPoolable, new() { return(XObjectPool.Alloc <T>()); }
public static void Free <T>(T obj) where T : class { XObjectPool.Free(obj); }