git同步

This commit is contained in:
高国正 2023-11-14 18:14:13 +08:00
parent 23273a2442
commit ad422e6d24
4673 changed files with 538697 additions and 164926 deletions

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: cadcc32d02c4ad64bac746b421b4bcdb
guid: 703b0f9330a621d4e90f92bdaac70f95
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4f35fd7f0e1447449a493e7e1759e4f4
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -583,5 +583,35 @@ MonoBehaviour:
deviceNum: "72\u82AF"
isInCabinet:
uPos:
- ID: 94
deviceType:
manufacturer:
deviceNum:
isInCabinet:
uPos:
- ID: 95
deviceType:
manufacturer:
deviceNum:
isInCabinet:
uPos:
- ID: 96
deviceType:
manufacturer:
deviceNum:
isInCabinet:
uPos:
- ID: 97
deviceType:
manufacturer:
deviceNum:
isInCabinet:
uPos:
- ID: 98
deviceType:
manufacturer:
deviceNum:
isInCabinet:
uPos:
path: "Assets/Adam/DataSheets/\u6574\u7406\u673A\u67DCU\u4F4D\u53F0\u8D26.xlsx"
sheetName: "\u6A21\u578B\u5E8F\u53F7"

View File

@ -83,14 +83,15 @@ public class DragController : MonoBehaviour, IBeginDragHandler, IEndDragHandler,
EndDragAction?.Invoke(targetObject);
CountUPos();
//模型错误微调
if (oriObjectPrefab.name == "1" || oriObjectPrefab.name == "14" || oriObjectPrefab.name == "15" || oriObjectPrefab.name == "83")
{
GameManager.Inst.MoveParentAndChildren(targetObject.transform, new Vector3(-0.25f, 0, 0));
}
else if (oriObjectPrefab.name == "18")
{
GameManager.Inst.MoveParentAndChildren(targetObject.transform, new Vector3(0, 0f, -0.02f));
}
GameManager.Inst.Model_error(oriObjectPrefab.name, targetObject.gameObject);
//if (oriObjectPrefab.name == "1" || oriObjectPrefab.name == "14" || oriObjectPrefab.name == "15" || oriObjectPrefab.name == "83")
//{
// GameManager.Inst.MoveParentAndChildren(targetObject.transform, new Vector3(-0.25f, 0, 0));
//}
//else if (oriObjectPrefab.name == "18")
//{
// GameManager.Inst.MoveParentAndChildren(targetObject.transform, new Vector3(0, 0f, -0.02f));
//}
targetObject.GetComponent<TransparentGlow>().F2();
currentUPosItem = null;
targetObject = null;

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 33b0e9b090de2a34faf28eae42076320
folderAsset: yes
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
{
"name": "BestHTTP",
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": true
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9069ac25d95ca17448a247f3bb1c769f
timeCreated: 1571210040
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
The latest documentation can be read online here: https://benedicht.github.io/BestHTTP-Documentation/

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1e156a48f38d6f04f9c643063bcaf535
timeCreated: 1571210052
licenseType: Store
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 79615ddf0d3b0fd4b9b5ebe8943947a9
folderAsset: yes
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 56badbd91a344cf49b819809ce60c94a
folderAsset: yes
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,593 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 1944314068052120}
m_IsPrefabParent: 1
--- !u!1 &1251304880022356
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224766109861186050}
- component: {fileID: 222007061184830686}
- component: {fileID: 114332842110793280}
- component: {fileID: 114741082604224458}
- component: {fileID: 114821562994013518}
- component: {fileID: 114970735310707698}
- component: {fileID: 114169851664053792}
m_Layer: 5
m_Name: Start Download Button
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1298646758441480
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224796360726838160}
- component: {fileID: 222450923967724424}
- component: {fileID: 114756570423530596}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1548055376625982
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224222599636736864}
- component: {fileID: 222263229427737546}
- component: {fileID: 114864362160119752}
- component: {fileID: 114863480533508966}
m_Layer: 5
m_Name: RawImage
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1549333168510042
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224641546219099906}
- component: {fileID: 222240980090431082}
- component: {fileID: 114444815419025578}
m_Layer: 5
m_Name: Header
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1928372766581374
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224044084468067872}
- component: {fileID: 222379004667598028}
- component: {fileID: 114378960042926580}
m_Layer: 5
m_Name: Status Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1944314068052120
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224637431015742208}
- component: {fileID: 114589682599655862}
- component: {fileID: 114248578834748736}
m_Layer: 5
m_Name: AssetBundle
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &114169851664053792
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1251304880022356}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1679637790, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreLayout: 0
m_MinWidth: -1
m_MinHeight: -1
m_PreferredWidth: -1
m_PreferredHeight: -1
m_FlexibleWidth: -1
m_FlexibleHeight: 0
m_LayoutPriority: 1
--- !u!114 &114248578834748736
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1944314068052120}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 03eab9c6191c5cd4c9613084e817bd29, type: 3}
m_Name:
m_EditorClassIdentifier:
Category: HTTP
DisplayName: Asset Bundle
Description: 'A small example that shows a possible way to download an AssetBundle
and load a resource from it.
<b>Features demoed in this example:</b>
-Using HTTPRequest without a callback
-Using HTTPRequest in a Coroutine
-Loading an AssetBundle from the downloaded bytes
-Automatic Caching'
_path: /AssetBundles/WebGL/demobundle.assetbundle
_assetnameInBundle: 9443182_orig
_statusText: {fileID: 114378960042926580}
_rawImage: {fileID: 114864362160119752}
_downloadButton: {fileID: 114741082604224458}
--- !u!114 &114332842110793280
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1251304880022356}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!114 &114378960042926580
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1928372766581374}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 0
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Status
--- !u!114 &114444815419025578
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1549333168510042}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 0
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 20
m_FontStyle: 1
m_BestFit: 0
m_MinSize: 2
m_MaxSize: 40
m_Alignment: 1
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Asset Bundle Example
--- !u!114 &114589682599655862
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1944314068052120}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1297475563, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 5
m_Right: 5
m_Top: 5
m_Bottom: 5
m_ChildAlignment: 0
m_Spacing: 5
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 0
m_ChildControlWidth: 1
m_ChildControlHeight: 1
--- !u!114 &114741082604224458
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1251304880022356}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 114332842110793280}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 114248578834748736}
m_MethodName: OnStartDownloadButton
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &114756570423530596
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1298646758441480}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Start Download
--- !u!114 &114821562994013518
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1251304880022356}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1297475563, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 5
m_Right: 5
m_Top: 5
m_Bottom: 5
m_ChildAlignment: 0
m_Spacing: 0
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 1
m_ChildControlWidth: 1
m_ChildControlHeight: 1
--- !u!114 &114863480533508966
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1548055376625982}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1679637790, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreLayout: 0
m_MinWidth: -1
m_MinHeight: -1
m_PreferredWidth: -1
m_PreferredHeight: -1
m_FlexibleWidth: -1
m_FlexibleHeight: 1
m_LayoutPriority: 1
--- !u!114 &114864362160119752
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1548055376625982}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -98529514, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Texture: {fileID: 0}
m_UVRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
--- !u!114 &114970735310707698
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1251304880022356}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1741964061, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalFit: 0
m_VerticalFit: 2
--- !u!222 &222007061184830686
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1251304880022356}
--- !u!222 &222240980090431082
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1549333168510042}
--- !u!222 &222263229427737546
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1548055376625982}
--- !u!222 &222379004667598028
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1928372766581374}
--- !u!222 &222450923967724424
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1298646758441480}
--- !u!224 &224044084468067872
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1928372766581374}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 224637431015742208}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224222599636736864
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1548055376625982}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 224637431015742208}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224637431015742208
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1944314068052120}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 224641546219099906}
- {fileID: 224044084468067872}
- {fileID: 224222599636736864}
- {fileID: 224766109861186050}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224641546219099906
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1549333168510042}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 224637431015742208}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224766109861186050
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1251304880022356}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 224796360726838160}
m_Father: {fileID: 224637431015742208}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 300, y: 0}
m_SizeDelta: {x: 590, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224796360726838160
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1298646758441480}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 224766109861186050}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 0a56a1df7e0b38848bb9bf237a577478
timeCreated: 1571226561
licenseType: Store
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,210 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using BestHTTP;
namespace BestHTTP.Examples.HTTP
{
public sealed class AssetBundleSample : BestHTTP.Examples.Helpers.SampleBase
{
#pragma warning disable 0649
[Tooltip("The url of the resource to download")]
[SerializeField]
private string _path = "/AssetBundles/WebGL/demobundle.assetbundle";
[SerializeField]
private string _assetnameInBundle = "9443182_orig";
[SerializeField]
private Text _statusText;
[SerializeField]
private RawImage _rawImage;
[SerializeField]
private Button _downloadButton;
#pragma warning restore
#region Private Fields
/// <summary>
/// Reference to the request to be able to call Abort on it.
/// </summary>
HTTPRequest request;
/// <summary>
/// The downloaded and cached AssetBundle
/// </summary>
AssetBundle cachedBundle;
#endregion
#region Unity Events
protected override void Start()
{
base.Start();
this._statusText.text = "Waiting for user interaction";
}
void OnDestroy()
{
if (this.request != null)
this.request.Abort();
this.request = null;
UnloadBundle();
}
/// <summary>
/// GUI button callback
/// </summary>
public void OnStartDownloadButton()
{
this._downloadButton.enabled = false;
UnloadBundle();
StartCoroutine(DownloadAssetBundle());
}
#endregion
#region Private Helper Functions
IEnumerator DownloadAssetBundle()
{
// Create and send our request
request = new HTTPRequest(new Uri(this.sampleSelector.BaseURL + this._path)).Send();
this._statusText.text = "Download started";
// Wait while it's finishes and add some fancy dots to display something while the user waits for it.
// A simple "yield return StartCoroutine(request);" would do the job too.
while (request.State < HTTPRequestStates.Finished)
{
yield return new WaitForSeconds(0.1f);
this._statusText.text += ".";
}
// Check the outcome of our request.
switch (request.State)
{
// The request finished without any problem.
case HTTPRequestStates.Finished:
if (request.Response.IsSuccess)
{
#if !BESTHTTP_DISABLE_CACHING
if (request.Response.IsFromCache)
this._statusText.text = "Loaded from local cache!";
else
this._statusText.text = "Downloaded!";
#else
this._statusText.text = "Downloaded!";
#endif
// Start creating the downloaded asset bundle
AssetBundleCreateRequest async =
#if UNITY_5_3_OR_NEWER
AssetBundle.LoadFromMemoryAsync(request.Response.Data);
#else
AssetBundle.CreateFromMemory(request.Response.Data);
#endif
// wait for it
yield return async;
BestHTTP.PlatformSupport.Memory.BufferPool.Release(request.Response.Data);
// And process the bundle
yield return StartCoroutine(ProcessAssetBundle(async.assetBundle));
}
else
{
this._statusText.text = string.Format("Request finished Successfully, but the server sent an error. Status Code: {0}-{1} Message: {2}",
request.Response.StatusCode,
request.Response.Message,
request.Response.DataAsText);
Debug.LogWarning(this._statusText.text);
}
break;
// The request finished with an unexpected error. The request's Exception property may contain more info about the error.
case HTTPRequestStates.Error:
this._statusText.text = "Request Finished with Error! " + (request.Exception != null ? (request.Exception.Message + "\n" + request.Exception.StackTrace) : "No Exception");
Debug.LogError(this._statusText.text);
break;
// The request aborted, initiated by the user.
case HTTPRequestStates.Aborted:
this._statusText.text = "Request Aborted!";
Debug.LogWarning(this._statusText.text);
break;
// Connecting to the server is timed out.
case HTTPRequestStates.ConnectionTimedOut:
this._statusText.text = "Connection Timed Out!";
Debug.LogError(this._statusText.text);
break;
// The request didn't finished in the given time.
case HTTPRequestStates.TimedOut:
this._statusText.text = "Processing the request Timed Out!";
Debug.LogError(this._statusText.text);
break;
}
this.request = null;
this._downloadButton.enabled = true;
}
/// <summary>
/// In this function we can do whatever we want with the freshly downloaded bundle.
/// In this example we will cache it for later use, and we will load a texture from it.
/// </summary>
IEnumerator ProcessAssetBundle(AssetBundle bundle)
{
if (bundle == null)
yield break;
// Save the bundle for future use
cachedBundle = bundle;
// Start loading the asset from the bundle
var asyncAsset =
#if UNITY_5_1 || UNITY_5_2 || UNITY_5_3_OR_NEWER
cachedBundle.LoadAssetAsync(this._assetnameInBundle, typeof(Texture2D));
#else
cachedBundle.LoadAsync(this._assetnameInBundle, typeof(Texture2D));
#endif
// wait til load
yield return asyncAsset;
// get the texture
this._rawImage.texture = asyncAsset.asset as Texture2D;
}
void UnloadBundle()
{
this._rawImage.texture = null;
if (cachedBundle != null)
{
cachedBundle.Unload(true);
cachedBundle = null;
}
}
#endregion
}
}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 03eab9c6191c5cd4c9613084e817bd29
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,197 @@
using System;
using System.Collections.Generic;
using System.IO;
using BestHTTP.Extensions;
using BestHTTP.PlatformSupport.Memory;
namespace BestHTTP
{
/// <summary>
/// Stream based implementation of the multipart/form-data Content-Type. Using this class reading a whole file into memory can be avoided.
/// This implementation expects that all streams has a final, accessible Length.
/// </summary>
public sealed class MultipartFormDataStream : System.IO.Stream
{
public override bool CanRead { get { return true; } }
public override bool CanSeek { get { return false; } }
public override bool CanWrite { get { return false; } }
public override long Length
{
get
{
// multipart/form-data requires a leading boundary that we can add when all streams are added.
// This final preparation could be user initiated, but we can do it automatically too when the HTTPRequest
// first access the Length property.
if (!this.prepared)
{
this.prepared = true;
this.Prepare();
}
return this._length;
}
}
private long _length;
public override long Position { get; set; }
/// <summary>
/// A random boundary generated in the constructor.
/// </summary>
private string boundary;
private Queue<StreamList> fields = new Queue<StreamList>(1);
private StreamList currentField;
private bool prepared;
public MultipartFormDataStream(HTTPRequest request)
{
this.boundary = "BestHTTP_MultipartFormDataStream_" + this.GetHashCode().ToString("X2");
request.SetHeader("Content-Type", "multipart/form-data; boundary=" + boundary);
request.UploadStream = this;
request.UseUploadStreamLength = true;
}
public void AddField(string fieldName, string value)
{
AddField(fieldName, value, System.Text.Encoding.UTF8);
}
public void AddField(string fieldName, string value, System.Text.Encoding encoding)
{
var enc = encoding ?? System.Text.Encoding.UTF8;
var byteCount = enc.GetByteCount(value);
var buffer = BufferPool.Get(byteCount, true);
var stream = new BufferPoolMemoryStream();
enc.GetBytes(value, 0, value.Length, buffer, 0);
stream.Write(buffer, 0, byteCount);
stream.Position = 0;
string mime = encoding != null ? "text/plain; charset=" + encoding.WebName : null;
AddStreamField(stream, fieldName, null, mime);
}
public void AddStreamField(System.IO.Stream stream, string fieldName)
{
AddStreamField(stream, fieldName, null, null);
}
public void AddStreamField(System.IO.Stream stream, string fieldName, string fileName)
{
AddStreamField(stream, fieldName, fileName, null);
}
public void AddStreamField(System.IO.Stream stream, string fieldName, string fileName, string mimeType)
{
var header = new BufferPoolMemoryStream();
header.WriteLine("--" + this.boundary);
header.WriteLine("Content-Disposition: form-data; name=\"" + fieldName + "\"" + (!string.IsNullOrEmpty(fileName) ? "; filename=\"" + fileName + "\"" : string.Empty));
// Set up Content-Type head for the form.
if (!string.IsNullOrEmpty(mimeType))
header.WriteLine("Content-Type: " + mimeType);
//header.WriteLine("Content-Length: " + stream.Length.ToString());
header.WriteLine();
header.Position = 0;
var footer = new BufferPoolMemoryStream();
footer.Write(HTTPRequest.EOL, 0, HTTPRequest.EOL.Length);
footer.Position = 0;
// all wrapped streams going to be disposed by the StreamList wrapper.
var wrapper = new StreamList(header, stream, footer);
try
{
if (this._length >= 0)
this._length += wrapper.Length;
}
catch
{
this._length = -1;
}
this.fields.Enqueue(wrapper);
}
/// <summary>
/// Adds the final boundary.
/// </summary>
private void Prepare()
{
var boundaryStream = new BufferPoolMemoryStream();
boundaryStream.WriteLine("--" + this.boundary + "--");
boundaryStream.Position = 0;
this.fields.Enqueue(new StreamList(boundaryStream));
if (this._length >= 0)
this._length += boundaryStream.Length;
}
public override int Read(byte[] buffer, int offset, int length)
{
if (this.currentField == null && this.fields.Count == 0)
return -1;
if (this.currentField == null && this.fields.Count > 0)
this.currentField = this.fields.Dequeue();
int readCount = 0;
do
{
// read from the current stream
int count = this.currentField.Read(buffer, offset + readCount, length - readCount);
if (count > 0)
readCount += count;
else
{
// if the current field's stream is empty, go for the next one.
// dispose the current one first
try
{
this.currentField.Dispose();
}
catch
{ }
// no more fields/streams? exit
if (this.fields.Count == 0)
break;
// grab the next one
this.currentField = this.fields.Dequeue();
}
// exit when we reach the length goal, or there's no more streams to read from
} while (readCount < length && this.fields.Count > 0);
return readCount;
}
public override long Seek(long offset, SeekOrigin origin)
{
throw new NotImplementedException();
}
public override void SetLength(long value)
{
throw new NotImplementedException();
}
public override void Write(byte[] buffer, int offset, int count)
{
throw new NotImplementedException();
}
public override void Flush() { }
}
}

