void createObject(Type typeOfObj, bool isInit, bool isUpdate, bool isFixUpdate = false, bool isLateUpdte = false) { if (gameSubSystemList_.ContainsKey(typeOfObj)) { TyLogger.LogError("already exist a Object " + typeOfObj.ToString()); } else { object t = Activator.CreateInstance(typeOfObj); gameSubSystemList_.Add(typeOfObj, t); if (isInit) { ((GameSubSystem)t).init(); } if (isUpdate) { gameSubSystemUpdateList_.Add(typeOfObj, (GameSubSystem)t); } if (isFixUpdate) { gameSubSystemFixUpdateList_.Add(typeOfObj, (GameSubSystem)t); } if (isLateUpdte) { gameSubSystemLateUpdateList_.Add(typeOfObj, (GameSubSystem)t); } } }
/// <summary> /// 得到窗体预制件上的Atlas /// </summary> /// <param name="index">atlas序号,从0开始</param> /// <returns>找不到返回NULL</returns> public UIAtlas getPrefabUIAtlas(int index) { if (atlas_ != null && index < atlas_.Length) { return(atlas_[index]); } TyLogger.LogError("can't find atlas " + index); return(null); }
void SceneHideLoading() { //UIhide() or Destroy; if (_hideLoadingCallBack != null) { TyLogger.Log("SceneHideLoading _hideLoadingCallBack -> only for test clime"); _hideLoadingCallBack(); _hideLoadingCallBack = null; } }
/// <summary> /// 初始化Bugly平台 /// </summary> /// <param name="info">初始化信息</param> static void initBugly(initInfo info) { if (agent_ == null) { agent_ = new TyBuglyAgent(); agent_.init(info); } else { TyLogger.LogError("SmCrashReport have already init"); } }
void autoReleaseRes() { _destroyWinCount++; if (_resReleaseSw.ElapsedMilliseconds > _maxDestroyWinAutoReleaseResTime && _destroyWinCount > _maxDestroyWinAutoReleaseResCount) { Resources.UnloadUnusedAssets(); _resReleaseSw.Reset(); _resReleaseSw.Start(); _destroyWinCount = 0; TyLogger.Log("UIWindowManager AutoReleaseRes"); } }
/// <summary> /// 显示窗口结束的计时结算 /// </summary> public void showTimeEnd() { float showTimeDuring = Time.realtimeSinceStartup - _showBeginTime; if (showTimeDuring > 1.0f && showTimeDuring < 10) { string str = windowName + RG_Utils.getLanguageString("CodeItem140"); #if ShowTimeMsgBox MsgBox.getInstance().show(str); #endif TyLogger.LogError(str); } }
/// <summary> /// 设置红点记录的状态,true是记录,false是清除 /// </summary> /// <param name="key"></param> /// <param name="state"></param> /// <returns>false表示没有设置成功</returns> public static bool SetPointState(string key, bool state) { int time = state ? (int)getNowSecond() : 0; try { PlayerPrefs.SetInt(key, time); return(true); } catch (System.Exception e) { TyLogger.LogError(e); return(false); } }
public void resetWhenBackToLogin() { TyLogger.Log("loading resetWhenBackToLogin"); StopAllCoroutines(); if (bundle != null) { bundle.Unload(false); bundle = null; } _isLoading = false; async = null; _loadingEndPreCallBack = null; _loadingEndCallBack = null; CancelInvoke(); }
/// <summary> /// 得到窗体预制件上的Atlas /// </summary> /// <param name="atlasName">atlas名称</param> /// <returns>找不到返回NULL</returns> public UIAtlas getPrefabUIAtlas(string atlasName) { if (atlas_ != null) { for (int i = 0; i < atlas_.Length; i++) { if (atlas_[i].name.Equals(atlasName)) { return(atlas_[i]); } } } TyLogger.LogError("can't find atlas " + atlasName); return(null); }
void Awake() { if (_uiPanel != null && _uiScrollView != null) { float panelSoftness = panelSoftness_; if (_uiScrollView.movement == UIScrollView.Movement.Horizontal) { _uiPanel.clipSoftness = new Vector2(panelSoftness, 0); } else if (_uiScrollView.movement == UIScrollView.Movement.Vertical) { _uiPanel.clipSoftness = new Vector2(0, panelSoftness); } } else { TyLogger.LogError("Can't fine UIPanel or UIScrollView"); } Destroy(this); }
IEnumerator <UnityWebRequest> ReqGameSvr(string id) { string url = "http://test.sporger.com:9040/login/platform?id=" + id; TyLogger.Log("url=" + url); UnityWebRequest www = new UnityWebRequest(url); yield return(www); if (!string.IsNullOrEmpty(www.error)) { TyLogger.Log(www.error); } else { TyLogger.Log(www.downloadHandler.text); //HttpLoginCallbackData httpLoginCallbackData = LitJson.JsonMapper.ToObject<HttpLoginCallbackData>(getData.text); } yield return(null); }
void Start() { _width = Screen.width; _height = Screen.height; if (Screen.height == 768 && Screen.width == 1024) { UIRoot uiroot = NGUITools.FindInParents <UIRoot>(this.gameObject); uiroot.scalingStyle = UIRoot.Scaling.Flexible; } else { UIRoot uiroot = NGUITools.FindInParents <UIRoot>(this.gameObject); uiroot.scalingStyle = UIRoot.Scaling.Constrained; uiroot.manualHeight = 960; if ((float)Screen.width / (float)Screen.height < 1.4f) { float height = Screen.width / 1280.0f * 960 / Screen.height; UICamera.mainCamera.rect = new Rect(0, (1 - height) / 2, 1, height); } if (Screen.height > 960) { int h = 960; if (Screen.height / 2 >= 960) { h = Screen.height / 2; } int width = (int)((float)Screen.width * h / (float)Screen.height); string channelID = ""; channelID = RG_Utils.callAndroidJava <string>("getChannelID"); if (channelID != null) { TyLogger.Log("ChannelID = " + channelID.ToString()); Screen.SetResolution(width, h, true); Debug.Log("SetReolution " + width + " " + h); _width = width; _height = h; } } } }
void DataCallBackHandler(AssetBundleInfo info) { TextAsset textAsset = info.mainObject as TextAsset; if (textAsset == null) { Debug.LogError("can not found this table:" + configType); return; } TyLogger.Log("ConfigCollect.CONFIG_ARRAY:" + configType); IFormatter formatter = new BinaryFormatter(); formatter.Binder = new UBinder(); MemoryStream stream = new MemoryStream(textAsset.bytes); object[] dataArr = formatter.Deserialize(stream) as object[]; IConfig[] iConfigArr = Array.ConvertAll <object, IConfig>(dataArr, delegate(object s) { return(s as IConfig); }); ConfigDataManager.addConfigData(configType, iConfigArr); stream.Close(); _loadProgress = 1.0f; _loadState = 3; }
/// <summary> /// 创建已经初始化好的游戏对象 /// </summary> /// <param name="t">游戏对象实例</param> /// <param name="typeOfObj">类型</param> /// <param name="isUpdate">是否需要更新</param> void createObject(object t, Type typeOfObj, bool isUpdate, bool isFixUpdate = false, bool isLateUpdte = false) { if (gameSubSystemList_.ContainsKey(typeOfObj)) { TyLogger.LogError("Already exist an Object " + typeOfObj.ToString()); } else { gameSubSystemList_.Add(typeOfObj, t); if (isUpdate) { gameSubSystemUpdateList_.Add(typeOfObj, (GameSubSystem)t); } if (isFixUpdate) { gameSubSystemFixUpdateList_.Add(typeOfObj, (GameSubSystem)t); } if (isLateUpdte) { gameSubSystemLateUpdateList_.Add(typeOfObj, (GameSubSystem)t); } } }
public static void collectInfo() { #if UNITY_IPHONE || UNITY_EDITOR collectRenderInfo(); if (SystemConfig.renderquality == Renderquality.Low) { _isMemoryNotMuch = true; } #elif UNITY_ANDROID && !UNITY_EDITOR RG_Utils.callAndroidJava("getMaxCpuFreq"); string graphicsDeviceName = SystemInfo.graphicsDeviceName; if (SystemInfo.graphicsMemorySize + SystemInfo.systemMemorySize <= 800 || (SystemInfo.graphicsMemorySize + SystemInfo.systemMemorySize < 1200 && !(graphicsDeviceName.Contains("Andreno") || graphicsDeviceName.Contains("Mali") || graphicsDeviceName.Contains("PowerVR") || graphicsDeviceName.Contains("Tegra")))) { _isMemoryNotMuch = true; TyLogger.Log("MemoryNotMuch"); } TyLogger.Log("graphicsDeviceName " + SystemInfo.graphicsDeviceName); #endif }