void InitValue() { bool isFirstRun = !Common.GetBool(AppString.STR_KEY_NOT_FIRST_RUN); mainCamera = Common.GetMainCamera(); if (main == null) { main = this; } Tongji.Init(Config.main.GetString("APPTONGJI_ID", "0")); Device.InitOrientation(); if (isFirstRun) { Common.gold = AppRes.GOLD_INIT_VALUE; //第一次安装 Common.SetBool(AppString.STR_KEY_NOT_FIRST_RUN, true); Common.SetBool(AppString.STR_KEY_BACKGROUND_MUSIC, true); int lanTag = (int)Application.systemLanguage; PlayerPrefs.SetInt(AppString.STR_KEY_LANGUAGE, lanTag); SystemLanguage lan = (SystemLanguage)lanTag; Language.main.SetLanguage(lan); } else { int lanTag = PlayerPrefs.GetInt(AppString.STR_KEY_LANGUAGE); SystemLanguage lan = (SystemLanguage)lanTag; //lan = SystemLanguage.English; Language.main.SetLanguage(lan); } }
void Awake() { if (AppSceneBase.main == null) { AppSceneBase.main = this; } isReLayout = false; IPInfo.main.StartParserInfo(); InitScalerMatch(); if (canvasCamera != null) { SetCanvasScalerMatch(canvasCamera.gameObject); } Common.CleanCache(); AdConfig.main.InitSDK(); InitValue(); //Component this.gameObject.AddComponent <AdKitCommon>(); this.gameObject.AddComponent <IAPCommon>(); this.gameObject.AddComponent <ShareCommon>(); this.gameObject.AddComponent <TTSCommon>(); //this.gameObject.AddComponent<MusicBgPlay>(); this.gameObject.AddComponent <AudioPlay>(); this.gameObject.AddComponent <PopUpManager>(); //app启动初始化多线程工具LOOM Loom loom = Loom.Current; //初始化广告id key等参数 AdConfig adcf = AdConfig.main; //bg // Texture2D tex = AppResImage.texMainBg; // if (tex) { //ios unity 2017.3.1 Sprite.Create 会出现crash // Sprite sp = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f)); // imageBg.sprite = sp; // RectTransform rctan = imageBg.GetComponent<RectTransform>(); // rctan.sizeDelta = new Vector2(tex.width, tex.height); } if (Common.isWeb) { GameManager.main.PreLoadDataForWeb(); } }