Esempio n. 1
0
    private Window CreateWindow(WindowMetaInfo metaInfo)
    {
        var path = metaInfo.WindowResourcePath;

        var prefab = ResMgr.Load <GameObject>(path);

        var winObj = GameObject.Instantiate(prefab);

        var tr = winObj.transform;

        tr.SetParent(_windowRootTr);

        var win = winObj.GetComponent(metaInfo.WindowType) as Window;

        if (win == null)
        {
            Debug.Log(string.Format("cannot get WindowComponent:{0} from window object:{1}", metaInfo.WindowType, path));

            win = winObj.AddComponent(metaInfo.WindowType) as Window;

            if (win == null)
            {
                Debug.LogError("cannot add WindowComponent to gameobject:" + metaInfo.WindowType);
            }
        }

        return(win);
    }
    public override void OnInit(WindowMetaInfo winMeta)
    {
        base.OnInit(winMeta);

        RegisterButtonCallback("Close", OnClickClose);
        RegisterButtonCallback("Buy", OnClickBuy);
    }
Esempio n. 3
0
    private WindowMetaInfo GetMetaInfoFromAttr(WindowMetaInfoAttribute attr)
    {
        var info = new WindowMetaInfo();

        info.ControllerType     = attr.ControllerTypeEnum;
        info.WindowResourcePath = attr.WindowResPath;
        info.WindowType         = attr.WindowType;
        info.WindowControllerCSharpClassType = attr.WindowControllerCSharpType;
        info.LuaScriptPath = attr.LuaScriptPath;

        return(info);
    }
Esempio n. 4
0
 /// <summary>
 /// WindowController的初始化,此时window并没有创建完成
 /// </summary>
 public virtual void OnInit(WindowMetaInfo winMeta)
 {
     _winMetaInfo = winMeta;
 }
Esempio n. 5
0
    public override void OnInit(WindowMetaInfo winMeta)
    {
        base.OnInit(winMeta);

        RegisterButtonCallback("ShowShop", OnClickShowShop);
    }
    public WindowController Create(WindowMetaInfo metaInfo)
    {
        var typ = metaInfo.WindowControllerCSharpClassType;

        return(System.Activator.CreateInstance(typ) as WindowController);
    }
Esempio n. 7
0
    private WindowController CreateWindowController(WindowMetaInfo metaInfo)
    {
        var ctrl = _winCtrlFactory.Create(metaInfo);

        return(ctrl);
    }