/// <summary> /// 移除SVN资源 /// </summary> private static void RemoveSVNResources() { for (int i = s_CopyFolder.Count - 1; s_CopyFolder.Count > 0 && i >= 0; --i) { HS_Base.SystemDeleteFolder(s_CopyFolder[i]); } HS_File.Delete(Application.streamingAssetsPath + @"/Mainfest.data"); }
static public Cell Get(HS_UIListViewCell cell) { Transform t = cell.transform; Cell obj = new Cell(); obj._image = HS_Base.FindProperty <UnityEngine.UI.Image>(t, "Image"); obj._index = HS_Base.FindProperty <UnityEngine.UI.Text>(t, "Index"); obj._data = HS_Base.FindProperty <UnityEngine.UI.Text>(t, "Data"); return(obj); }
IEnumerator LoadData(string name) { string path = HS_Base.GetStreamingAssetsFilePath(name, "json"); WWW www = new WWW(path); yield return(www); textContent = www.text; yield return(true); }
protected override void OnCreated() { base.OnCreated(); Transform transform = this.transform; if (transform == HS_ViewManager.root.transform) { return; } this._image = HS_Base.FindProperty <UnityEngine.UI.Image>(transform, "Image"); }
static public void BuildForWindows(HS_EditDefine.HS_ChannelDefine channelDefine) { LoadConfig(); ChannelConfig channelConfig = S_AllChannelConfig[channelDefine.ToString()]; //string channel = channelConfig.channel; string packerName = channelConfig.packerName; string rootPath = S_RootPath; PlayerSettings.bundleIdentifier = packerName; PlayerSettings.defaultInterfaceOrientation = UIOrientation.LandscapeLeft; string path = rootPath + "/Client/Windows"; HS_Directory.CreateDirectory(path); try { HS_Base.SystemDeleteFolder(path); } catch (System.Exception _e) { D.LogForce("Ignore: " + _e.ToString()); } string lastDefineSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone); if (!string.IsNullOrEmpty(channelConfig.defineSymbols)) { PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, channelConfig.defineSymbols); } else { PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, ""); } if (!string.IsNullOrEmpty(lastDefineSymbols)) { PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, lastDefineSymbols); } path += "/" + packerName + ".exe"; //FilterEditorDLL(FilterEditorDLLModel.Assets2Backups); //更新SVN并且拷贝到streamingAssets SVNUpdate(RuntimePlatform.WindowsPlayer); BuildPipeline.BuildPlayer(GetBuildScenes(), path, BuildTarget.StandaloneWindows64, BuildOptions.None); //FilterEditorDLL(FilterEditorDLLModel.Backups2Assets); RemoveSVNResources(); AssetDatabase.Refresh(); System.Diagnostics.Process.Start(HS_Path.GetDirectoryName(path)); }
protected override void OnCreated() { base.OnCreated(); Transform transform = this.transform; if (transform == HS_ViewManager.root.transform) { return; } this._goldInfo = HS_Base.FindProperty <UnityEngine.RectTransform>(transform, "GoldInfo"); this._gold = HS_Base.FindProperty <UnityEngine.UI.Text>(transform, "GoldInfo/Gold"); this._gold.text = "1234567890"; this._diamondInfo = HS_Base.FindProperty <UnityEngine.RectTransform>(transform, "DiamondInfo"); this._diamond = HS_Base.FindProperty <UnityEngine.UI.Text>(transform, "DiamondInfo/Diamond"); this._diamond.text = "1234567890"; this._watering = HS_Base.FindProperty <UnityEngine.UI.Button>(transform, "HomeView/Watering"); this.RegisterButtonClickEvent(this._watering); this._home = HS_Base.FindProperty <UnityEngine.UI.Button>(transform, "HomeView/Home"); this.RegisterButtonClickEvent(this._home); this._strengthen = HS_Base.FindProperty <UnityEngine.UI.Button>(transform, "HomeView/Strengthen"); this.RegisterButtonClickEvent(this._strengthen); this._illustrations = HS_Base.FindProperty <UnityEngine.UI.Button>(transform, "HomeView/Illustrations"); this.RegisterButtonClickEvent(this._illustrations); this._weather = HS_Base.FindProperty <UnityEngine.UI.Image>(transform, "HomeView/Weather"); this._humidity = HS_Base.FindProperty <UnityEngine.UI.Image>(transform, "HomeView/Humidity"); this._stars1 = HS_Base.FindProperty <UnityEngine.UI.Image>(transform, "StrengthenView/Top/Stars/Stars1"); this._stars2 = HS_Base.FindProperty <UnityEngine.UI.Image>(transform, "StrengthenView/Top/Stars/Stars2"); this._stars3 = HS_Base.FindProperty <UnityEngine.UI.Image>(transform, "StrengthenView/Top/Stars/Stars3"); this._sceneName = HS_Base.FindProperty <UnityEngine.UI.Text>(transform, "StrengthenView/Top/Image (2)/SceneName"); this._sceneName.text = "名字名字"; this._strengthenViewClose = HS_Base.FindProperty <UnityEngine.UI.Button>(transform, "StrengthenView/StrengthenViewClose"); this.RegisterButtonClickEvent(this._strengthenViewClose); }
public static void SVNUpdate(RuntimePlatform platform) { string platformAssets = HS_PlatformRes.Directory[platform]; SVNSetiingWindows.Update(); string streamingAssetsPath = Application.streamingAssetsPath; HS_Directory.CreateDirectory(streamingAssetsPath); s_CopyFolder.Clear(); foreach (string p in SVNSetiingWindows.UpdatePaths) { string folderName = HS_Path.GetCurrentFolder(p); string fullFolderName = streamingAssetsPath + @"/" + folderName; try { HS_Base.SystemDeleteFolder(fullFolderName); } catch (System.Exception _e) { D.LogForce("Ignore: " + _e.ToString()); } } AssetDatabase.Refresh(); foreach (string p in SVNSetiingWindows.UpdatePaths) { string dstPath = streamingAssetsPath + @"/"; if (p.Contains("Assets")) { if (!p.Contains(platformAssets)) { continue; } dstPath += platformAssets; } else { dstPath += HS_Path.GetCurrentFolder(p); } s_CopyFolder.Add(dstPath); HS_Base.SystemCopyDirectory(p, dstPath, new string[] { ".svn", ".bat", ".dll" }); } AssetDatabase.Refresh(); HS_GenerateMD5.GenerateMD5(streamingAssetsPath, ""); }
public static void RefreshData() { if (PlayerPrefs.HasKey(UPDATE_PATH_LIST_KEY)) { string temp = PlayerPrefs.GetString(UPDATE_PATH_LIST_KEY); if (!string.IsNullOrEmpty(temp)) { string[] paths = temp.Split('|'); for (int i = 0; i < paths.Length; ++i) { paths[i] = HS_Base.N2C(paths[i]); } _UpdatePaths.Clear(); _UpdatePaths.AddRange(paths); D.LogForce("刷新SVN路径"); } } }
protected override void OnCreated() { base.OnCreated(); Transform transform = this.transform; if (transform == HS_ViewManager.root.transform) { return; } this._uIScrollRect = HS_Base.FindProperty <HS.UI.HS_UIListView>(transform, "UIScrollRect"); this._uIScrollRect.onInit += OnListViewInit; this._uIScrollRect.onCellCreated += OnCellCreated; this._uIScrollRect.onClick += OnListViewClick; this._uIScrollRect.onSelected += OnListViewSelected; this._uIScrollRect.onDeselected += OnListViewDeselected; }
protected override void OnCreated() { base.OnCreated(); Transform transform = this.transform; if (transform == HS_ViewManager.root.transform) { return; } this._start = HS_Base.FindProperty <UnityEngine.UI.Button>(transform, "Start"); this.RegisterButtonClickEvent(this._start); this._inputFieldPName = HS_Base.FindProperty <UnityEngine.UI.InputField>(transform, "InputFieldPName"); this.RegisterInputFieldEvent(this._inputFieldPName); this._inputName = HS_Base.FindProperty <UnityEngine.UI.InputField>(transform, "InputName"); this.RegisterInputFieldEvent(this._inputName); }
private void OnGUI() { _SVNArea.OnGUIUpdate(); GUILayout.BeginHorizontal(); _SVNLabel.OnGUIUpdate(); _SVNPathBut.OnGUIUpdate(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); _ResSaveLavel.OnGUIUpdate(); _ResSaveBut.OnGUIUpdate(); GUILayout.EndHorizontal(); _SVNArea.EndArea(); HS_Label.Create("需要更新的目录:").OnGUIUpdate(); HS_GUITool.BeginGroup(); { foreach (string path in UpdatePaths) { HS_Label.Create(path).OnGUIUpdate(); } } HS_GUITool.EndGroup(); GUILayout.BeginHorizontal(); HS_Button.Create("添加目录", () => { string temp = EditorUtility.OpenFolderPanel("选择路径", "", ""); if (!string.IsNullOrEmpty(temp) && !_UpdatePaths.Contains(temp)) { _UpdatePaths.Add(temp); temp = HS_Base.C2N(temp); if (!PlayerPrefs.HasKey(UPDATE_PATH_LIST_KEY)) { PlayerPrefs.SetString(UPDATE_PATH_LIST_KEY, temp); } else { string paths = PlayerPrefs.GetString(UPDATE_PATH_LIST_KEY); paths += "|" + temp; PlayerPrefs.SetString(UPDATE_PATH_LIST_KEY, paths); } } PlayerPrefs.Save(); }).OnGUIUpdate(); HS_Button.Create("清空目录", () => { if (EditorUtility.DisplayDialog("提示", "确定清空目录吗?", "确认", "取消")) { _UpdatePaths.Clear(); PlayerPrefs.DeleteKey(UPDATE_PATH_LIST_KEY); PlayerPrefs.Save(); } }).OnGUIUpdate(); GUILayout.EndHorizontal(); /* * HS_Button.Create("测试更新", () => * { * foreach (string p in UpdatePaths) * { * RunCommand(p, SVN_ROOT, " clear", true); * RunCommand(p, SVN_ROOT, " uodate", true); * } * }).OnGUIUpdate(); */ }
private void OnSendAsync() { int count = 0; int totalLen = 0; while (true) { HS_MsgWrapper msg = null; int len = 0; lock (((ICollection)_SendQueue).SyncRoot) { if (_SendQueue.Count <= 0) { break; } msg = _SendQueue.Peek(); if (totalLen + len > HS_Define.SEND_PACKET_MAX_LEN) { D.LogError("To send data is greater than the specified number of bytes"); break; } msg = _SendQueue.Dequeue(); } if (msg == null) { break; } lock (((ICollection)_SendBuffer).SyncRoot) { // int val = IPAddress.HostToNetworkOrder(len); // Array.Copy(BitConverter.GetBytes(val), 0, _SendBuffer, // totalLen, 4); // val = IPAddress.HostToNetworkOrder(msg.Opcode); // Array.Copy(BitConverter.GetBytes(val), 0, _SendBuffer, // totalLen + 4, 4); // Array.Copy(msg.Value, 0, _SendBuffer, totalLen + 8, len - 8); byte[] describeBuf = HS_Base.ConsolidationByteArray(C2JSecurityCodeBuf, Int2bytes(msg.Value.Length)); byte[] dataBuf = HS_Base.ConsolidationByteArray(describeBuf, msg.Value); len = dataBuf.Length; Array.Copy(dataBuf, 0, _SendBuffer, totalLen, len); } totalLen += len; count++; } if (totalLen > 0) { try { byte[] buf = new byte[totalLen]; Array.Copy(_SendBuffer, buf, totalLen); SocketAsyncEventArgs socketEventArg = new SocketAsyncEventArgs(); socketEventArg.RemoteEndPoint = _Socket.RemoteEndPoint; socketEventArg.SetBuffer(buf, 0, totalLen); socketEventArg.UserToken = null; socketEventArg.AcceptSocket = null; socketEventArg.Completed += OnSendCompleted; if (!_Socket.SendAsync(socketEventArg)) { OnSendCompleted(this, socketEventArg); } ++_SocketPendingSend; D.Log("发送次数 + "); } catch (SocketException _e) { this._Socket.Close(); D.LogError("SocketError:" + _e.Message); //Logger.LogError("SocketError:" + _e.Message); } catch (ObjectDisposedException _e) { this.OnDisconnect(this); this._Socket.Close(); D.LogError("SocketError:" + _e.Message); } } //_Socket.Send(_SendBuffer, 0, totalLen, SocketFlags.None); }