upgrade
This commit is contained in:
@@ -427,15 +427,15 @@ namespace Coolape
|
||||
}
|
||||
}
|
||||
|
||||
public static UnityWebRequest put(string url, string data, CLAssetType type,
|
||||
public static UnityWebRequest put(string url, object header, string data, CLAssetType type,
|
||||
object successCallback,
|
||||
object failedCallback, object orgs,
|
||||
bool isCheckTimeout = true, int maxFailTimes = 1)
|
||||
{
|
||||
return _put(url, data, type, successCallback, failedCallback, orgs, isCheckTimeout, maxFailTimes, 0);
|
||||
return _put(url, header, data, type, successCallback, failedCallback, orgs, isCheckTimeout, maxFailTimes, 0);
|
||||
}
|
||||
|
||||
private static UnityWebRequest _put(string url, string data, CLAssetType type,
|
||||
private static UnityWebRequest _put(string url, object header, string data, CLAssetType type,
|
||||
object successCallback,
|
||||
object failedCallback, object orgs, bool isCheckTimeout,
|
||||
int maxFailTimes, int failedTimes)
|
||||
@@ -447,11 +447,12 @@ namespace Coolape
|
||||
return null;
|
||||
self.enabled = true;
|
||||
UnityWebRequest www = UnityWebRequest.Put(url, data);
|
||||
setWWWHeader(www, header);
|
||||
Coroutine cor = self.StartCoroutine(
|
||||
self.exeWWW(www, url, type, successCallback, failedCallback, orgs, isCheckTimeout, maxFailTimes, failedTimes,
|
||||
(url2) =>
|
||||
{
|
||||
_put(url2, data, type, successCallback, failedCallback, orgs, isCheckTimeout, maxFailTimes, failedTimes + 1);
|
||||
_put(url2, header ,data, type, successCallback, failedCallback, orgs, isCheckTimeout, maxFailTimes, failedTimes + 1);
|
||||
}));
|
||||
wwwMap4Get[url] = cor;
|
||||
return www;
|
||||
@@ -464,16 +465,16 @@ namespace Coolape
|
||||
}
|
||||
}
|
||||
|
||||
public static UnityWebRequest put(string url, byte[] data, CLAssetType type,
|
||||
public static UnityWebRequest put(string url, object header, byte[] data, CLAssetType type,
|
||||
object successCallback,
|
||||
object failedCallback, object orgs, bool isCheckTimeout = true, int maxFailTimes = 1)
|
||||
{
|
||||
return _put(url, data, type,
|
||||
return _put(url, header, data, type,
|
||||
successCallback,
|
||||
failedCallback, orgs, isCheckTimeout,
|
||||
maxFailTimes, 0);
|
||||
}
|
||||
private static UnityWebRequest _put(string url, byte[] data, CLAssetType type,
|
||||
private static UnityWebRequest _put(string url, object header, byte[] data, CLAssetType type,
|
||||
object successCallback,
|
||||
object failedCallback, object orgs, bool isCheckTimeout,
|
||||
int maxFailTimes, int failedTimes)
|
||||
@@ -484,11 +485,12 @@ namespace Coolape
|
||||
return null;
|
||||
self.enabled = true;
|
||||
UnityWebRequest www = UnityWebRequest.Put(url, data);
|
||||
setWWWHeader(www, header);
|
||||
Coroutine cor = self.StartCoroutine(
|
||||
self.exeWWW(www, url, type, successCallback, failedCallback, orgs, isCheckTimeout, maxFailTimes, failedTimes,
|
||||
(url2) =>
|
||||
{
|
||||
_put(url2, data, type, successCallback, failedCallback, orgs, isCheckTimeout, maxFailTimes, failedTimes + 1);
|
||||
_put(url2, header, data, type, successCallback, failedCallback, orgs, isCheckTimeout, maxFailTimes, failedTimes + 1);
|
||||
}));
|
||||
wwwMap4Get[url] = cor;
|
||||
return www;
|
||||
@@ -517,11 +519,18 @@ namespace Coolape
|
||||
public static UnityWebRequest uploadFile(string url, string sectionName, string fileName, byte[] fileContent, CLAssetType type,
|
||||
object successCallback, object failedCallback, object orgs, bool isCheckTimeout = true, int maxFailTimes = 1)
|
||||
{
|
||||
return _uploadFile(url, sectionName, fileName, fileContent, type,
|
||||
return _uploadFile(url, null, sectionName, fileName, fileContent, type,
|
||||
successCallback, failedCallback, orgs, isCheckTimeout,
|
||||
maxFailTimes, 0);
|
||||
}
|
||||
private static UnityWebRequest _uploadFile(string url, string sectionName, string fileName, byte[] fileContent, CLAssetType type,
|
||||
public static UnityWebRequest uploadFile(string url, object header, string sectionName, string fileName, byte[] fileContent, CLAssetType type,
|
||||
object successCallback, object failedCallback, object orgs, bool isCheckTimeout = true, int maxFailTimes = 1)
|
||||
{
|
||||
return _uploadFile(url,header, sectionName, fileName, fileContent, type,
|
||||
successCallback, failedCallback, orgs, isCheckTimeout,
|
||||
maxFailTimes, 0);
|
||||
}
|
||||
private static UnityWebRequest _uploadFile(string url, object header, string sectionName, string fileName, byte[] fileContent, CLAssetType type,
|
||||
object successCallback, object failedCallback, object orgs, bool isCheckTimeout,
|
||||
int maxFailTimes, int failedTimes)
|
||||
{
|
||||
@@ -534,11 +543,12 @@ namespace Coolape
|
||||
List<IMultipartFormSection> multForom = new List<IMultipartFormSection>();
|
||||
multForom.Add(fileSection);
|
||||
UnityWebRequest www = UnityWebRequest.Post(url, multForom);
|
||||
setWWWHeader(www, header);
|
||||
Coroutine cor = self.StartCoroutine(
|
||||
self.exeWWW(www, url, type, successCallback, failedCallback, orgs, isCheckTimeout, maxFailTimes, failedTimes,
|
||||
(url2) =>
|
||||
{
|
||||
_uploadFile(url2, sectionName, fileName, fileContent, type, successCallback, failedCallback, orgs, isCheckTimeout, maxFailTimes, failedTimes + 1);
|
||||
_uploadFile(url2, header, sectionName, fileName, fileContent, type, successCallback, failedCallback, orgs, isCheckTimeout, maxFailTimes, failedTimes + 1);
|
||||
}));
|
||||
wwwMap4Get[url] = cor;
|
||||
return www;
|
||||
|
||||
@@ -70,8 +70,9 @@ namespace Coolape
|
||||
}
|
||||
if (panel != null) {
|
||||
oldClipOffset = panel.clipOffset;
|
||||
panel.cullWhileDragging = true;
|
||||
panel.onClipMove = OnMove;
|
||||
}
|
||||
panel.cullWhileDragging = true;
|
||||
}
|
||||
}
|
||||
return _scrollView;
|
||||
@@ -445,6 +446,10 @@ namespace Coolape
|
||||
|
||||
isCanCallOnEndList = true;
|
||||
isCanCallOnHeadList = true;
|
||||
if(list.Count == 0)
|
||||
{
|
||||
ExecuteOnShowHeadList();
|
||||
}
|
||||
} catch (System.Exception e) {
|
||||
Debug.LogError (e);
|
||||
}
|
||||
@@ -575,6 +580,27 @@ namespace Coolape
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnMove(UIPanel panel)
|
||||
{
|
||||
if (scrollView == null) return;
|
||||
bool restrictWithinPanel = false;
|
||||
if (list == null || list.Count == 0)
|
||||
{
|
||||
restrictWithinPanel = true;
|
||||
}
|
||||
|
||||
if (!restrictWithinPanel && firstVislable && int.Parse(head.name) == 0)
|
||||
{
|
||||
restrictWithinPanel = true;
|
||||
}
|
||||
if (!restrictWithinPanel && lastVisiable && int.Parse(tail.name) == list.Count - 1)
|
||||
{
|
||||
restrictWithinPanel = true;
|
||||
}
|
||||
scrollView.restrictWithinPanel = restrictWithinPanel;
|
||||
}
|
||||
|
||||
// 从原顺序位置移动到指定位置
|
||||
void moveCellPos (UIWidget moved, UIWidget target, int newIdx, int targetIdx)
|
||||
{
|
||||
|
||||
@@ -50,6 +50,7 @@ namespace Coolape
|
||||
oldScrollViewPos = _scrollView.transform.localPosition;
|
||||
oldClipOffset = _scrollView.panel.clipOffset;
|
||||
_scrollView.panel.cullWhileDragging = true;
|
||||
_scrollView.panel.onClipMove = OnMove;
|
||||
}
|
||||
}
|
||||
return _scrollView;
|
||||
@@ -703,5 +704,25 @@ namespace Coolape
|
||||
itemList.Insert (targetIndex, movedWidget);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnMove(UIPanel panel)
|
||||
{
|
||||
if (scrollView == null) return;
|
||||
bool restrictWithinPanel = false;
|
||||
if (list == null || list.Count == 0)
|
||||
{
|
||||
restrictWithinPanel = true;
|
||||
}
|
||||
|
||||
if (!restrictWithinPanel && firstVislable && int.Parse(head.name) == 0)
|
||||
{
|
||||
restrictWithinPanel = true;
|
||||
}
|
||||
if (!restrictWithinPanel && lastVisiable && int.Parse(tail.name) == list.Count - 1)
|
||||
{
|
||||
restrictWithinPanel = true;
|
||||
}
|
||||
scrollView.restrictWithinPanel = restrictWithinPanel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,9 +100,11 @@ public class CLUIScrollViewWithEvent : UIScrollView
|
||||
if (movement == Movement.Vertical && totalDelta.y <= 0)
|
||||
{
|
||||
ResetPosition();
|
||||
//RestrictWithinBounds(false);
|
||||
} else if (movement == Movement.Horizontal && totalDelta.x >= 0)
|
||||
{
|
||||
|
||||
//RestrictWithinBounds(false);
|
||||
ResetPosition();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user