示例#1
0
    private UIBase LoadUISource(EnumUIName uiName, object args)
    {
        string     name = uiName.ToString();
        GameObject ui   = Resources.Load <GameObject>(GameConst.ResourceUrl.UI_URL + name);

        ui = GameObject.Instantiate(ui);
        ui.transform.parent        = mUIRoot;
        ui.transform.localScale    = Vector3.one;
        ui.transform.localPosition = Vector3.zero;
        ui.name = name;

        UIBase uiBase = ui.GetComponent <UIBase>();

        if (uiBase == null)
        {
            uiBase = ui.AddComponent(LuaStatic.GetType(name)) as UIBase;
        }
        mCachedUINameList.Add(uiName);
        mCachedUIDict[uiName] = uiBase;
        uiBase.OnLoadedUI(true, args);
        return(uiBase);
    }
示例#2
0
	private UIBase LoadUISource(EnumUIName uiName, object args) {
		string name = uiName.ToString();
		GameObject ui = Resources.Load<GameObject>(GameConst.ResourceUrl.UI_URL + name);
		ui = GameObject.Instantiate(ui);
		ui.transform.parent = mUIRoot;
		ui.transform.localScale = Vector3.one;
		ui.transform.localPosition = Vector3.zero;
		ui.name = name;

		UIBase uiBase = ui.GetComponent<UIBase>();
		if (uiBase == null) {
			uiBase = ui.AddComponent(LuaStatic.GetType(name)) as UIBase;
		}
		mCachedUINameList.Add(uiName);
		mCachedUIDict[uiName] = uiBase;
		uiBase.OnLoadedUI(true, args);
		return uiBase;
	}