void GotoGame(string name) { Debug.Log("GotoGame:" + name); _gameBase = (UIGameBase)GameObject.Instantiate(gameBasePrefab); //_gameBase.mainCamera = mainCamera; // _gameBaseRun.mainCamera = mainCamera; _gameBase.Init(); _gameBase.SetController(this); UIViewController.ClonePrefabRectTransform(gameBasePrefab.gameObject, _gameBase.gameObject); RectTransform rctranParent = objController.transform.GetComponent <RectTransform>(); RectTransform rctran = _gameBase.GetComponent <RectTransform>(); float x, y, w, h; float adBannerHeight = 160f; adBannerHeight = 0; //poivt (0.5,0.5) // w = rctranParent.rect.width; // h = rctranParent.rect.height-adBannerHeight; // x = 0; // y = adBannerHeight/2; // rctran.sizeDelta = new Vector2(w,h); // rctran.anchoredPosition = new Vector2(x,y); // Vector2 pt = rctran.offsetMin; // pt.y = adBannerHeight; // if (gameType == AppType.NONGCHANG) // { // pt.y = 0; // } // rctran.offsetMin = pt; AppSceneBase.main.UpdateMainWorldRect(adBannerHeight); //显示横幅广告 AdKitCommon.main.InitAdBanner(); if (EnableUIAdBanner()) { uiAdBanner = (UIAdBanner)GameObject.Instantiate(uiAdBannerPrefab); uiAdBanner.SetViewParent(AppSceneBase.main.canvasMain.gameObject); UIViewController.ClonePrefabRectTransform(uiAdBannerPrefab.gameObject, uiAdBanner.gameObject); } ShowUserComment(); }
void LoadGame() { string name = gameType; string strPrefab = dirRootPrefab + "/" + GetGamePrefabName(); if (!Common.isBlankString(GameManager.main.pathGamePrefab)) { strPrefab = GameManager.main.pathGamePrefab; } Debug.Log("strPrefab=" + strPrefab); //Resources.Load 文件可以不区分大小写字母 GameObject obj = null; // if (!Device.isLandscape) // { // // string strPrefab_shu = strPrefab + "_shu"; // // GameObject objShu = PrefabCache.main.Load(strPrefab_shu); // // if (objShu != null) // // { // // obj = objShu; // // } // // else // { // obj = PrefabCache.main.Load(strPrefab); // } // } // else { obj = PrefabCache.main.Load(strPrefab); } if (obj == null) { Debug.Log("LoadGame obj is null"); } if (obj != null) { gameBasePrefab = obj.GetComponent <UIGameBase>(); } //gameBasePrefab.LoadPrefab(); }
void LoadGame() { string name = Common.appType; string strPrefab = "App/Prefab/Game/" + GetGamePrefabName(); Debug.Log("strPrefab=" + strPrefab); //Resources.Load 文件可以不区分大小写字母 GameObject obj = null; if (!Device.isLandscape) { string strPrefab_shu = strPrefab + "_shu"; GameObject objShu = PrefabCache.main.Load(strPrefab_shu); if (objShu != null) { obj = objShu; } else { obj = PrefabCache.main.Load(strPrefab); } } else { obj = PrefabCache.main.Load(strPrefab); } if (obj == null) { Debug.Log("LoadGame obj is null"); } if (obj != null) { gameBasePrefab = obj.GetComponent <UIGameBase>(); } //gameBasePrefab.LoadPrefab(); }