/** 初始化 */ private static void init() { if (!ShineSetting.isRelease) { //编辑器模式 ShineSetting.isEditor = true; } //如果运行中,就停止,防止unity的内存清空导致一堆无意义报错 if (EditorApplication.isPlaying) { EditorApplication.isPlaying = false; } EditorApplication.update += Update; EditorApplication.hierarchyChanged += OnHierarchyChanged; EditorApplication.hierarchyWindowItemOnGUI += HierarchyWindowItemOnGUI; EditorApplication.projectChanged += OnProjectChanged; EditorApplication.projectWindowItemOnGUI += ProjectWindowItemOnGUI; EditorApplication.modifierKeysChanged += OnModifierKeysChanged; EditorApplication.searchChanged += OnSearchChanged; EditorApplication.pauseStateChanged += OnPauseStateChanged; EditorApplication.playModeStateChanged += OnPlayModeStateChanged; PrefabUtility.prefabInstanceUpdated += onPrefabUpdated; _version = MathUtils.randomInt(); _callLaterList = new SList <Action>(); _updateList = new SList <Action>(); _isNewOnce = true; }
public IPAddress getOne() { if (_lastIndex == -1) { _lastIndex = MathUtils.randomInt(ipArr.Length); return(ipArr[_lastIndex]); } else { return(ipArr[(++_lastIndex) % ipArr.Length]); } }
private int findNewFreeOrRemoved() { int free = _freeValue; int newFree; { do { newFree = MathUtils.randomInt(); }while((newFree == free) || ((index(newFree)) >= 0)); } return(newFree); }
private char findNewFreeOrRemoved() { char free = _freeValue; char newFree; { do { newFree = (char)MathUtils.randomInt(); }while((newFree == free) || ((index(newFree)) >= 0)); } return(newFree); }
/// <summary> /// http请求 /// </summary> public static void httpRequest(string url, int method = HttpMethodType.Get, string data = null, Action <string> completeFunc = null, Action errorFunc = null) { if (url.IndexOf('?') == -1) { url += "?v=" + MathUtils.randomInt(1000000); } else { url += "&v=" + MathUtils.randomInt(1000000); } SimpleHttpRequest request = SimpleHttpRequest.create(); request._url = url; request._method = method; request._postData = data; request._completeFunc = completeFunc; request._errorFunc = errorFunc; request.send(); }