Esempio n. 1
0
    /// <summary>
    /// 首次进入这个界面
    /// </summary>
    protected override void OnInit()
    {
        eventMgr = new InterchangeableEventListenerMgr(this.OnHandler, 1);
        base.OnInit();
        GObject windObj = UIPackage.CreateObject(this.PackName, this.ResName);

        if (windObj == null)
        {
            throw new System.Exception("不存在包名:" + this.PackName + "/ResName=" + ResName);
        }

        this.contentPane = windObj.asCom;
        this.container.cachedTransform.position   = Vector3.zero;
        this.container.cachedTransform.localScale = Vector3.one;

        if (this.contentPane == null)
        {
            Debug.LogError("创建物体失败");
        }
        this.SetSize(GRoot.inst.width, GRoot.inst.height);


        var obj      = this.contentPane.GetChild(BlackBgName);
        var closeBtn = this.contentPane.GetChild(mCloseBtnName);

        if (closeBtn != null && closeBtn.asButton != null)
        {
            closeBtn.asButton.onClick.Add(this.OnBtnClose);
        }
        //if (obj != null)
        //{
        //    mBlackBg = obj.asImage;
        //    mBlackBg.pivot = GamUtil.CenterPivot;
        //}

        for (int i = 0; i < this.contentPane.numChildren; i++)
        {
            FairyGUI.GObject gObject = this.contentPane.GetChildAt(i);
            UIObjs[gObject.name] = gObject;
            if (gObject.name.StartsWith(btnNameStartsWith))
            {
                gObject.onClick.Add(a =>
                {
                    OnBtnClick(a);
                });
            }
        }

        foreach (Controller ctrl in this.contentPane.Controllers)
        {
            this.UICtrls[ctrl.name] = ctrl;
        }
        this.pivot = GamUtil.CenterPivot;
    }
Esempio n. 2
0
 public SceneBase()
 {
     eventMgr = new InterchangeableEventListenerMgr(this.OnHandler, 2);
 }
Esempio n. 3
0
 public BaseMode()
 {
     eventMgr = new InterchangeableEventListenerMgr(this.OnHandler,99);
 }