public void loadMainUI() { GameObject MainUI = RG_Utils.loadPrefeb("MainUIRoot", "Reserved/UI/MainUI/MainUIRoot"); if (UISystem_ != null) { MainUI.transform.parent = UISystem_.transform; uiRoot_ = MainUI.GetComponent <UIRoot>(); } commonUIAnchor_ = GameObject.Find("ComCenterAnchor"); loginUIAnchor_ = GameObject.Find("LoginCenterAnchor"); moviePanel_ = GameObject.Find("MoviePanel"); UICamera MainUICamera = MainUI.GetComponentInChildren <UICamera>(); GameObject MainUiWindow = RG_Utils.loadPrefeb("MainUIWindow", "Reserved/UI/MainUI/MainUIWindow"); MainUiWindow.gameObject.SetActive(true); MainUiWindow.transform.parent = MainUICamera.transform; mainUIPanel_ = GameObject.Find("MainUIPanel"); _tempParentUI = GameObject.Find("TempParentUI"); mainUIWindow_ = GameObject.Find("MainUIWindow"); UIWindow win = MainUiWindow.GetComponent <UIWindow>(); windowList_.Add("MainUIWindow", win); MainUiWindow.SetActive(false); }
//得到下载下来用于WWW加载时针对平台所用的路径,CS版本 public static string getDownLoadPathForPlatform_CS() { #if UNITY_EDITOR_WIN return(_editordownloadpath + getPlatformString()); #else return(RG_Utils.getDownloadPath() + "/" + getPlatformString()); #endif }
virtual public void realHide() { gameObject.SetActive(false); if (_isHide3DObjectWhenVisible) { RG_Utils.set3DObjectVisible(true); } visible_ = false; }
void Update() { if (_time > 0.3f) { RG_Utils.callAndroidJava("getMemory"); _time = 0; } _time += Time.deltaTime; UpdateGameInfo(); }
// Update is called once per frame void Update() { if (_time > _tipShowTime && isTipVisible() == false) { setTipVisible(true); } _time += Time.deltaTime; if (_time > 15.0f) { AutoHideMsgBox.getInstance().show(RG_Utils.getLanguageString("XXX")); hide(); } }
/// <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); } }
static public GameObject addPrefebToWindowStatic(GameObject parent, string path, UI_LAYER layer, string name = "") { GameObject go = RG_Utils.loadPrefeb(name, path); if (go != null) { go.transform.parent = parent.transform; UIWidget[] uiWindgets = go.GetComponentsInChildren <UIWidget>(true); foreach (UIWidget widget in uiWindgets) { widget.depth += (int)layer; } go.transform.localPosition = new Vector3(0, 0, -10); go.transform.localScale = new Vector3(1, 1, 1); } return(addGameObjectToWindowStatic(parent, go, layer, name, false)); }
/// <summary> /// 显示窗口 /// </summary> override public void show() { showTimeBegin(); base.show(); if (_hideOtherWindowWhenShow && !isVisible()) { Game.getInstance().findObject <UIWindowManager>().hideOtherWindow(this); } gameObject.SetActive(true); if (_isHide3DObjectWhenVisible && !_customSet3DObjectVisible) { RG_Utils.set3DObjectVisible(false); } if (_bgType != WinBackgroundType.Normal) { } visible_ = true; }
void Update() { if (_time > _tipShowTime && isTipVisible() == false) { setTipVisible(true); } _time += Time.deltaTime; if (_time > 50000.0f) { if (AutoHideMsgBox.getInstance() != null) { AutoHideMsgBox.getInstance().show(RG_Utils.getLanguageString("CodeItem143")); } hide(); } _pointTime += Time.deltaTime; if (_pointTime > _nextPointTime) { _pointTime = 0; _curPointId++; if (_curPointId >= 12) { _curPointId = 0; } } _textTime += Time.deltaTime; if (_textTime > _nextTextTime) { _textTime = 0; _tp2[_curTextId].ResetToBeginning(); _tp2[_curTextId].PlayForward(); _tp1[_curTextId].ResetToBeginning(); _tp1[_curTextId].PlayForward(); _curTextId++; if (_curTextId >= 6) { _curTextId = 0; } } }
//得到当前平台下载下来的存放bundle文件的路径,用于WWW加载 public static string getDownloadPathURL() { string PathURL = #if UNITY_EDITOR #if UNITY_EDITOR_WIN "file://" + _editordownloadpath; #else "file://" + RG_Utils.getDownloadPath() + "/"; #endif #elif UNITY_ANDROID "file://" + RG_Utils.getDownloadPath() + "/"; #elif UNITY_IPHONE "file://" + RG_Utils.getDownloadPath() + "/"; #elif UNITY_STANDALONE_WIN || UNITY_EDITOR || UNITY_WEBPLAYER || UNITY_WP8 "file://" + RG_Utils.getDownloadPath() + "/"; #else string.Empty; #endif return(PathURL); }
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; } } } }
/// <summary> /// 存储二进制文件到Application.persistentDataPath目录,因权限问题,在PC上会放到d:/androidtest /// </summary> /// <param name="fileName">文件名</param> /// <param name="bytes">二进制内容</param> /// <returns></returns> static public bool Save(string fileName, byte[] bytes) { #if UNITY_WEBPLAYER || UNITY_FLASH || UNITY_METRO || UNITY_WP8 || UNITY_WP_8_1 return(false); #else #if UNITY_EDITOR_WIN string path = _editordownloadpath + fileName; #else string path = RG_Utils.getDownloadPath() + "/" + fileName; #endif if (bytes == null) { if (File.Exists(path)) { File.Delete(path); } return(true); } FileStream file = null; try { file = File.Create(path); } catch (System.Exception ex) { Debug.LogError(ex.Message); return(false); } file.Write(bytes, 0, bytes.Length); file.Close(); return(true); #endif }
/// <summary> /// 显示waiting界面 /// </summary> /// <param name="info"></param> /// <param name="showTipTime"></param> /// <param name="showMsgVisible">判断是否显示‘玩命加载中’这几个字,true为显示</param> public void show(string info = "", float showTipTime = 0.5f, bool showMsgVisible = true) { count++; _text.text = info; if (info == "") { if (showMsgVisible) { _text.text = RG_Utils.getLanguageString("CodeItem145"); } else { _text.text = ""; } } //_text.enabled = info != ""; //_back.enabled = info != ""; //_thisGameObject.SetActive(true); _time = 0; _tipShowTime = showTipTime; _thisGameObject.SetActive(true); setTipVisible(false); }
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 }
public void show(string str) { gameObject.SetActive(true); _tip.text = str; gameObject.GetComponentInChildren <UISprite>().width = _tip.width + 24; TweenAlpha[] tpos = gameObject.GetComponentsInChildren <TweenAlpha>(); for (int i = 0; i < tpos.Length; i++) { //tpos[i].Reset(); tpos[i].ResetToBeginning(); tpos[i].PlayForward(); } try { if (str == null || str.Length < 3) { throw new System.Exception(); } } catch (System.Exception e) { TyCrashReport.reportException(e, RG_Utils.getLanguageString("CodeItem142")); } }