Ejemplo n.º 1
0
 private void ClearByTime(object sender, EventArgs e)
 {
     if (disposing)
     {
         return;
     }
     for (int i = 0; i < uis.Length; i++)
     {
         CGameUI ui = uis[i];
         if (null == ui)
         {
             continue;
         }
         if (ui.dontDestoryOnLoad)
         {
             continue;
         }
         if (ui.IsShow() || GameTimer.Within(ui.showTime, DISPOS_TIME) || ui.Layer == CUILayer.Free) //|| ui.IsMainFace
         {
             continue;
         }
         Remove(ui);
         ui.Dispose();
     }
 }
Ejemplo n.º 2
0
 public void CloseActiveUIs(CGameUI other)
 {
     if (other.Layer == CUILayer.FullWindow)
     {
         for (int i = 0; i < uis.Length; i++)
         {
             CGameUI ui = uis[i];
             if (null == ui || !ui.IsShow() || other == ui)
             {
                 continue;
             }
             if (other.Layer >= ui.Layer)
             {
                 other.AddCloseUI(ui);
             }
         }
     }
 }
Ejemplo n.º 3
0
    public void LoadUI(Type ui_type, object context = null, bool needwait = false)
    {
        if (ui_type == null || !ui_type.IsSubclassOf(typeof(CGameUI)))
        {
            return;
        }
        string  ui_name = rg.Match(ui_type.Name).Value;
        CGameUI exists  = Global.ui_mgr.Get(ui_name) as CGameUI;

        if (exists != null)
        {
            exists.context = context;//在界面还没有show前赋值所传的参数列表
            if (!exists.IsShow())
            {
                exists.Show();
            }
            exists.LoadUICallback();
            return;
        }
        // 防止重复加载
        if (IsLoading(ui_name))
        {
            return;
        }
        CGameUIAsset asset = CResourceFactory.CreateInstance <CGameUIAsset>(string.Format("res/ui/uiprefab/{0}.ui", ui_name).ToLower(), null);

        AddLoading(ui_name, asset);

        asset.RegisterCompleteCallback(delegate(CGameUIAsset e)
        {
            CGameUI ui = e.gameObject.AddComponent(ui_type) as CGameUI;
            ui.SetName(ui_name);
            ui.SetAsset(e);
            ui.context = context;
            Global.ui_mgr.Add(ui);
            ui.LoadUICallback();
            RemoveLoading(ui_name);
        });
    }