View File

@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: d54866f088b8c154db3325a2771b58af
timeCreated: 1582886645
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: ceca5a2f4b7ce1e4fb307cc3d3e4624a
timeCreated: 1571229570
licenseType: Store
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,96 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using BestHTTP;
namespace BestHTTP.Examples.HTTP
{
public sealed class ResumableStreamingSample : StreamingSample
{
const string ProcessedBytesKey = "ProcessedBytes";
const string DownloadLengthKey = "DownloadLength";
/// <summary>
/// Expected content length
/// </summary>
protected override long DownloadLength { get { return PlayerPrefs.GetInt(this._downloadPath + DownloadLengthKey); } set { PlayerPrefs.SetInt(this._downloadPath + DownloadLengthKey, (int)value); } }
/// <summary>
/// Total processed bytes
/// </summary>
protected override long ProcessedBytes { get { return PlayerPrefs.GetInt(this._downloadPath + ProcessedBytesKey, 0); } set { PlayerPrefs.SetInt(this._downloadPath + ProcessedBytesKey, (int)value); } }
private long downloadStartedAt = 0;
protected override void Start()
{
base.Start();
// If we have a non-finished download, set the progress to the value where we left it
float progress = GetSavedProgress();
if (progress > 0.0f)
{
this._downloadProgressSlider.value = progress;
base._statusText.text = progress.ToString("F2");
}
}
protected override void SetupRequest()
{
base.SetupRequest();
// Are there any progress, that we can continue?
this.downloadStartedAt = this.ProcessedBytes;
if (this.downloadStartedAt > 0)
{
// Set the range header
request.SetRangeHeader(this.downloadStartedAt);
}
else
// This is a new request
DeleteKeys();
}
protected override void OnRequestFinished(HTTPRequest req, HTTPResponse resp)
{
base.OnRequestFinished(req, resp);
if (req.State == HTTPRequestStates.Finished && resp.IsSuccess)
DeleteKeys();
}
protected override void OnDownloadProgress(HTTPRequest originalRequest, long downloaded, long downloadLength)
{
double downloadPercent = ((this.downloadStartedAt + downloaded) / (double)this.DownloadLength) * 100;
this._downloadProgressSlider.value = (float)downloadPercent;
this._downloadProgressText.text = string.Format("{0:F1}%", downloadPercent);
}
protected override void ResetProcessedValues()
{
SetDataProcessedUI(this.ProcessedBytes, this.DownloadLength);
}
private float GetSavedProgress()
{
long down = this.ProcessedBytes;
long length = this.DownloadLength;
if (down > 0 && length > 0)
return (down / (float)length) * 100f;
return -1;
}
private void DeleteKeys()
{
PlayerPrefs.DeleteKey(this._downloadPath + ProcessedBytesKey);
PlayerPrefs.DeleteKey(this._downloadPath + DownloadLengthKey);
PlayerPrefs.Save();
}
}
}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 972fc2301f87c9e46bfb5523f2bc5090
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: cab27f13c267f9e42ab47de965b407b9
timeCreated: 1571294301
licenseType: Store
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,272 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using BestHTTP;
namespace BestHTTP.Examples.HTTP
{
public class StreamingSample : BestHTTP.Examples.Helpers.SampleBase
{
#pragma warning disable 0649
[Tooltip("The url of the resource to download")]
[SerializeField]
protected string _downloadPath = "/test100mb.dat";
[Header("Streaming Setup")]
[SerializeField]
protected RectTransform _streamingSetupRoot;
[SerializeField]
protected Slider _fragmentSizeSlider;
[SerializeField]
protected Text _fragmentSizeText;
[SerializeField]
protected Toggle _disableCacheToggle;
[Header("Reporting")]
[SerializeField]
protected RectTransform _reportingRoot;
[SerializeField]
protected Slider _downloadProgressSlider;
[SerializeField]
protected Text _downloadProgressText;
[SerializeField]
protected Slider _processedDataSlider;
[SerializeField]
protected Text _processedDataText;
[SerializeField]
protected Text _statusText;
[SerializeField]
protected Button _startDownload;
[SerializeField]
protected Button _cancelDownload;
#pragma warning restore
/// <summary>
/// Cached request to be able to abort it
/// </summary>
protected HTTPRequest request;
/// <summary>
/// Download(processing) progress. Its range is between [0..1]
/// </summary>
protected float progress;
/// <summary>
/// The fragment size that we will set to the request
/// </summary>
protected int fragmentSize = HTTPResponse.MinReadBufferSize;
protected virtual long DownloadLength { get; set; }
protected virtual long ProcessedBytes { get; set; }
protected override void Start()
{
base.Start();
this._streamingSetupRoot.gameObject.SetActive(true);
this._reportingRoot.gameObject.SetActive(false);
this._startDownload.interactable = true;
this._cancelDownload.interactable = false;
this._fragmentSizeSlider.value = (1024 * 1024 - HTTPResponse.MinReadBufferSize) / 1024;
this._fragmentSizeText.text = GUIHelper.GetBytesStr(1024 * 1024, 1);
}
protected void OnDestroy()
{
// Stop the download if we are leaving this example
if (request != null && request.State < HTTPRequestStates.Finished)
{
request.OnDownloadProgress = null;
request.Callback = null;
request.Abort();
}
}
public void OnFragmentSizeSliderChanged(float value)
{
this.fragmentSize = HTTPResponse.MinReadBufferSize + (int)value * 1024;
this._fragmentSizeText.text = GUIHelper.GetBytesStr(this.fragmentSize, 1);
}
public void Cancel()
{
if (this.request != null)
this.request.Abort();
}
protected virtual void SetupRequest()
{
request = new HTTPRequest(new Uri(base.sampleSelector.BaseURL + this._downloadPath), OnRequestFinished);
#if !BESTHTTP_DISABLE_CACHING
// If we are writing our own file set it to true(disable), so don't duplicate it on the file-system
request.DisableCache = this._disableCacheToggle.isOn;
#endif
request.StreamFragmentSize = fragmentSize;
request.Tag = DateTime.Now;
request.OnHeadersReceived += OnHeadersReceived;
request.OnDownloadProgress += OnDownloadProgress;
request.OnStreamingData += OnDataDownloaded;
}
public virtual void StartStreaming()
{
SetupRequest();
// Start Processing the request
request.Send();
this._statusText.text = "Download started!";
// UI
this._streamingSetupRoot.gameObject.SetActive(false);
this._reportingRoot.gameObject.SetActive(true);
this._startDownload.interactable = false;
this._cancelDownload.interactable = true;
ResetProcessedValues();
}
private void OnHeadersReceived(HTTPRequest req, HTTPResponse resp, Dictionary<string, List<string>> newHeaders)
{
var range = resp.GetRange();
if (range != null)
this.DownloadLength = range.ContentLength;
else
{
var contentLength = resp.GetFirstHeaderValue("content-length");
if (contentLength != null)
{
long length = 0;
if (long.TryParse(contentLength, out length))
this.DownloadLength = length;
}
}
}
protected virtual void OnRequestFinished(HTTPRequest req, HTTPResponse resp)
{
switch (req.State)
{
// The request finished without any problem.
case HTTPRequestStates.Finished:
if (resp.IsSuccess)
{
DateTime downloadStarted = (DateTime)req.Tag;
TimeSpan diff = DateTime.Now - downloadStarted;
this._statusText.text = string.Format("Streaming finished in {0:N0}ms", diff.TotalMilliseconds);
}
else
{
this._statusText.text = string.Format("Request finished Successfully, but the server sent an error. Status Code: {0}-{1} Message: {2}",
resp.StatusCode,
resp.Message,
resp.DataAsText);
Debug.LogWarning(this._statusText.text);
request = null;
}
break;
// The request finished with an unexpected error. The request's Exception property may contain more info about the error.
case HTTPRequestStates.Error:
this._statusText.text = "Request Finished with Error! " + (req.Exception != null ? (req.Exception.Message + "\n" + req.Exception.StackTrace) : "No Exception");
Debug.LogError(this._statusText.text);
request = null;
break;
// The request aborted, initiated by the user.
case HTTPRequestStates.Aborted:
this._statusText.text = "Request Aborted!";
Debug.LogWarning(this._statusText.text);
request = null;
break;
// Connecting to the server is timed out.
case HTTPRequestStates.ConnectionTimedOut:
this._statusText.text = "Connection Timed Out!";
Debug.LogError(this._statusText.text);
request = null;
break;
// The request didn't finished in the given time.
case HTTPRequestStates.TimedOut:
this._statusText.text = "Processing the request Timed Out!";
Debug.LogError(this._statusText.text);
request = null;
break;
}
// UI
this._streamingSetupRoot.gameObject.SetActive(true);
this._reportingRoot.gameObject.SetActive(false);
this._startDownload.interactable = true;
this._cancelDownload.interactable = false;
request = null;
}
protected virtual void OnDownloadProgress(HTTPRequest originalRequest, long downloaded, long downloadLength)
{
double downloadPercent = (downloaded / (double)downloadLength) * 100;
this._downloadProgressSlider.value = (float)downloadPercent;
this._downloadProgressText.text = string.Format("{0:F1}%", downloadPercent);
}
protected virtual bool OnDataDownloaded(HTTPRequest request, HTTPResponse response, byte[] dataFragment, int dataFragmentLength)
{
this.ProcessedBytes += dataFragmentLength;
SetDataProcessedUI(this.ProcessedBytes, this.DownloadLength);
// Use downloaded data
// Return true if dataFrament is processed so the plugin can recycle the byte[]
return true;
}
protected void SetDataProcessedUI(long processed, long length)
{
float processedPercent = (processed / (float)length) * 100f;
this._processedDataSlider.value = processedPercent;
this._processedDataText.text = GUIHelper.GetBytesStr(processed, 0);
}
protected virtual void ResetProcessedValues()
{
this.ProcessedBytes = 0;
this.DownloadLength = 0;
SetDataProcessedUI(this.ProcessedBytes, this.DownloadLength);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7608ce95dba469c42b49baa85e3c300c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 1b7ac2a0c58362148840c49056fa7bda
timeCreated: 1571294809
licenseType: Store
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,159 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using BestHTTP;
namespace BestHTTP.Examples.HTTP
{
public sealed class TextureDownloadSample : BestHTTP.Examples.Helpers.SampleBase
{
#pragma warning disable 0649
[Header("Texture Download Example")]
[Tooltip("The URL of the server that will serve the image resources")]
[SerializeField]
private string _path = "/images/Demo/";
[Tooltip("The downloadable images")]
[SerializeField]
private string[] _imageNames = new string[9] { "One.png", "Two.png", "Three.png", "Four.png", "Five.png", "Six.png", "Seven.png", "Eight.png", "Nine.png" };
[SerializeField]
private RawImage[] _images = new RawImage[0];
[SerializeField]
private Text _maxConnectionPerServerLabel;
[SerializeField]
private Text _cacheLabel;
#pragma warning restore
private byte savedMaxConnectionPerServer;
#if !BESTHTTP_DISABLE_CACHING
private bool allDownloadedFromLocalCache;
#endif
private List<HTTPRequest> activeRequests = new List<HTTPRequest>();
protected override void Start()
{
base.Start();
this.savedMaxConnectionPerServer = HTTPManager.MaxConnectionPerServer;
// Set a well observable value
// This is how many concurrent requests can be made to a server
HTTPManager.MaxConnectionPerServer = 1;
this._maxConnectionPerServerLabel.text = HTTPManager.MaxConnectionPerServer.ToString();
}
void OnDestroy()
{
// Set back to its defualt value.
HTTPManager.MaxConnectionPerServer = this.savedMaxConnectionPerServer;
foreach (var request in this.activeRequests)
request.Abort();
this.activeRequests.Clear();
}
public void OnMaxConnectionPerServerChanged(float value)
{
HTTPManager.MaxConnectionPerServer = (byte)Mathf.RoundToInt(value);
this._maxConnectionPerServerLabel.text = HTTPManager.MaxConnectionPerServer.ToString();
}
public void DownloadImages()
{
// Set these metadatas to its initial values
#if !BESTHTTP_DISABLE_CACHING
allDownloadedFromLocalCache = true;
#endif
for (int i = 0; i < _imageNames.Length; ++i)
{
// Set a blank placeholder texture, overriding previously downloaded texture
this._images[i].texture = null;
// Construct the request
var request = new HTTPRequest(new Uri(this.sampleSelector.BaseURL + this._path + this._imageNames[i]), ImageDownloaded);
// Set the Tag property, we can use it as a general storage bound to the request
request.Tag = this._images[i];
// Send out the request
request.Send();
this.activeRequests.Add(request);
}
this._cacheLabel.text = string.Empty;
}
/// <summary>
/// Callback function of the image download http requests
/// </summary>
void ImageDownloaded(HTTPRequest req, HTTPResponse resp)
{
switch (req.State)
{
// The request finished without any problem.
case HTTPRequestStates.Finished:
if (resp.IsSuccess)
{
// The target RawImage reference is stored in the Tag property
RawImage rawImage = req.Tag as RawImage;
rawImage.texture = resp.DataAsTexture2D;
#if !BESTHTTP_DISABLE_CACHING
// Update the cache-info variable
allDownloadedFromLocalCache = allDownloadedFromLocalCache && resp.IsFromCache;
#endif
}
else
{
Debug.LogWarning(string.Format("Request finished Successfully, but the server sent an error. Status Code: {0}-{1} Message: {2}",
resp.StatusCode,
resp.Message,
resp.DataAsText));
}
break;
// The request finished with an unexpected error. The request's Exception property may contain more info about the error.
case HTTPRequestStates.Error:
Debug.LogError("Request Finished with Error! " + (req.Exception != null ? (req.Exception.Message + "\n" + req.Exception.StackTrace) : "No Exception"));
break;
// The request aborted, initiated by the user.
case HTTPRequestStates.Aborted:
Debug.LogWarning("Request Aborted!");
break;
// Connecting to the server is timed out.
case HTTPRequestStates.ConnectionTimedOut:
Debug.LogError("Connection Timed Out!");
break;
// The request didn't finished in the given time.
case HTTPRequestStates.TimedOut:
Debug.LogError("Processing the request Timed Out!");
break;
}
this.activeRequests.Remove(req);
if (this.activeRequests.Count == 0)
{
#if !BESTHTTP_DISABLE_CACHING
if (this.allDownloadedFromLocalCache)
this._cacheLabel.text = "All images loaded from local cache!";
else
#endif
this._cacheLabel.text = string.Empty;
}
}
}
}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: af6ffe2bbf96d2b49ba3ef0713511d45
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,222 @@
using BestHTTP;
using System;
using System.IO;
using System.Threading;
namespace BestHTTP.Examples
{
public sealed class UploadStream : Stream
{
#region Private Fields
/// <summary>
/// Buffer for reads
/// </summary>
MemoryStream ReadBuffer = new MemoryStream();
/// <summary>
/// Buffer for writes
/// </summary>
MemoryStream WriteBuffer = new MemoryStream();
/// <summary>
/// Indicates that we will not write more data to this stream
/// </summary>
bool noMoreData;
/// <summary>
/// For thread synchronization
/// </summary>
AutoResetEvent ARE = new AutoResetEvent(false);
/// <summary>
/// For thread synchronization
/// </summary>
object locker = new object();
#endregion
#region Properties
/// <summary>
/// Name of this stream for easier debugging
/// </summary>
public string Name { get; private set; }
/// <summary>
/// true if we are read all data from the read buffer
/// </summary>
private bool IsReadBufferEmpty { get { lock (locker) return ReadBuffer.Position == ReadBuffer.Length; } }
#endregion
#region Constructors
public UploadStream(string name)
: this()
{
this.Name = name;
}
public UploadStream()
{
this.ReadBuffer = new MemoryStream();
this.WriteBuffer = new MemoryStream();
this.Name = string.Empty;
}
#endregion
#region Stream Implementation
public override int Read(byte[] buffer, int offset, int count)
{
// We will not push more data to the write buffer
if (noMoreData)
{
// No data left in the read buffer
if (ReadBuffer.Position == ReadBuffer.Length)
{
// Is there any data in the write buffer? If so, switch the buffers
if (WriteBuffer.Length > 0)
SwitchBuffers();
else
{
HTTPManager.Logger.Information("UploadStream", string.Format("{0} - Read - End Of Stream", this.Name));
return -1;
}
}
else
return ReadBuffer.Read(buffer, offset, count);
}
// There are no more data in the read buffer? Wait for it.
if (IsReadBufferEmpty)
{
ARE.WaitOne();
lock (locker)
if (IsReadBufferEmpty && WriteBuffer.Length > 0)
SwitchBuffers();
}
int read = -1;
lock (locker)
read = ReadBuffer.Read(buffer, offset, count);
return read;
}
public override void Write(byte[] buffer, int offset, int count)
{
if (noMoreData)
throw new System.ArgumentException("noMoreData already set!");
lock (locker)
{
WriteBuffer.Write(buffer, offset, count);
SwitchBuffers();
}
ARE.Set();
}
public override void Flush()
{
Finish();
}
#endregion
#region Dispose Implementation
protected override void Dispose(bool disposing)
{
if (disposing)
{
HTTPManager.Logger.Information("UploadStream", string.Format("{0} - Dispose", this.Name));
ReadBuffer.Dispose();
ReadBuffer = null;
WriteBuffer.Dispose();
WriteBuffer = null;
#if NETFX_CORE
ARE.Dispose();
#else
ARE.Close();
#endif
ARE = null;
}
base.Dispose(disposing);
}
#endregion
#region Helper Functions
public void Finish()
{
if (noMoreData)
throw new System.ArgumentException("noMoreData already set!");
HTTPManager.Logger.Information("UploadStream", string.Format("{0} - Finish", this.Name));
noMoreData = true;
ARE.Set();
}
private bool SwitchBuffers()
{
// Switch the buffers only when all data are consumed from our read buffer
lock (locker)
{
if (ReadBuffer.Position == ReadBuffer.Length)
{
// This buffer will be the read buffer, we need to seek back to the beginning
WriteBuffer.Seek(0, SeekOrigin.Begin);
// This will be the write buffer, set the length to zero
ReadBuffer.SetLength(0);
// switch the two buffers
MemoryStream tmp = WriteBuffer;
WriteBuffer = ReadBuffer;
ReadBuffer = tmp;
return true;
}
}
return false;
}
#endregion
#region Not Implemented Functions and Properties
public override bool CanRead { get { throw new NotImplementedException(); } }
public override bool CanSeek { get { throw new NotImplementedException(); } }
public override bool CanWrite { get { throw new NotImplementedException(); } }
public override long Length { get { throw new NotImplementedException(); } }
public override long Position { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } }
public override long Seek(long offset, SeekOrigin origin)
{
throw new NotImplementedException();
}
public override void SetLength(long value)
{
throw new NotImplementedException();
}
#endregion
}
}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: a2ab021301a7baf45a80b5a46275a140
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 61ccf02e2b33b974b9bc1bfd84f2610c
folderAsset: yes
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: a7dec33c4e232db47bf3d2fa8859e896
guid: 0d4bfda5b11c65749922fce76d61bbe6
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using BestHTTP.Core;
using UnityEngine;
using UnityEngine.UI;
namespace BestHTTP.Examples.Helpers.Components
{
public class Cache : MonoBehaviour
{
#pragma warning disable 0649, 0169
[SerializeField]
private Text _count;
[SerializeField]
private Text _size;
[SerializeField]
private Button _clear;
#pragma warning restore
private void Start()
{
PluginEventHelper.OnEvent += OnPluginEvent;
UpdateLabels();
}
private void OnDestroy()
{
PluginEventHelper.OnEvent -= OnPluginEvent;
}
private void OnPluginEvent(PluginEventInfo @event)
{
if (@event.Event == PluginEvents.SaveCacheLibrary)
UpdateLabels();
}
private void UpdateLabels()
{
#if !BESTHTTP_DISABLE_CACHING
this._count.text = BestHTTP.Caching.HTTPCacheService.GetCacheEntityCount().ToString("N0");
this._size.text = BestHTTP.Caching.HTTPCacheService.GetCacheSize().ToString("N0");
#else
this._count.text = "0";
this._size.text = "0";
#endif
}
public void OnClearButtonClicked()
{
#if !BESTHTTP_DISABLE_CACHING
BestHTTP.Caching.HTTPCacheService.BeginClear();
#endif
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b640e13d843caef4885814c6d13d8e3d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,63 @@
using BestHTTP.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
namespace BestHTTP.Examples.Helpers.Components
{
public class Cookies : MonoBehaviour
{
#pragma warning disable 0649, 0169
[SerializeField]
private Text _count;
[SerializeField]
private Text _size;
[SerializeField]
private Button _clear;
#pragma warning restore
private void Start()
{
PluginEventHelper.OnEvent += OnPluginEvent;
UpdateLabels();
}
private void OnDestroy()
{
PluginEventHelper.OnEvent -= OnPluginEvent;
}
private void OnPluginEvent(PluginEventInfo @event)
{
#if !BESTHTTP_DISABLE_COOKIES
if (@event.Event == PluginEvents.SaveCookieLibrary)
UpdateLabels();
#endif
}
private void UpdateLabels()
{
#if !BESTHTTP_DISABLE_COOKIES
var cookies = BestHTTP.Cookies.CookieJar.GetAll();
var size = cookies.Sum(c => c.GuessSize());
this._count.text = cookies.Count.ToString("N0");
this._size.text = size.ToString("N0");
#else
this._count.text = "0";
this._size.text = "0";
#endif
}
public void OnClearButtonClicked()
{
#if !BESTHTTP_DISABLE_COOKIES
BestHTTP.Cookies.CookieJar.Clear();
#endif
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5b9db2d0fa31b054b835fb38d688f211
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,60 @@
using BestHTTP.Examples.Helpers;
using System;
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
namespace BestHTTP.Examples
{
public static class GUIHelper
{
// https://en.wikipedia.org/wiki/Binary_prefix
private static string[] prefixes = new string[] { " B", " KiB", " MiB", " GiB", " TiB" };
public static string GetBytesStr(double bytes, byte precision)
{
int prefixIdx = 0;
while (bytes >= 1024)
{
bytes = bytes / 1024;
prefixIdx++;
}
return bytes.ToString("F" + precision) + prefixes[prefixIdx];
}
public static void RemoveChildren(RectTransform transform, int maxChildCount)
{
while (transform.childCount > maxChildCount)
{
var child = transform.GetChild(0);
child.SetParent(null);
GameObject.Destroy(child.gameObject);
}
}
public static TextListItem AddText(TextListItem prefab, RectTransform contentRoot, string text, int maxEntries, ScrollRect scrollRect)
{
if (contentRoot == null)
return null;
var listItem = GameObject.Instantiate<TextListItem>(prefab, contentRoot, false);
listItem.SetText(text);
GUIHelper.RemoveChildren(contentRoot, maxEntries);
if (scrollRect != null && scrollRect.isActiveAndEnabled)
scrollRect.StartCoroutine(ScrollToBottom(scrollRect));
return listItem;
}
public static IEnumerator ScrollToBottom(ScrollRect scrollRect)
{
yield return null;
if (scrollRect != null && scrollRect.isActiveAndEnabled)
scrollRect.normalizedPosition = new Vector2(0, 0);
}
}
}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: fd560ff6f0fa60844a43a82db1ad03be
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,36 @@
using System.Runtime.InteropServices;
using UnityEngine;
using UnityEngine.EventSystems;
namespace BestHTTP.Examples
{
public class Link : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerDownHandler
{
public string url;
public Texture2D linkSelectCursor;
void IPointerDownHandler.OnPointerDown(PointerEventData eventData)
{
#if UNITY_WEBGL && !UNITY_EDITOR
openWindow(this.url);
#else
Application.OpenURL(this.url);
#endif
}
void IPointerEnterHandler.OnPointerEnter(PointerEventData eventData)
{
Cursor.SetCursor(this.linkSelectCursor, Vector2.zero, CursorMode.Auto);
}
void IPointerExitHandler.OnPointerExit(PointerEventData eventData)
{
Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
}
#if UNITY_WEBGL && !UNITY_EDITOR
[DllImport("__Internal")]
private static extern void openWindow(string url);
#endif
}
}

View File

@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 3ab0e37de384a5b4d8320cdd8644b44c
timeCreated: 1572211254
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,107 @@
fileFormatVersion: 2
guid: bcfb03f220265ea4e9fd88ae5af90176
timeCreated: 1572242320
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 0
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 1
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -1
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 7
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 115e9a87669ff8641b48c627cf3d14e2
folderAsset: yes
timeCreated: 1572243579
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 33f2b105c6dd5f6418e70c8858a1387f
folderAsset: yes
timeCreated: 1572243588
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,21 @@
/*
* Based on:
* https://github.com/valyard/UnityWebGLOpenLink
*/
var OpenWindowPlugin = {
openWindow: function(link)
{
var url = Pointer_stringify(link);
var func = function()
{
window.open(url);
document.removeEventListener('mouseup', func);
}
document.addEventListener('mouseup', func);
}
};
mergeInto(LibraryManager.library, OpenWindowPlugin);

View File

@ -0,0 +1,36 @@
fileFormatVersion: 2
guid: ba6012acd13dbb34390ea3e1de9e8a93
timeCreated: 1572243826
licenseType: Store
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Facebook: WebGL
second:
enabled: 1
settings: {}
- first:
WebGL: WebGL
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,23 @@
using UnityEngine;
namespace BestHTTP.Examples.Helpers
{
public abstract class SampleBase : MonoBehaviour
{
[Header("Common Properties")]
public string Category;
public string DisplayName;
[TextArea]
public string Description;
public RuntimePlatform[] BannedPlatforms = new RuntimePlatform[0];
protected SampleRoot sampleSelector;
protected virtual void Start()
{
this.sampleSelector = FindObjectOfType<SampleRoot>();
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9f8792c52d9520447a1c9d7139925f57
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 901494a9e35e283418e26dd2ae48f62c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace BestHTTP.Examples.Helpers.SelectorUI
{
public sealed class Category : MonoBehaviour
{
#pragma warning disable 0649
[SerializeField]
private Text _text;
#pragma warning restore
public void SetLabel(string category)
{
this._text.text = category;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1101c9e1e1276414d8062a6a7ca4db45
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,171 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 1904131878966858}
m_IsPrefabParent: 1
--- !u!1 &1904131878966858
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224461754452575090}
- component: {fileID: 114104161713339180}
- component: {fileID: 114607162270506794}
- component: {fileID: 114804161523563040}
m_Layer: 5
m_Name: Category
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1966926200078894
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224471434808036404}
- component: {fileID: 222752501853716432}
- component: {fileID: 114045595599197664}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &114045595599197664
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1966926200078894}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 0
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 1
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Sample Name
--- !u!114 &114104161713339180
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1904131878966858}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1101c9e1e1276414d8062a6a7ca4db45, type: 3}
m_Name:
m_EditorClassIdentifier:
_text: {fileID: 114045595599197664}
--- !u!114 &114607162270506794
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1904131878966858}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1741964061, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalFit: 2
m_VerticalFit: 2
--- !u!114 &114804161523563040
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1904131878966858}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1297475563, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 0
m_Right: 0
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 0
m_Spacing: 0
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 1
m_ChildControlWidth: 1
m_ChildControlHeight: 1
--- !u!222 &222752501853716432
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1966926200078894}
--- !u!224 &224461754452575090
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1904131878966858}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 224471434808036404}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 400, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224471434808036404
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1966926200078894}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 224461754452575090}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: fc69717198f6d93498890b7b67812172
timeCreated: 1571212112
licenseType: Store
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace BestHTTP.Examples.Helpers.SelectorUI
{
public sealed class ExampleInfo : MonoBehaviour
{
#pragma warning disable 0649
[SerializeField]
private Text _header;
[SerializeField]
private Text _description;
#pragma warning restore
private SampleSelectorUI _parentUI;
private SampleBase _example;
public void Setup(SampleSelectorUI parentUI, SampleBase example)
{
this._parentUI = parentUI;
this._example = example;
this._header.text = this._example.name;
this._description.text = this._example.Description;
}
public void OnExecuteExample()
{
this._parentUI.ExecuteExample(this._example);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fd424cc4259865c4ba2fb4d9d68d0272
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,507 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 1844362866936956}
m_IsPrefabParent: 1
--- !u!1 &1164538047482000
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224919186422011706}
- component: {fileID: 222389287056714158}
- component: {fileID: 114764438814610556}
- component: {fileID: 114425745104630664}
- component: {fileID: 114698872193548206}
- component: {fileID: 114431572224555080}
m_Layer: 5
m_Name: Execute Sample Button
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1248744110497022
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224829437101102402}
- component: {fileID: 222702223361243722}
- component: {fileID: 114859111753421280}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1397735183102074
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224216400874628136}
- component: {fileID: 222516365031537928}
- component: {fileID: 114059492809184142}
- component: {fileID: 114493726555860862}
m_Layer: 5
m_Name: Description
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1531245648659982
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224368887501416132}
- component: {fileID: 222882642833739976}
- component: {fileID: 114666879149101946}
m_Layer: 5
m_Name: Header
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1844362866936956
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224811306304922960}
- component: {fileID: 114988937263723000}
- component: {fileID: 114645756897919032}
- component: {fileID: 114471653971156696}
m_Layer: 5
m_Name: ExampleInfo
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &114059492809184142
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1397735183102074}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Description
--- !u!114 &114425745104630664
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1164538047482000}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 114764438814610556}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 114471653971156696}
m_MethodName: OnExecuteExample
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &114431572224555080
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1164538047482000}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1741964061, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalFit: 0
m_VerticalFit: 2
--- !u!114 &114471653971156696
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1844362866936956}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fd424cc4259865c4ba2fb4d9d68d0272, type: 3}
m_Name:
m_EditorClassIdentifier:
_header: {fileID: 114666879149101946}
_description: {fileID: 114059492809184142}
--- !u!114 &114493726555860862
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1397735183102074}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreLayout: 0
m_MinWidth: -1
m_MinHeight: -1
m_PreferredWidth: -1
m_PreferredHeight: -1
m_FlexibleWidth: 1
m_FlexibleHeight: 1
m_LayoutPriority: 1
--- !u!114 &114645756897919032
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1844362866936956}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreLayout: 0
m_MinWidth: -1
m_MinHeight: -1
m_PreferredWidth: -1
m_PreferredHeight: -1
m_FlexibleWidth: 3
m_FlexibleHeight: 1
m_LayoutPriority: 1
--- !u!114 &114666879149101946
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1531245648659982}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 0
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 24
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 2
m_MaxSize: 40
m_Alignment: 1
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Header
--- !u!114 &114698872193548206
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1164538047482000}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1297475563, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 5
m_Right: 5
m_Top: 5
m_Bottom: 5
m_ChildAlignment: 0
m_Spacing: 0
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 0
m_ChildControlWidth: 1
m_ChildControlHeight: 1
--- !u!114 &114764438814610556
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1164538047482000}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!114 &114859111753421280
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1248744110497022}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Execute
--- !u!114 &114988937263723000
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1844362866936956}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1297475563, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 5
m_Right: 5
m_Top: 5
m_Bottom: 5
m_ChildAlignment: 0
m_Spacing: 5
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 0
m_ChildControlWidth: 1
m_ChildControlHeight: 1
--- !u!222 &222389287056714158
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1164538047482000}
--- !u!222 &222516365031537928
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1397735183102074}
--- !u!222 &222702223361243722
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1248744110497022}
--- !u!222 &222882642833739976
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1531245648659982}
--- !u!224 &224216400874628136
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1397735183102074}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 224811306304922960}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224368887501416132
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1531245648659982}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 224811306304922960}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224811306304922960
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1844362866936956}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 224368887501416132}
- {fileID: 224216400874628136}
- {fileID: 224919186422011706}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224829437101102402
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1248744110497022}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 224919186422011706}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224919186422011706
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1164538047482000}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 224829437101102402}
m_Father: {fileID: 224811306304922960}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 300, y: 0}
m_SizeDelta: {x: 590, y: 0}
m_Pivot: {x: 0.5, y: 0.5}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: d57a4ffd57493de4f9f41009f52c658e
timeCreated: 1571212676
licenseType: Store
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace BestHTTP.Examples.Helpers.SelectorUI
{
public sealed class ExampleListItem : MonoBehaviour
{
#pragma warning disable 0649
[SerializeField]
private Text _text;
#pragma warning restore
public SampleSelectorUI ParentUI { get; private set; }
public SampleBase ExamplePrefab { get; private set; }
public void Setup(SampleSelectorUI parentUI, SampleBase prefab)
{
this.ParentUI = parentUI;
this.ExamplePrefab = prefab;
this._text.text = prefab.DisplayName;
}
public void OnButton()
{
this.ParentUI.SelectSample(this);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 376fb4eb0776e41479fb60f520aaa1f3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,222 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 1972462828926934}
m_IsPrefabParent: 1
--- !u!1 &1706707392201452
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224973040142512786}
- component: {fileID: 222441293650573372}
- component: {fileID: 114389340898110916}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1972462828926934
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224145737800144754}
- component: {fileID: 222972952305363732}
- component: {fileID: 114266276035656386}
- component: {fileID: 114629809360314506}
- component: {fileID: 114416681848148688}
m_Layer: 5
m_Name: ExampleListItem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &114266276035656386
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1972462828926934}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!114 &114389340898110916
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1706707392201452}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Button
--- !u!114 &114416681848148688
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1972462828926934}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 376fb4eb0776e41479fb60f520aaa1f3, type: 3}
m_Name:
m_EditorClassIdentifier:
_text: {fileID: 114389340898110916}
--- !u!114 &114629809360314506
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1972462828926934}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 114266276035656386}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 114416681848148688}
m_MethodName: OnButton
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!222 &222441293650573372
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1706707392201452}
--- !u!222 &222972952305363732
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1972462828926934}
--- !u!224 &224145737800144754
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1972462828926934}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 224973040142512786}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224973040142512786
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1706707392201452}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 224145737800144754}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 216b271b42611e447829c7e7de089ab4
timeCreated: 1571212394
licenseType: Store
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,101 @@
using System;
using System.Linq;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace BestHTTP.Examples.Helpers.SelectorUI
{
public class SampleSelectorUI : MonoBehaviour
{
#pragma warning disable 0649, 0169
[SerializeField]
private Category _categoryListItemPrefab;
[SerializeField]
private ExampleListItem _exampleListItemPrefab;
[SerializeField]
private ExampleInfo _exampleInfoPrefab;
[SerializeField]
private RectTransform _listRoot;
[SerializeField]
private RectTransform _dyncamicContentRoot;
private SampleRoot sampleSelector;
private ExampleListItem selectedSample;
private GameObject dynamicContent;
#pragma warning restore
private void Start()
{
this.sampleSelector = FindObjectOfType<SampleRoot>();
DisplayExamples();
}
private void DisplayExamples()
{
// Sort examples by category
this.sampleSelector.samples.Sort((a, b) => {
if (a == null || b == null)
return 0;
int result = a.Category.CompareTo(b.Category);
if (result == 0)
result = a.DisplayName.CompareTo(b.DisplayName);
return result;
});
string currentCategory = null;
for (int i = 0; i < this.sampleSelector.samples.Count; ++i)
{
var examplePrefab = this.sampleSelector.samples[i];
if (examplePrefab == null)
continue;
if (examplePrefab.BannedPlatforms.Contains(UnityEngine.Application.platform))
continue;
if (currentCategory != examplePrefab.Category)
{
var category = Instantiate<Category>(this._categoryListItemPrefab, this._listRoot, false);
category.SetLabel(examplePrefab.Category);
currentCategory = examplePrefab.Category;
}
var listItem = Instantiate<ExampleListItem>(this._exampleListItemPrefab, this._listRoot, false);
listItem.Setup(this, examplePrefab);
if (this.sampleSelector.selectedExamplePrefab == null)
{
SelectSample(listItem);
}
}
}
public void SelectSample(ExampleListItem item)
{
this.sampleSelector.selectedExamplePrefab = item.ExamplePrefab;
if (this.dynamicContent != null)
Destroy(this.dynamicContent);
var example = Instantiate<ExampleInfo>(this._exampleInfoPrefab, this._dyncamicContentRoot, false);
example.Setup(this, item.ExamplePrefab);
this.dynamicContent = example.gameObject;
}
public void ExecuteExample(SampleBase example)
{
if (this.dynamicContent != null)
Destroy(this.dynamicContent);
this.dynamicContent = Instantiate(example, this._dyncamicContentRoot, false).gameObject;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bd639b2a784de314984c606b7e8329e4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace BestHTTP.Examples.Helpers
{
public class TextListItem : MonoBehaviour
{
#pragma warning disable 0649
[SerializeField]
private Text _text;
#pragma warning restore
public void SetText(string text)
{
this._text.text = text;
}
public void AddLeftPadding(int padding)
{
this.GetComponent<LayoutGroup>().padding.left += padding;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 05975660b0231b84f849693106b207d1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,206 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 1727935926237334}
m_IsPrefabParent: 1
--- !u!1 &1503879635514882
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224106021874867618}
- component: {fileID: 222738347872656220}
- component: {fileID: 114900463745114476}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1727935926237334
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224916463173798366}
- component: {fileID: 222969618919079142}
- component: {fileID: 114878452276715702}
- component: {fileID: 114769119028883068}
- component: {fileID: 114599056085522236}
- component: {fileID: 114144824129317776}
m_Layer: 5
m_Name: TextListItem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &114144824129317776
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1727935926237334}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 05975660b0231b84f849693106b207d1, type: 3}
m_Name:
m_EditorClassIdentifier:
_text: {fileID: 114900463745114476}
--- !u!114 &114599056085522236
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1727935926237334}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1741964061, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalFit: 0
m_VerticalFit: 2
--- !u!114 &114769119028883068
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1727935926237334}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1297475563, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 5
m_Right: 2
m_Top: 2
m_Bottom: 2
m_ChildAlignment: 0
m_Spacing: 2
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 1
m_ChildControlWidth: 1
m_ChildControlHeight: 1
--- !u!114 &114878452276715702
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1727935926237334}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.39215687}
m_RaycastTarget: 0
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!114 &114900463745114476
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1503879635514882}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 0
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 10
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 1
m_MaxSize: 40
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: New Text
--- !u!222 &222738347872656220
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1503879635514882}
--- !u!222 &222969618919079142
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1727935926237334}
--- !u!224 &224106021874867618
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1503879635514882}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 224916463173798366}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224916463173798366
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1727935926237334}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 224106021874867618}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 400, y: 0}
m_SizeDelta: {x: 800, y: 0}
m_Pivot: {x: 0.5, y: 0.5}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 46bdaff7a8bf5d34da870d286f962c69
timeCreated: 1571213203
licenseType: Store
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e4b189b8db53fae40b63e2563cc658ba
folderAsset: yes
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,57 @@
#if CSHARP_7_OR_LATER
using System;
using System.Threading;
using System.Threading.Tasks;
namespace BestHTTP
{
public static class AsyncExtensions
{
public static Task<T> GetFromJsonResultAsync<T>(this HTTPRequest request, CancellationToken token = default)
{
return HTTPRequestAsyncExtensions.CreateTask<T>(request, token, (req, resp, tcs) =>
{
switch (req.State)
{
// The request finished without any problem.
case HTTPRequestStates.Finished:
if (resp.IsSuccess)
tcs.TrySetResult(BestHTTP.JSON.LitJson.JsonMapper.ToObject<T>(resp.DataAsText));
else
tcs.TrySetException(HTTPRequestAsyncExtensions.CreateException("Request finished Successfully, but the server sent an error.", resp));
break;
// The request finished with an unexpected error. The request's Exception property may contain more info about the error.
case HTTPRequestStates.Error:
HTTPRequestAsyncExtensions.VerboseLogging(request, "Request Finished with Error! " + (req.Exception != null ? (req.Exception.Message + "\n" + req.Exception.StackTrace) : "No Exception"));
tcs.TrySetException(HTTPRequestAsyncExtensions.CreateException("No Exception", null, req.Exception));
break;
// The request aborted, initiated by the user.
case HTTPRequestStates.Aborted:
HTTPRequestAsyncExtensions.VerboseLogging(request, "Request Aborted!");
tcs.TrySetCanceled();
break;
// Connecting to the server is timed out.
case HTTPRequestStates.ConnectionTimedOut:
HTTPRequestAsyncExtensions.VerboseLogging(request, "Connection Timed Out!");
tcs.TrySetException(HTTPRequestAsyncExtensions.CreateException("Connection Timed Out!"));
break;
// The request didn't finished in the given time.
case HTTPRequestStates.TimedOut:
HTTPRequestAsyncExtensions.VerboseLogging(request, "Processing the request Timed Out!");
tcs.TrySetException(HTTPRequestAsyncExtensions.CreateException("Processing the request Timed Out!"));
break;
}
});
}
}
}
#endif

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7f0aefe97b2a43844850d2d8b234e819
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,103 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using BestHTTP.Examples.Helpers;
namespace BestHTTP.Examples
{
public class SampleRoot : MonoBehaviour
{
#pragma warning disable 0649, 0169
[Header("Common Properties")]
public string BaseURL = "https://besthttpwebgldemo.azurewebsites.net";
[Header("References")]
[SerializeField]
private Text _pluginVersion;
[SerializeField]
private Dropdown _logLevelDropdown;
[SerializeField]
private Text _proxyLabel;
[SerializeField]
private InputField _proxyInputField;
#pragma warning restore
[SerializeField]
public List<SampleBase> samples = new List<SampleBase>();
[HideInInspector]
public SampleBase selectedExamplePrefab;
private void Start()
{
Application.runInBackground = true;
this._pluginVersion.text = "Version: " + HTTPManager.UserAgent;
int logLevel = PlayerPrefs.GetInt("BestHTTP.HTTPManager.Logger.Level", (int)HTTPManager.Logger.Level);
this._logLevelDropdown.value = logLevel;
HTTPManager.Logger.Level = (BestHTTP.Logger.Loglevels)logLevel;
#if (UNITY_WEBGL && !UNITY_EDITOR) || BESTHTTP_DISABLE_PROXY
this._proxyLabel.gameObject.SetActive(false);
this._proxyInputField.gameObject.SetActive(false);
#else
string proxyURL = PlayerPrefs.GetString("BestHTTP.HTTPManager.Proxy", null);
if (!string.IsNullOrEmpty(proxyURL))
{
try
{
HTTPManager.Proxy = new HTTPProxy(new Uri(proxyURL), null, true);
#if UNITY_2019_1_OR_NEWER
this._proxyInputField.SetTextWithoutNotify(proxyURL);
#else
this._proxyInputField.onEndEdit.RemoveAllListeners();
this._proxyInputField.text = proxyURL;
this._proxyInputField.onEndEdit.AddListener(this.OnProxyEditEnd);
#endif
}
catch
{ }
}
else
HTTPManager.Proxy = null;
#endif
#if !BESTHTTP_DISABLE_CACHING
// Remove too old cache entries.
BestHTTP.Caching.HTTPCacheService.BeginMaintainence(new BestHTTP.Caching.HTTPCacheMaintananceParams(TimeSpan.FromDays(30), ulong.MaxValue));
#endif
}
public void OnLogLevelChanged(int idx)
{
HTTPManager.Logger.Level = (BestHTTP.Logger.Loglevels)idx;
PlayerPrefs.SetInt("BestHTTP.HTTPManager.Logger.Level", idx);
}
public void OnProxyEditEnd(string proxyURL)
{
#if (!UNITY_WEBGL || UNITY_EDITOR) && !BESTHTTP_DISABLE_PROXY
try
{
if (string.IsNullOrEmpty(this._proxyInputField.text))
HTTPManager.Proxy = null;
else
HTTPManager.Proxy = new HTTPProxy(new Uri(this._proxyInputField.text), null, true);
PlayerPrefs.SetString("BestHTTP.HTTPManager.Proxy", this._proxyInputField.text);
}
catch
{ }
#endif
}
}
}

View File

@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 0eb115c0377f90041a9ecfde21658f92
timeCreated: 1571213708
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,6 @@
fileFormatVersion: 2
guid: 5ed13563a809f06489c3e97e4da02176
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d95d33b7692aa2c4494946f8f92a989f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 623f70cc1d86e664ca6e0128d812b8fe
timeCreated: 1571295463
licenseType: Store
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,156 @@
#if !BESTHTTP_DISABLE_SERVERSENT_EVENTS
using System;
using BestHTTP.Examples.Helpers;
using BestHTTP.ServerSentEvents;
using UnityEngine;
using UnityEngine.UI;
namespace BestHTTP.Examples.ServerSentEvents
{
public class SimpleSample : BestHTTP.Examples.Helpers.SampleBase
{
#pragma warning disable 0649
[Tooltip("The url of the resource to use.")]
[SerializeField]
private string _path = "/sse";
[SerializeField]
private ScrollRect _scrollRect;
[SerializeField]
private RectTransform _contentRoot;
[SerializeField]
private TextListItem _listItemPrefab;
[SerializeField]
private int _maxListItemEntries = 100;
[SerializeField]
private Button _startButton;
[SerializeField]
private Button _closeButton;
#pragma warning restore
private EventSource eventSource;
protected override void Start()
{
base.Start();
SetButtons(true, false);
}
void OnDestroy()
{
if (this.eventSource != null)
{
this.eventSource.Close();
this.eventSource = null;
}
}
public void OnStartButton()
{
GUIHelper.RemoveChildren(this._contentRoot, 0);
// Create the EventSource instance
this.eventSource = new EventSource(new Uri(base.sampleSelector.BaseURL + this._path));
// Subscribe to generic events
this.eventSource.OnOpen += OnOpen;
this.eventSource.OnClosed += OnClosed;
this.eventSource.OnError += OnError;
this.eventSource.OnStateChanged += this.OnStateChanged;
this.eventSource.OnMessage += OnMessage;
// Subscribe to an application specific event
this.eventSource.On("datetime", OnDateTime);
// Start to connect to the server
this.eventSource.Open();
AddText("Opening Server-Sent Events...");
SetButtons(false, true);
}
public void OnCloseButton()
{
SetButtons(false, false);
this.eventSource.Close();
}
private void OnOpen(EventSource eventSource)
{
AddText("Open");
}
private void OnClosed(EventSource eventSource)
{
AddText("Closed");
this.eventSource = null;
SetButtons(true, false);
}
private void OnError(EventSource eventSource, string error)
{
AddText(string.Format("Error: <color=red>{0}</color>", error));
}
private void OnStateChanged(EventSource eventSource, States oldState, States newState)
{
AddText(string.Format("State Changed {0} => {1}", oldState, newState));
}
private void OnMessage(EventSource eventSource, Message message)
{
AddText(string.Format("Message: <color=yellow>{0}</color>", message));
}
private void OnDateTime(EventSource eventSource, Message message)
{
DateTimeData dtData = BestHTTP.JSON.LitJson.JsonMapper.ToObject<DateTimeData>(message.Data);
AddText(string.Format("OnDateTime: <color=yellow>{0}</color>", dtData.ToString()));
}
private void SetButtons(bool start, bool close)
{
if (this._startButton != null)
this._startButton.interactable = start;
if (this._closeButton != null)
this._closeButton.interactable = close;
}
private void AddText(string text)
{
GUIHelper.AddText(this._listItemPrefab, this._contentRoot, text, this._maxListItemEntries, this._scrollRect);
}
}
[PlatformSupport.IL2CPP.Preserve]
sealed class DateTimeData
{
#pragma warning disable 0649
[PlatformSupport.IL2CPP.Preserve]
public int eventid;
[PlatformSupport.IL2CPP.Preserve]
public string datetime;
#pragma warning restore
public override string ToString()
{
return string.Format("[DateTimeData EventId: {0}, DateTime: {1}]", this.eventid, this.datetime);
}
}
}
#endif

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 730e176dfa30cb24c93efcaabb4f8688
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d69707652d0d406448aedf33b807bf6d
folderAsset: yes
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 9286baa677f488b4bb493dd5436147c6
folderAsset: yes
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,135 @@
#if !BESTHTTP_DISABLE_SIGNALR
#if !BESTHTTP_DISABLE_COOKIES && (!UNITY_WEBGL || UNITY_EDITOR)
using System;
using BestHTTP.Cookies;
using BestHTTP.SignalR.Transports;
namespace BestHTTP.SignalR.Authentication
{
public sealed class SampleCookieAuthentication : IAuthenticationProvider
{
#region Public Properties
public Uri AuthUri { get; private set; }
public string UserName { get; private set; }
public string Password { get; private set; }
public string UserRoles { get; private set; }
#endregion
#region IAuthenticationProvider properties
public bool IsPreAuthRequired { get; private set; }
public event OnAuthenticationSuccededDelegate OnAuthenticationSucceded;
public event OnAuthenticationFailedDelegate OnAuthenticationFailed;
#endregion
#region Privates
private HTTPRequest AuthRequest;
private Cookie Cookie;
#endregion
public SampleCookieAuthentication(Uri authUri, string user, string passwd, string roles)
{
this.AuthUri = authUri;
this.UserName = user;
this.Password = passwd;
this.UserRoles = roles;
this.IsPreAuthRequired = true;
}
#region IAuthenticationProvider Implementation
public void StartAuthentication()
{
AuthRequest = new HTTPRequest(AuthUri, HTTPMethods.Post, OnAuthRequestFinished);
// Setup the form
AuthRequest.AddField("userName", UserName);
AuthRequest.AddField("Password", Password); // not used in the sample
AuthRequest.AddField("roles", UserRoles);
AuthRequest.Send();
}
public void PrepareRequest(HTTPRequest request, RequestTypes type)
{
// Adding the cookie to the request is not required, as it's managed by the plugin automatically,
// but for now, we want to be really sure that it's added
request.Cookies.Add(Cookie);
}
#endregion
#region Request Handler
void OnAuthRequestFinished(HTTPRequest req, HTTPResponse resp)
{
AuthRequest = null;
string failReason = string.Empty;
switch (req.State)
{
// The request finished without any problem.
case HTTPRequestStates.Finished:
if (resp.IsSuccess)
{
Cookie = resp.Cookies != null ? resp.Cookies.Find(c => c.Name.Equals(".ASPXAUTH")) : null;
if (Cookie != null)
{
HTTPManager.Logger.Information("CookieAuthentication", "Auth. Cookie found!");
if (OnAuthenticationSucceded != null)
OnAuthenticationSucceded(this);
// return now, all other paths are authentication failures
return;
}
else
HTTPManager.Logger.Warning("CookieAuthentication", failReason = "Auth. Cookie NOT found!");
}
else
HTTPManager.Logger.Warning("CookieAuthentication", failReason = string.Format("Request Finished Successfully, but the server sent an error. Status Code: {0}-{1} Message: {2}",
resp.StatusCode,
resp.Message,
resp.DataAsText));
break;
// The request finished with an unexpected error. The request's Exception property may contain more info about the error.
case HTTPRequestStates.Error:
HTTPManager.Logger.Warning("CookieAuthentication", failReason = "Request Finished with Error! " + (req.Exception != null ? (req.Exception.Message + "\n" + req.Exception.StackTrace) : "No Exception"));
break;
// The request aborted, initiated by the user.
case HTTPRequestStates.Aborted:
HTTPManager.Logger.Warning("CookieAuthentication", failReason = "Request Aborted!");
break;
// Connecting to the server is timed out.
case HTTPRequestStates.ConnectionTimedOut:
HTTPManager.Logger.Error("CookieAuthentication", failReason = "Connection Timed Out!");
break;
// The request didn't finished in the given time.
case HTTPRequestStates.TimedOut:
HTTPManager.Logger.Error("CookieAuthentication", failReason = "Processing the request Timed Out!");
break;
}
if (OnAuthenticationFailed != null)
OnAuthenticationFailed(this, failReason);
}
#endregion
}
}
#endif
#endif

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 48a74a50eeb07bb4ea649a902e9d487a
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,97 @@
#if !BESTHTTP_DISABLE_SIGNALR
namespace BestHTTP.SignalR.Authentication
{
/// <summary>
/// Custom http-header based authenticator.
/// <example>
/// <code>
/// // Server side implementation of the Header-based authenticator
/// // Use it by adding the app.Use(typeof(HeaderBasedAuthenticationMiddleware)); line to the Startup class' Configuration function.
/// private class HeaderBasedAuthenticationMiddleware : OwinMiddleware
/// {
/// public HeaderBasedAuthenticationMiddleware(OwinMiddleware next)
/// : base(next)
/// {
/// }
///
/// public override Task Invoke(IOwinContext context)
/// {
/// string username = context.Request.Headers.Get("username");
/// string roles = context.Request.Headers.Get("roles");
///
/// if (!String.IsNullOrEmpty(username) && !String.IsNullOrEmpty(roles))
/// {
/// var identity = new System.Security.Principal.GenericIdentity(username);
///
/// var principal = new System.Security.Principal.GenericPrincipal(identity, SplitString(roles));
///
/// context.Request.User = principal;
/// }
///
/// return Next.Invoke(context);
/// }
///
/// private static string[] SplitString(string original)
/// {
/// if (String.IsNullOrEmpty(original))
/// return new string[0];
///
/// var split = from piece in original.Split(',') let trimmed = piece.Trim() where !String.IsNullOrEmpty(trimmed) select trimmed;
///
/// return split.ToArray();
/// }
/// }
/// </code>
/// </example>
/// </summary>
class HeaderAuthenticator : IAuthenticationProvider
{
public string User { get; private set; }
public string Roles { get; private set; }
/// <summary>
/// No pre-auth step required for this type of authentication
/// </summary>
public bool IsPreAuthRequired { get { return false; } }
#pragma warning disable 0067
/// <summary>
/// Not used event as IsPreAuthRequired is false
/// </summary>
public event OnAuthenticationSuccededDelegate OnAuthenticationSucceded;
/// <summary>
/// Not used event as IsPreAuthRequired is false
/// </summary>
public event OnAuthenticationFailedDelegate OnAuthenticationFailed;
#pragma warning restore 0067
/// <summary>
/// Constructor to initialise the authenticator with username and roles.
/// </summary>
public HeaderAuthenticator(string user, string roles)
{
this.User = user;
this.Roles = roles;
}
/// <summary>
/// Not used as IsPreAuthRequired is false
/// </summary>
public void StartAuthentication()
{ }
/// <summary>
/// Prepares the request by adding two headers to it
/// </summary>
public void PrepareRequest(BestHTTP.HTTPRequest request, RequestTypes type)
{
request.SetHeader("username", this.User);
request.SetHeader("roles", this.Roles);
}
}
}
#endif

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 5ebd4ce02d369a6498f9be6bb7141ac3
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1c996438e0be72649b8abf5fbdee3f41
folderAsset: yes
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,23 @@
#if !BESTHTTP_DISABLE_SIGNALR && BESTHTTP_SIGNALR_WITH_JSONDOTNET
using System.Collections.Generic;
using Newtonsoft.Json;
namespace BestHTTP.SignalR.JsonEncoders
{
public sealed class JSonDotnetEncoder : IJsonEncoder
{
public string Encode(object obj)
{
return JsonConvert.SerializeObject(obj);
}
public IDictionary<string, object> DecodeMessage(string json)
{
return JsonConvert.DeserializeObject<Dictionary<string, object>>(json);
}
}
}
#endif

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 653a0f163689052438748b7beda14886
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,28 @@
#if !BESTHTTP_DISABLE_SIGNALR
using System.Collections.Generic;
using BestHTTP.JSON.LitJson;
namespace BestHTTP.SignalR.JsonEncoders
{
public sealed class LitJsonEncoder : IJsonEncoder
{
public string Encode(object obj)
{
JsonWriter writer = new JsonWriter();
JsonMapper.ToJson(obj, writer);
return writer.ToString();
}
public IDictionary<string, object> DecodeMessage(string json)
{
JsonReader reader = new JsonReader(json);
return JsonMapper.ToObject<Dictionary<string, object>>(reader);
}
}
}
#endif

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 2870a746a601b8b439c495ff39474385
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: f7ff75ba203704d45bf1098536a2db5a
folderAsset: yes
timeCreated: 1515401610
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: b1561e378e33bde4a9cfca1323516c79
timeCreated: 1571296382
licenseType: Store
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,240 @@
#if !BESTHTTP_DISABLE_SIGNALR_CORE
using System;
using UnityEngine;
using BestHTTP.SignalRCore;
using BestHTTP.SignalRCore.Encoders;
using UnityEngine.UI;
using BestHTTP.Examples.Helpers;
#if CSHARP_7_OR_LATER
using System.Threading.Tasks;
#endif
namespace BestHTTP.Examples
{
// Server side of this example can be found here:
// https://github.com/Benedicht/BestHTTP_DemoSite/blob/master/BestHTTP_DemoSite/Hubs/TestHub.cs
public class AsyncTestHubSample : BestHTTP.Examples.Helpers.SampleBase
{
#pragma warning disable 0649
#pragma warning disable 0414
[SerializeField]
private string _path = "/TestHub";
[SerializeField]
private ScrollRect _scrollRect;
[SerializeField]
private RectTransform _contentRoot;
[SerializeField]
private TextListItem _listItemPrefab;
[SerializeField]
private int _maxListItemEntries = 100;
[SerializeField]
private Button _connectButton;
[SerializeField]
private Button _closeButton;
#pragma warning restore
// Instance of the HubConnection
HubConnection hub;
protected override void Start()
{
base.Start();
#if !CSHARP_7_OR_LATER
AddText("<color=red>This sample can work only when at least c# 7.3 is supported!</color>");
SetButtons(false, false);
#else
SetButtons(true, false);
#endif
}
#if CSHARP_7_OR_LATER
async void OnDestroy()
{
await hub?.CloseAsync();
}
#endif
/// <summary>
/// GUI button callback
/// </summary>
public
#if CSHARP_7_OR_LATER
async
#endif
void OnConnectButton()
{
#if CSHARP_7_OR_LATER
#if BESTHTTP_SIGNALR_CORE_ENABLE_MESSAGEPACK_CSHARP
try
{
MessagePack.Resolvers.StaticCompositeResolver.Instance.Register(
MessagePack.Resolvers.DynamicEnumAsStringResolver.Instance,
MessagePack.Unity.UnityResolver.Instance,
//MessagePack.Unity.Extension.UnityBlitWithPrimitiveArrayResolver.Instance,
//MessagePack.Resolvers.StandardResolver.Instance,
MessagePack.Resolvers.ContractlessStandardResolver.Instance
);
var options = MessagePack.MessagePackSerializerOptions.Standard.WithResolver(MessagePack.Resolvers.StaticCompositeResolver.Instance);
MessagePack.MessagePackSerializer.DefaultOptions = options;
}
catch
{ }
#endif
IProtocol protocol = null;
#if BESTHTTP_SIGNALR_CORE_ENABLE_MESSAGEPACK_CSHARP
protocol = new MessagePackCSharpProtocol();
#elif BESTHTTP_SIGNALR_CORE_ENABLE_GAMEDEVWARE_MESSAGEPACK
protocol = new MessagePackProtocol();
#else
protocol = new JsonProtocol(new LitJsonEncoder());
#endif
// Crete the HubConnection
hub = new HubConnection(new Uri(this.sampleSelector.BaseURL + this._path), protocol);
// Subscribe to hub events
hub.OnError += Hub_OnError;
hub.OnTransportEvent += (hub, transport, ev) => AddText(string.Format("Transport(<color=green>{0}</color>) event: <color=green>{1}</color>", transport.TransportType, ev));
// Set up server callable functions
hub.On("Send", (string arg) => AddText(string.Format("On '<color=green>Send</color>': '<color=yellow>{0}</color>'", arg)).AddLeftPadding(20));
hub.On<Person>("Person", (person) => AddText(string.Format("On '<color=green>Person</color>': '<color=yellow>{0}</color>'", person)).AddLeftPadding(20));
hub.On<Person, Person>("TwoPersons", (person1, person2) => AddText(string.Format("On '<color=green>TwoPersons</color>': '<color=yellow>{0}</color>', '<color=yellow>{1}</color>'", person1, person2)).AddLeftPadding(20));
AddText("StartConnect called");
SetButtons(false, false);
// And finally start to connect to the server
await hub.ConnectAsync();
SetButtons(false, true);
AddText(string.Format("Hub Connected with <color=green>{0}</color> transport using the <color=green>{1}</color> encoder.", hub.Transport.TransportType.ToString(), hub.Protocol.Name));
// Call a server function with a string param. We expect no return value.
await hub.SendAsync("Send", "my message");
// Call a parameterless function. We expect a string return value.
try
{
string result = await hub.InvokeAsync<string>("NoParam");
AddText(string.Format("'<color=green>NoParam</color>' returned: '<color=yellow>{0}</color>'", result))
.AddLeftPadding(20);
}
catch (Exception ex)
{
AddText(string.Format("'<color=green>NoParam</color>' error: '<color=red>{0}</color>'", ex.Message)).AddLeftPadding(20);
}
// Call a function on the server to add two numbers. OnSuccess will be called with the result and OnError if there's an error.
var addResult = await hub.InvokeAsync<int>("Add", 10, 20);
AddText(string.Format("'<color=green>Add(10, 20)</color>' returned: '<color=yellow>{0}</color>'", addResult)).AddLeftPadding(20);
var nullabelTestResult = await hub.InvokeAsync<int?>("NullableTest", 10);
AddText(string.Format("'<color=green>NullableTest(10)</color>' returned: '<color=yellow>{0}</color>'", nullabelTestResult)).AddLeftPadding(20);
// Call a function that will return a Person object constructed from the function's parameters.
var getPersonResult = await hub.InvokeAsync<Person>("GetPerson", "Mr. Smith", 26);
AddText(string.Format("'<color=green>GetPerson(\"Mr. Smith\", 26)</color>' returned: '<color=yellow>{0}</color>'", getPersonResult)).AddLeftPadding(20);
// To test errors/exceptions this call always throws an exception on the server side resulting in an OnError call.
// OnError expected here!
try
{
var singleResultFailureResult = await hub.InvokeAsync<int>("SingleResultFailure", 10, 20);
AddText(string.Format("'<color=green>SingleResultFailure(10, 20)</color>' returned: '<color=yellow>{0}</color>'", singleResultFailureResult)).AddLeftPadding(20);
}
catch (Exception ex)
{
AddText(string.Format("'<color=green>SingleResultFailure(10, 20)</color>' error: '<color=red>{0}</color>'", ex.Message)).AddLeftPadding(20);
}
// This call demonstrates IEnumerable<> functions, result will be the yielded numbers.
var batchedResult = await hub.InvokeAsync<int[]>("Batched", 10);
AddText(string.Format("'<color=green>Batched(10)</color>' returned items: '<color=yellow>{0}</color>'", batchedResult.Length)).AddLeftPadding(20);
// OnItem is called for a streaming request for every items returned by the server. OnSuccess will still be called with all the items.
hub.GetDownStreamController<int>("ObservableCounter", 10, 1000)
.OnItem(result => AddText(string.Format("'<color=green>ObservableCounter(10, 1000)</color>' OnItem: '<color=yellow>{0}</color>'", result)).AddLeftPadding(20))
.OnSuccess(result => AddText("'<color=green>ObservableCounter(10, 1000)</color>' OnSuccess.").AddLeftPadding(20))
.OnError(error => AddText(string.Format("'<color=green>ObservableCounter(10, 1000)</color>' error: '<color=red>{0}</color>'", error)).AddLeftPadding(20));
// A stream request can be cancelled any time.
var controller = hub.GetDownStreamController<int>("ChannelCounter", 10, 1000);
controller.OnItem(result => AddText(string.Format("'<color=green>ChannelCounter(10, 1000)</color>' OnItem: '<color=yellow>{0}</color>'", result)).AddLeftPadding(20))
.OnSuccess(result => AddText("'<color=green>ChannelCounter(10, 1000)</color>' OnSuccess.").AddLeftPadding(20))
.OnError(error => AddText(string.Format("'<color=green>ChannelCounter(10, 1000)</color>' error: '<color=red>{0}</color>'", error)).AddLeftPadding(20));
// a stream can be cancelled by calling the controller's Cancel method
controller.Cancel();
// This call will stream strongly typed objects
hub.GetDownStreamController<Person>("GetRandomPersons", 20, 2000)
.OnItem(result => AddText(string.Format("'<color=green>GetRandomPersons(20, 1000)</color>' OnItem: '<color=yellow>{0}</color>'", result)).AddLeftPadding(20))
.OnSuccess(result => AddText("'<color=green>GetRandomPersons(20, 1000)</color>' OnSuccess.").AddLeftPadding(20));
#endif
}
/// <summary>
/// GUI button callback
/// </summary>
public
#if CSHARP_7_OR_LATER
async
#endif
void OnCloseButton()
{
#if CSHARP_7_OR_LATER
if (this.hub != null)
{
AddText("Calling CloseAsync");
SetButtons(false, false);
await this.hub.CloseAsync();
SetButtons(true, false);
AddText("Hub Closed");
}
#endif
}
/// <summary>
/// Called when an unrecoverable error happen. After this event the hub will not send or receive any messages.
/// </summary>
private void Hub_OnError(HubConnection hub, string error)
{
SetButtons(true, false);
AddText(string.Format("Hub Error: <color=red>{0}</color>", error));
}
private void SetButtons(bool connect, bool close)
{
if (this._connectButton != null)
this._connectButton.interactable = connect;
if (this._closeButton != null)
this._closeButton.interactable = close;
}
private TextListItem AddText(string text)
{
return GUIHelper.AddText(this._listItemPrefab, this._contentRoot, text, this._maxListItemEntries, this._scrollRect);
}
}
}
#endif

