This commit is contained in:
2025-06-09 00:11:54 +08:00
parent d8c6eb0bd6
commit c773a6bb8d
11207 changed files with 48929 additions and 304 deletions

View File

@@ -0,0 +1,64 @@
/* INFINITY CODE 2013-2019 */
/* http://www.infinity-code.com */
using System;
using InfinityCode.RealWorldTerrain.ExtraTypes;
namespace InfinityCode.RealWorldTerrain.Webservices.Base
{
/// <summary>
/// The base class for working with the web services returns text response.
/// </summary>
public abstract class RealWorldTerrainTextWebServiceBase : RealWorldTerrainWebServiceBase
{
/// <summary>
/// Event that occurs when a response is received from webservice.
/// </summary>
public Action<string> OnComplete;
protected string _response;
/// <summary>
/// Gets a response from webservice.
/// </summary>
/// <value>
/// The response.
/// </value>
public string response
{
get { return _response; }
}
public override void Destroy()
{
if (OnDispose != null) OnDispose(this);
www = null;
_response = string.Empty;
_status = RequestStatus.disposed;
customData = null;
OnComplete = null;
OnFinish = null;
}
/// <summary>
/// Checks whether the response from webservice.
/// </summary>
protected void OnRequestComplete(RealWorldTerrainWWW www)
{
if (www != null && www.isDone)
{
_status = string.IsNullOrEmpty(www.error) ? RequestStatus.success : RequestStatus.error;
_response = _status == RequestStatus.success ? www.text : www.error;
if (OnComplete != null) OnComplete(_response);
if (OnFinish != null) OnFinish(this);
_status = RequestStatus.disposed;
_response = null;
this.www = null;
customData = null;
}
}
}
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6964b80ed1779b44daf4123e6800fe51
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@@ -0,0 +1,56 @@
/* INFINITY CODE 2013-2019 */
/* http://www.infinity-code.com */
using System;
using InfinityCode.RealWorldTerrain.ExtraTypes;
namespace InfinityCode.RealWorldTerrain.Webservices
{
/// <summary>
/// The base class for working with the web services.
/// </summary>
public abstract class RealWorldTerrainWebServiceBase
{
/// <summary>
/// Event that occurs when the current request instance is disposed.
/// </summary>
public Action<RealWorldTerrainWebServiceBase> OnDispose;
/// <summary>
/// Event that occurs after OnComplete, when the response from webservice processed.
/// </summary>
public Action<RealWorldTerrainWebServiceBase> OnFinish;
/// <summary>
/// In this variable you can put any data that you need to work with requests.
/// </summary>
public object customData;
protected RequestStatus _status;
protected RealWorldTerrainWWW www;
/// <summary>
/// Gets the current status of the request to webservice.
/// </summary>
/// <value>
/// The status.
/// </value>
public RequestStatus status
{
get { return _status; }
}
/// <summary>
/// Destroys the current request to webservice.
/// </summary>
public abstract void Destroy();
public enum RequestStatus
{
downloading,
success,
error,
disposed
}
}
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 11fb9bafc57bd534ba37013350da3f27
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData: