private void Start() { browserdata = Resources.Load <Browserdata>("Clientconfig"); switch (Application.internetReachability) { case NetworkReachability.NotReachable: netreachable = false; break; case NetworkReachability.ReachableViaCarrierDataNetwork: Uimanager.Getinstance().Showtips("当前网络为3G/4G"); netreachable = true; break; case NetworkReachability.ReachableViaLocalAreaNetwork: Uimanager.Getinstance().Showtips("已连接到WIFI"); netreachable = true; break; } GetNetreachable(true); }
protected void Projectconfig() { EditorGUILayout.BeginVertical("Box"); EditorGUILayout.LabelField("Prject config"); EditorGUILayout.BeginHorizontal("Box"); if (!string.IsNullOrEmpty(fullpath)) { EditorGUILayout.LabelField("Path: " + fullpath); } else { EditorGUILayout.LabelField("Path: " + tmppath); } EditorGUILayout.EndHorizontal(); if (GUILayout.Button("Select folder", "PreButton")) { fullpath = EditorUtility.SaveFilePanel("Create config", "", "", "asset"); } GUI.color = Color.white; if (GUILayout.Button("Save config")) { Projectconfig config = CreateInstance <Projectconfig>(); if (string.IsNullOrEmpty(fullpath)) { return; } int id = fullpath.IndexOf("Asset"); string shortpath = fullpath.Substring(id, fullpath.Length - id); AssetDatabase.CreateAsset(config, shortpath); EditorUtility.SetDirty(config); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(ImportAssetOptions.Default); EditorGUIUtility.PingObject(config); config = null; } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("Box"); EditorGUILayout.LabelField("Server config"); EditorGUILayout.BeginHorizontal("Box"); if (!string.IsNullOrEmpty(fullpath)) { EditorGUILayout.LabelField("Path: " + fullpath); } else { EditorGUILayout.LabelField("Path: " + tmppath); } EditorGUILayout.EndHorizontal(); if (GUILayout.Button("Select folder", "PreButton")) { fullpath = EditorUtility.SaveFilePanel("Create config", "", "", "asset"); } GUI.color = Color.white; if (GUILayout.Button("Save config")) { Browserdata data = CreateInstance <Browserdata>(); if (string.IsNullOrEmpty(fullpath)) { return; } int id = fullpath.IndexOf("Asset"); string shortpath = fullpath.Substring(id, fullpath.Length - id); AssetDatabase.CreateAsset(data, shortpath); AssetDatabase.SaveAssets(); EditorUtility.SetDirty(data); AssetDatabase.Refresh(ImportAssetOptions.Default); EditorGUIUtility.PingObject(data); data = null; } EditorGUILayout.EndVertical(); }