View File

@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: e516808e7e284014c8b7afb3ff270943
timeCreated: 1577715218
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9e87559ef678942428f064af598c1696
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,68 @@
#if !BESTHTTP_DISABLE_SIGNALR_CORE
using System;
namespace BestHTTP.SignalRCore.Authentication
{
public sealed class HeaderAuthenticator : IAuthenticationProvider
{
/// <summary>
/// No pre-auth step required for this type of authentication
/// </summary>
public bool IsPreAuthRequired { get { return false; } }
#pragma warning disable 0067
/// <summary>
/// Not used event as IsPreAuthRequired is false
/// </summary>
public event OnAuthenticationSuccededDelegate OnAuthenticationSucceded;
/// <summary>
/// Not used event as IsPreAuthRequired is false
/// </summary>
public event OnAuthenticationFailedDelegate OnAuthenticationFailed;
#pragma warning restore 0067
private string _credentials;
public HeaderAuthenticator(string credentials)
{
this._credentials = credentials;
}
/// <summary>
/// Not used as IsPreAuthRequired is false
/// </summary>
public void StartAuthentication()
{ }
/// <summary>
/// Prepares the request by adding two headers to it
/// </summary>
public void PrepareRequest(BestHTTP.HTTPRequest request)
{
#if !UNITY_WEBGL || UNITY_EDITOR
request.SetHeader("Authorization", "Bearer " + this._credentials);
#endif
}
public Uri PrepareUri(Uri uri)
{
#if UNITY_WEBGL && !UNITY_EDITOR
string query = string.IsNullOrEmpty(uri.Query) ? "?" : uri.Query + "&";
UriBuilder uriBuilder = new UriBuilder(uri.Scheme, uri.Host, uri.Port, uri.AbsolutePath, query + "access_token=" + this._credentials);
return uriBuilder.Uri;
#else
return uri;
#endif
}
public void Cancel()
{
}
}
}
#endif

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 80b2246c164414c468eea4f0550eb9ad
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Some files were not shown because too many files have changed in this diff Show More