4 Commits

Author SHA1 Message Date
ab85472c36 Merge pull request '<feat> Octopus Twin 템플릿 적용, 사이드메뉴/탑메뉴 설정' (#2) from hsb/260225_00 into main
Reviewed-on: http://220.90.135.190:3000/UVCXR/EnglewoodLAB/pulls/2
2026-02-25 18:08:19 +09:00
SOOBEEN HAN
1e1c77f42c Merge branch 'main' of http://220.90.135.190:3000/UVCXR/EnglewoodLAB into hsb/260225_00 2026-02-25 18:06:09 +09:00
SOOBEEN HAN
ad7d133c15 <feat> LeftSidePanel, TopMenu 설정
- 사이드바 메뉴 클릭 시 아코디언 펼쳐짐
2026-02-25 18:03:06 +09:00
SOOBEEN HAN
f1894889ee <refactor> Octopus Twin 템플릿 적용
- 기능 외 UI 구조만 적용
- 프로젝트에 걸맞는 UI는 재작업 필요
2026-02-23 18:20:09 +09:00
3377 changed files with 4117395 additions and 16773 deletions

View File

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

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: cfc5174a9e572cd43bb89ff3fc90bbeb
folderAsset: yes
timeCreated: 1481296195
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 77a1babc1e1ba114d9877fe33a767863
folderAsset: yes
timeCreated: 1481296236
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,90 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Plain Line
m_Shader: {fileID: 4800000, guid: 0a799adfcb28a1847873696ef5d3c504, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords:
- _EMISSION
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 9959c8d64e68c9b49a96dd9de08c4315, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BumpScale: 1
- _ColorMask: 15
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Stencil: 0
- _StencilComp: 8
- _StencilOp: 0
- _StencilReadMask: 255
- _StencilWriteMask: 255
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0.5514706, g: 0.5514706, b: 0.5514706, a: 0.297}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bdb13d53e3b6bb549950dfa33b36f965
timeCreated: 1555445867
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: fff3b8ffe7caa3e4bac949806ad15420
folderAsset: yes
timeCreated: 1560534504
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 7e32c245b77d2ad4988ad2b8c7817c76
folderAsset: yes
timeCreated: 1481301823
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,258 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1000010491709800
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 224000012953180484}
- component: {fileID: 222000010169192002}
- component: {fileID: 65000010628792940}
- component: {fileID: 114000014180688636}
- component: {fileID: 114000010190779998}
- component: {fileID: 114000012281852168}
- component: {fileID: 114000012002413406}
- component: {fileID: 114000012218332012}
m_Layer: 14
m_Name: Bar
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &224000012953180484
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1000010491709800}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -4}
m_SizeDelta: {x: 10, y: 10}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &222000010169192002
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1000010491709800}
m_CullTransparentMesh: 1
--- !u!65 &65000010628792940
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1000010491709800}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0.5, z: 0}
--- !u!114 &114000014180688636
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1000010491709800}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ec91821f11c13dc4399cd444b0f3360a, type: 3}
m_Name:
m_EditorClassIdentifier:
OnMouseHover:
m_PersistentCalls:
m_Calls: []
OnMouseLeave:
m_PersistentCalls:
m_Calls: []
OnSelected:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName: UI_Bar, Assembly-CSharp
m_MethodName: OnClick
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
--- !u!114 &114000010190779998
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1000010491709800}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 68eb8a9ffb98caa4ba2dfcd1198e3c4c, type: 3}
m_Name:
m_EditorClassIdentifier:
GrowMultiplier: 1.1
VerticalOnly: 0
HorizontalOnly: 0
TimeScale: 2
GrowEaseFunction:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.28608084
value: 1.5205606
inSlope: 1.437068
outSlope: 1.437068
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.5302414
value: 0.81470245
inSlope: -1.4567375
outSlope: -1.4567375
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.7786253
value: 1.082374
inSlope: 2.0375848
outSlope: 2.0375848
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
ShrinkEaseFunction:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!114 &114000012281852168
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1000010491709800}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8feef96b2dc87824c82b7d0425846b72, type: 3}
m_Name:
m_EditorClassIdentifier:
LerpTime: 0.1
--- !u!114 &114000012002413406
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1000010491709800}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 2100000, guid: 704c021e90a4e044bade2523a5df91cc, type: 2}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
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
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &114000012218332012
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1000010491709800}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b2293c1b6f7576340a735611ed9f9bd2, type: 3}
m_Name:
m_EditorClassIdentifier:
Selected: 0
HandleEvents: 1
materials:
Normal: {fileID: 0}
Hover: {r: 0, g: 0, b: 0, a: 0}
Selected: {r: 0, g: 0, b: 0, a: 0}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e0e962d45efcf3648931eb569595e722
timeCreated: 1481382335
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: a53b2b35c4b0ad643a24140bb6f2ced8
folderAsset: yes
timeCreated: 1491931768
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,197 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &189882
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 22455072}
- component: {fileID: 22219062}
- component: {fileID: 6569098}
- component: {fileID: 11494010}
- component: {fileID: 11431222}
- component: {fileID: 11412660}
- component: {fileID: 11412696}
m_Layer: 0
m_Name: LineHoverSlim 1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &22455072
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 189882}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -4}
m_SizeDelta: {x: 10, y: 10}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &22219062
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 189882}
m_CullTransparentMesh: 1
--- !u!65 &6569098
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 189882}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0.5, z: 0}
--- !u!114 &11494010
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 189882}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 68eb8a9ffb98caa4ba2dfcd1198e3c4c, type: 3}
m_Name:
m_EditorClassIdentifier:
GrowMultiplier: 1.8
VerticalOnly: 1
HorizontalOnly: 0
TimeScale: 8
GrowEaseFunction:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 1
inSlope: 2
outSlope: 2
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
ShrinkEaseFunction:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 2
outSlope: 2
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!114 &11431222
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 189882}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8feef96b2dc87824c82b7d0425846b72, type: 3}
m_Name:
m_EditorClassIdentifier:
LerpTime: 0.5
--- !u!114 &11412660
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 189882}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 0, b: 0, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 9959c8d64e68c9b49a96dd9de08c4315, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &11412696
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 189882}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b2293c1b6f7576340a735611ed9f9bd2, type: 3}
m_Name:
m_EditorClassIdentifier:
Selected: 0
HandleEvents: 0
materials:
Normal: {fileID: 2100000, guid: 013d58c11f05fbc4a8a1b7574deebfaf, type: 2}
Hover: {r: 1, g: 1, b: 1, a: 1}
Selected: {r: 0, g: 0, b: 0, a: 0}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8ebeaa4955a089c4cb158487ac684ee1
timeCreated: 1513882816
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,197 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &110476
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 22452250}
- component: {fileID: 22244840}
- component: {fileID: 6561436}
- component: {fileID: 11475216}
- component: {fileID: 11415318}
- component: {fileID: 11460994}
- component: {fileID: 11493770}
m_Layer: 0
m_Name: PointHover 1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &22452250
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 110476}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -4}
m_SizeDelta: {x: 10, y: 10}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &22244840
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 110476}
m_CullTransparentMesh: 1
--- !u!65 &6561436
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 110476}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0.5, z: 0}
--- !u!114 &11475216
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 110476}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 68eb8a9ffb98caa4ba2dfcd1198e3c4c, type: 3}
m_Name:
m_EditorClassIdentifier:
GrowMultiplier: 2
VerticalOnly: 0
HorizontalOnly: 0
TimeScale: 4
GrowEaseFunction:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 1
inSlope: 2
outSlope: 2
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
ShrinkEaseFunction:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 2
outSlope: 2
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!114 &11415318
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 110476}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8feef96b2dc87824c82b7d0425846b72, type: 3}
m_Name:
m_EditorClassIdentifier:
LerpTime: 0.2
--- !u!114 &11460994
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 110476}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 2100000, guid: 704c021e90a4e044bade2523a5df91cc, type: 2}
m_Color: {r: 1, g: 0.57255626, b: 0.50735295, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 8a67b5fb3576e6c47803b7e2eb3a3bb5, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &11493770
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 110476}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b2293c1b6f7576340a735611ed9f9bd2, type: 3}
m_Name:
m_EditorClassIdentifier:
Selected: 0
HandleEvents: 0
materials:
Normal: {fileID: 2100000, guid: 013d58c11f05fbc4a8a1b7574deebfaf, type: 2}
Hover: {r: 1, g: 1, b: 1, a: 1}
Selected: {r: 0, g: 0, b: 0, a: 0}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 78274e2387f53cc4a964ff5f17369d72
timeCreated: 1513882815
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,197 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &110476
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 22452250}
- component: {fileID: 22244840}
- component: {fileID: 6561436}
- component: {fileID: 11475216}
- component: {fileID: 11415318}
- component: {fileID: 11460994}
- component: {fileID: 11493770}
m_Layer: 0
m_Name: PointHover 2
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &22452250
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 110476}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -4}
m_SizeDelta: {x: 10, y: 10}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &22244840
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 110476}
m_CullTransparentMesh: 1
--- !u!65 &6561436
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 110476}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0.5, z: 0}
--- !u!114 &11475216
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 110476}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 68eb8a9ffb98caa4ba2dfcd1198e3c4c, type: 3}
m_Name:
m_EditorClassIdentifier:
GrowMultiplier: 1.2
VerticalOnly: 0
HorizontalOnly: 0
TimeScale: 4
GrowEaseFunction:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 1
inSlope: 2
outSlope: 2
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
ShrinkEaseFunction:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 2
outSlope: 2
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!114 &11415318
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 110476}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8feef96b2dc87824c82b7d0425846b72, type: 3}
m_Name:
m_EditorClassIdentifier:
LerpTime: 0.2
--- !u!114 &11460994
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 110476}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 2100000, guid: 704c021e90a4e044bade2523a5df91cc, type: 2}
m_Color: {r: 1, g: 0.57255626, b: 0.50735295, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 48896e4f76c73b545b33e6eb946fe8e4, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &11493770
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 110476}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b2293c1b6f7576340a735611ed9f9bd2, type: 3}
m_Name:
m_EditorClassIdentifier:
Selected: 0
HandleEvents: 0
materials:
Normal: {fileID: 2100000, guid: 013d58c11f05fbc4a8a1b7574deebfaf, type: 2}
Hover: {r: 1, g: 1, b: 1, a: 1}
Selected: {r: 0, g: 0, b: 0, a: 0}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b5b0f8ed1c1242c40ac4fa12f9bd1a1b
timeCreated: 1516809723
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 66c92e53d5f46df4b83fcdc94bcbd7a6
folderAsset: yes
timeCreated: 1500223334
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,97 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1000010431706550
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 224000012360208976}
- component: {fileID: 222000013396716008}
- component: {fileID: 114000012995897278}
- component: {fileID: 114000011666237120}
m_Layer: 5
m_Name: ShadedText 1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &224000012360208976
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1000010431706550}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 78, y: -89.5}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &222000013396716008
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1000010431706550}
m_CullTransparentMesh: 1
--- !u!114 &114000012995897278
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1000010431706550}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.809}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 12800000, guid: c2782129cb810e94598de8596f6acd6c, type: 3}
m_FontSize: 17
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 52
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 0
m_HorizontalOverflow: 1
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: New Text
--- !u!114 &114000011666237120
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1000010431706550}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cfabb0440166ab443bba8876756fdfa9, type: 3}
m_Name:
m_EditorClassIdentifier:
m_EffectColor: {r: 0, g: 0, b: 0, a: 0.197}
m_EffectDistance: {x: 4, y: -4}
m_UseGraphicAlpha: 1

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fa8a37cac60da9c41b8aa59bfd823fcd
timeCreated: 1513872840
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,243 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1000011919051762
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 224000013142301364}
- component: {fileID: 222000011988476122}
- component: {fileID: 114000011523374616}
- component: {fileID: 114000010416211880}
- component: {fileID: 114000010241586894}
m_Layer: 5
m_Name: WhiteText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &224000013142301364
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1000011919051762}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 78, y: 161}
m_SizeDelta: {x: 201.03, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &222000011988476122
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1000011919051762}
m_CullTransparentMesh: 0
--- !u!114 &114000011523374616
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1000011919051762}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 37
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 94
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 0
m_HorizontalOverflow: 1
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: New Text
--- !u!114 &114000010416211880
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1000011919051762}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0b148fe25e99eb48b9724523833bab1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Delegates:
- eventID: 0
callback:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 114000010241586894}
m_TargetAssemblyTypeName:
m_MethodName: Grow
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_Target: {fileID: 0}
m_TargetAssemblyTypeName:
m_MethodName: ChangeToHover
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
- eventID: 1
callback:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 114000010241586894}
m_TargetAssemblyTypeName:
m_MethodName: Shrink
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_Target: {fileID: 0}
m_TargetAssemblyTypeName:
m_MethodName: ChangeToNormal
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
--- !u!114 &114000010241586894
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1000011919051762}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 68eb8a9ffb98caa4ba2dfcd1198e3c4c, type: 3}
m_Name:
m_EditorClassIdentifier:
GrowMultiplier: 1.2
VerticalOnly: 0
HorizontalOnly: 0
TimeScale: 2
GrowEaseFunction:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.28608084
value: 1.5205606
inSlope: 1.437068
outSlope: 1.437068
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.5302414
value: 0.81470245
inSlope: -1.4567375
outSlope: -1.4567375
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.7786253
value: 1.082374
inSlope: 2.0375848
outSlope: 2.0375848
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
ShrinkEaseFunction:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e686e7c904b1d4b44a8eae8475c67797
timeCreated: 1481389262
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@@ -0,0 +1,75 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace ChartAndGraph
{
/// <summary>
/// base class for some chart datasources
/// </summary>
[Serializable]
public abstract class AbstractChartData
{
protected class Slider
{
public string category;
public string group;
public double from;
public double to;
public float startTime;
public float totalTime;
public float timeScale = 1f;
public AnimationCurve curve;
public bool UpdateSlider(AbstractChartData data)
{
float time = Time.time;
float elasped = time - startTime;
elasped *= timeScale;
if (elasped > totalTime)
{
data.SetValueInternal(category, group, to);
return true;
}
float factor = elasped / totalTime;
if (curve != null)
factor = curve.Evaluate(factor);
double newValue = from * (1.0 - factor) + to * factor;
data.SetValueInternal(category, group, newValue);
return false;
}
}
protected List<Slider> mSliders = new List<Slider>();
protected void RemoveSliderForGroup(string group)
{
mSliders.RemoveAll(x => { return x.group == group; });
}
protected void RemoveSliderForCategory(string category)
{
mSliders.RemoveAll(x => { return x.category == category; });
}
protected void RemoveSlider(string category,string group)
{
mSliders.RemoveAll(x=> { return x.category == category && x.group == group; });
}
bool DoSlider(Slider s)
{
return s.UpdateSlider(this);
}
protected void UpdateSliders()
{
mSliders.RemoveAll(DoSlider);
}
protected abstract void SetValueInternal(string column, string row, double value);
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: ac05131a8f94e364795b93d46ca41bb2
timeCreated: 1480003631
licenseType: Store
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,12 @@
fileFormatVersion: 2
guid: 99b21cf8e1d2af7499093362c052374a
timeCreated: 1471942061
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 92451bac0b7be6043863fed0a49875d9
folderAsset: yes
timeCreated: 1560597121
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,12 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ChartAndGraph
{
public class CanvasAttribute :Attribute
{
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: ac18aa2c7926afe44930ef269d844e0c
timeCreated: 1479124371
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,29 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ChartAndGraph
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = true)]
public class ChartFillerEditorAttribute : Attribute
{
public GraphDataFiller.DataType ShowForType;
public ChartFillerEditorAttribute(GraphDataFiller.DataType type)
{
ShowForType = type;
}
public BarDataFiller.DataType ShowForBarType;
public ChartFillerEditorAttribute(BarDataFiller.DataType type)
{
ShowForBarType = type;
}
public RadarDataFiller.DataType ShowForRadarType;
public ChartFillerEditorAttribute(RadarDataFiller.DataType type)
{
ShowForRadarType = type;
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 7a260abf3570275488c42177ee1fc458
timeCreated: 1536697084
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,12 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ChartAndGraph
{
public class NonCanvasAttribute : Attribute
{
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b871f42477dcab14f93bce1895ffc9cf
timeCreated: 1479124371
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,12 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ChartAndGraph
{
public class SimpleAttribute : Attribute
{
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: dd5be9d4f47a8a54c8d210060b356de8
timeCreated: 1479124371
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 933231935de983c419d9763bda4d697d
folderAsset: yes
timeCreated: 1560548194
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,55 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ChartAndGraph
{
/// <summary>
/// this class holds a float value that can be either set mannualy or be set automatically by an external class
/// </summary>
[Serializable]
public struct AutoFloat
{
/// <summary>
/// true if the value is automatic
/// </summary>
public bool Automatic;
/// <summary>
/// the mannual value , this is only relevant if Automatic == false
/// </summary>
public float Value;
/// <summary>
/// creats a new instance of AutoFloat
/// </summary>
/// <param name="automatic"></param>
/// <param name="value"></param>
public AutoFloat(bool automatic,float value)
{
Automatic = automatic;
Value = value;
}
public override bool Equals(object obj)
{
if(obj is AutoFloat)
{
AutoFloat cast = (AutoFloat)obj;
if (cast.Automatic == true && Automatic == true)
return true;
if (cast.Automatic == false && Automatic == false && cast.Value == Value)
return true;
return false;
}
return false;
}
public override int GetHashCode()
{
if (Automatic == true)
return Automatic.GetHashCode();
return Value.GetHashCode();
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e6595b44672cf1b468860d62030e1c4d
timeCreated: 1479209594
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,807 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UI;
namespace ChartAndGraph
{
/// <summary>
/// base class for all axis monobehaviours. This class contains paramets for defining chart axis
/// </summary>
public abstract class AxisBase : ChartSettingItemBase, ISerializationCallbackReceiver
{
#pragma warning disable 0414
/// <summary>
/// used internally by the axis inspector
/// </summary>
[SerializeField]
private bool SimpleView = true;
#pragma warning restore 0414
/// <summary>
/// the format of the axis labels. This can be either a number, time or date time. If the selected value is either DateTime or Time , user ChartDateUtillity to convert dates to double values that can be set to the chart.
/// </summary>
[SerializeField]
[Tooltip("the format of the axis labels. This can be either a number, time or date time. If the selected value is either DateTime or Time , user ChartDateUtillity to convert dates to double values that can be set to the graph")]
private AxisFormat format;
/// <summary>
/// the format of the axis labels. This can be either a number, time or date time. If the selected value is either DateTime or Time , user ChartDateUtillity to convert dates to double values that can be set to the chart.
/// </summary>
public AxisFormat Format
{
get { return format; }
set
{
format = value;
RaiseOnChanged();
}
}
[SerializeField]
[Tooltip("")]
private bool withEdges2 = true;
public bool WithEdges
{
get { return withEdges2; }
set
{
withEdges2 = value;
RaiseOnChanged();
}
}
/// <summary>
/// the depth of the axis reltive to the chart position
/// </summary>
[SerializeField]
[Tooltip("the depth of the axis reltive to the chart position")]
private AutoFloat depth;
public AutoFloat Depth
{
get { return depth; }
set { depth = value;
RaiseOnChanged();
}
}
[SerializeField]
[Tooltip("The main divisions of the chart axis")]
[FormerlySerializedAs("MainDivisions")]
private ChartMainDivisionInfo mainDivisions = new ChartMainDivisionInfo();
[SerializeField]
[Tooltip("The sub divisions of each main division")]
[FormerlySerializedAs("SubDivisions")]
private ChartSubDivisionInfo subDivisions = new ChartSubDivisionInfo();
private Dictionary<double, string> mFormats = new Dictionary<double, string>();
private List<double> mTmpToRemove = new List<double>();
/// <summary>
/// the main division properies for this axis
/// </summary>
public ChartMainDivisionInfo MainDivisions { get { return mainDivisions; } }
/// <summary>
/// the sub division properies for this axis
/// </summary>
public ChartDivisionInfo SubDivisions { get { return subDivisions; } }
public void ClearFormats()
{
mFormats.Clear();
}
public AxisBase()
{
AddInnerItems();
}
private void AddInnerItems()
{
AddInnerItem(MainDivisions);
AddInnerItem(SubDivisions);
}
/// <summary>
/// used internally to hold data required for updating the axis lables
/// </summary>
internal class TextData
{
public ChartDivisionInfo info;
public double interp;
public int fractionDigits;
}
/// <summary>
/// checks that all properies of this instance have valid values. This method is used internally and should not be called
/// </summary>
public void ValidateProperties()
{
mainDivisions.ValidateProperites();
subDivisions.ValidateProperites();
}
/// <summary>
/// retrieves the begining and end division of the chart
/// </summary>
/// <param name="parent"></param>
/// <param name="orientation"></param>
/// <param name="total"></param>
/// <param name="start"></param>
/// <param name="end"></param>
private void GetStartEnd(AnyChart parent, ChartOrientation orientation, float total, out float start, out float end)
{
start = 0;
end = total;
// if ((orientation == ChartOrientation.Horizontal) ? parent.Frame.Left.Visible : parent.Frame.Bottom.Visible)
// ++start;
// if ((orientation == ChartOrientation.Horizontal) ? parent.Frame.Right.Visible : parent.Frame.Top.Visible)
// --end;
}
/// <summary>
/// sets the uv of a chart mesh based on the current length and offset
/// </summary>
/// <param name="mesh"></param>
/// <param name="length"></param>
/// <param name="offset"></param>
private void SetMeshUv(IChartMesh mesh, float length,float offset)
{
if (length < 0)
offset -= length;
mesh.Length = length;
mesh.Offset = offset;
}
class DivisionEnumerable : IEnumerable
{
double mStartValue, mFraction, mDirection, mGap, mEndValue;
bool mWithSides;
public DivisionEnumerable(double startValue, double fraction, double direction,double gap,double endValue,bool withSides)
{
mStartValue = startValue;
mFraction = fraction;
mDirection = direction;
mGap = gap;
mEndValue = endValue;
mWithSides = withSides;
}
IEnumerator IEnumerable.GetEnumerator()
{
double startRange = mStartValue + mFraction;
if(Math.Abs(mFraction) <0.001f && mWithSides)
yield return mStartValue;
for (double current = startRange; mDirection * current < mDirection * mEndValue; current += mGap * mDirection)
yield return current;
if(mWithSides)
yield return mDirection * mEndValue;
}
}
private void DrawCustomDivisions(double scrollOffset, AnyChart parent, Transform parentTransform, ChartDivisionInfo info, IChartMesh mesh, int group, ChartOrientation orientation, bool oppositeSide,bool subDivision = false)
{
//scrollOffset = -scrollOffset;
double parentSize = (orientation == ChartOrientation.Vertical) ? ((IInternalUse)parent).InternalTotalHeight : ((IInternalUse)parent).InternalTotalWidth;
DoubleVector3 startPosition, lengthDirection, advanceDirection;
GetDirectionVectors(parent, info, orientation, 0f, oppositeSide, out startPosition, out lengthDirection, out advanceDirection);
double markDepth = ChartCommon.GetAutoDepth(parent, orientation, info);
double length = ChartCommon.GetAutoLength(parent, orientation, info);
double backLength = (orientation == ChartOrientation.Vertical) ? ((IInternalUse)parent).InternalTotalWidth : ((IInternalUse)parent).InternalTotalHeight;
if (info.MarkBackLength.Automatic == false)
backLength = info.MarkBackLength.Value;
double totaluv = Math.Abs(length);
if (backLength != 0 && markDepth > 0)
totaluv += Math.Abs(backLength) + Math.Abs(markDepth);
DoubleVector3 halfThickness = advanceDirection * (info.MarkThickness * 0.5f);
// if (scrollOffset != 0f)
// last--;
bool hasValues = ((IInternalUse)parent).InternalHasValues(this);
double maxValue = ((IInternalUse)parent).InternalMaxValue(this);
double minValue = ((IInternalUse)parent).InternalMinValue(this);
double range = maxValue - minValue;
float AutoAxisDepth = Depth.Value;
//float scrollFactor = (scrollOffset / (float)(maxValue - minValue));
//scrollOffset = scrollFactor * parentSize;
if (Depth.Automatic)
{
AutoAxisDepth = (float)((((IInternalUse)parent).InternalTotalDepth) - markDepth);
}
double startValue = (scrollOffset + minValue);
double endValue = (scrollOffset + maxValue) + double.Epsilon;
double direction = 1.0;
Func<double, double> ValueToPosition = x => ((x - startValue) / range) * parentSize;
if (startValue > endValue)
{
direction = -1.0;
//ValueToPosition = x => (1.0- ((x - startValue) / range)) * parentSize;
}
mTmpToRemove.Clear();
foreach (double key in mFormats.Keys)
{
if (key * direction > endValue * direction || key * direction < startValue * direction)
mTmpToRemove.Add(key);
}
for (int k = 0; k < mTmpToRemove.Count; k++)
mFormats.Remove(mTmpToRemove[k]);
HashSet<double> customValues = (orientation == ChartOrientation.Vertical) ? ((IInternalUse)parent).VerticalCustomAxis : ((IInternalUse)parent).HorizontalCustomAxis;
if(subDivision)
customValues = (orientation == ChartOrientation.Vertical) ? ((IInternalUse)parent).VerticalCustomAxisSubDivision : ((IInternalUse)parent).HorizontalCustomAxisSubDivision;
foreach (double current in customValues)
{
double offset = ValueToPosition(current);
if (offset < 0 || offset > parentSize)
continue;
DoubleVector3 start = startPosition + advanceDirection * offset;
DoubleVector3 size = halfThickness + length * lengthDirection;
start -= halfThickness;
//size += halfThickness;
float uvoffset = 0f;
Rect r = ChartCommon.FixRect(new Rect((float)start.x, (float)start.y, (float)size.x, (float)size.y));
SetMeshUv(mesh, (float)(-length / totaluv), uvoffset);
uvoffset += Math.Abs(mesh.Length);
mesh.AddXYRect(r, group, AutoAxisDepth);
if (hasValues)
{
double val = Math.Round(current * 1000.0) / 1000.0;
string toSet = "";
double keyVal = val;// (int)Math.Round(val);
var dic = (orientation == ChartOrientation.Horizontal) ? parent.HorizontalValueToStringMap : parent.VerticalValueToStringMap;
if (!(Math.Abs(val - keyVal) < 0.001 && dic.TryGetValue(keyVal, out toSet)))
{
if (mFormats.TryGetValue(val, out toSet) == false)
{
if (format == AxisFormat.Number)
toSet = ChartAdancedSettings.Instance.FormatFractionDigits(info.FractionDigits, val, parent.CustomNumberFormat);
else
{
DateTime date = ChartDateUtility.ValueToDate(val);
if (format == AxisFormat.DateTime)
toSet = ChartDateUtility.DateToDateTimeString(date, parent.CustomDateTimeFormat);
else
{
if (format == AxisFormat.Date)
toSet = ChartDateUtility.DateToDateString(date);
else
toSet = ChartDateUtility.DateToTimeString(date);
}
}
toSet = info.TextPrefix + toSet + info.TextSuffix;
mFormats[val] = toSet;
}
}
else
{
toSet = info.TextPrefix + toSet + info.TextSuffix;
}
DoubleVector3 textPos = new DoubleVector3(start.x, start.y);
textPos += lengthDirection * info.TextSeperation;
TextData userData = new TextData();
userData.interp = (offset / parentSize);
userData.info = info;
userData.fractionDigits = info.FractionDigits;
mesh.AddText(parent, info.TextPrefab, parentTransform, info.FontSize, info.FontSharpness, toSet, (float)textPos.x, (float)textPos.y, AutoAxisDepth + info.TextDepth, 0f, userData);
}
if (markDepth > 0)
{
if (orientation == ChartOrientation.Horizontal)
{
SetMeshUv(mesh, (float)(markDepth / totaluv), uvoffset);
r = ChartCommon.FixRect(new Rect((float)start.x, AutoAxisDepth, (float)size.x, (float)markDepth));
mesh.AddXZRect(r, group, (float)start.y);
}
else
{
SetMeshUv(mesh, (float)(-markDepth / totaluv), uvoffset);
r = ChartCommon.FixRect(new Rect((float)start.y, AutoAxisDepth, (float)size.y, (float)markDepth));
mesh.AddYZRect(r, group, (float)start.x);
}
uvoffset += Math.Abs(mesh.Length);
if (backLength != 0)
{
SetMeshUv(mesh, (float)(backLength / totaluv), uvoffset);
uvoffset += Math.Abs(mesh.Length);
DoubleVector3 backSize = halfThickness + backLength * lengthDirection;
Rect backR = ChartCommon.FixRect(new Rect((float)start.x, (float)start.y, (float)backSize.x, (float)backSize.y));
mesh.AddXYRect(backR, group, (float)(AutoAxisDepth + markDepth));
}
}
}
}
private void DrawDivisions(double scrollOffset, AnyChart parent, Transform parentTransform, ChartDivisionInfo info, IChartMesh mesh, int group, ChartOrientation orientation, double gap, bool oppositeSide, double mainGap)
{
//scrollOffset = -scrollOffset;
double parentSize = (orientation == ChartOrientation.Vertical) ? ((IInternalUse)parent).InternalTotalHeight : ((IInternalUse)parent).InternalTotalWidth;
DoubleVector3 startPosition, lengthDirection, advanceDirection;
GetDirectionVectors(parent, info, orientation, 0f, oppositeSide, out startPosition, out lengthDirection, out advanceDirection);
double markDepth = ChartCommon.GetAutoDepth(parent, orientation, info);
double length = ChartCommon.GetAutoLength(parent, orientation, info);
double backLength = (orientation == ChartOrientation.Vertical) ? ((IInternalUse)parent).InternalTotalWidth : ((IInternalUse)parent).InternalTotalHeight;
if (info.MarkBackLength.Automatic == false)
backLength = info.MarkBackLength.Value;
double totaluv = Math.Abs(length);
if (backLength != 0 && markDepth > 0)
totaluv += Math.Abs(backLength) + Math.Abs(markDepth);
DoubleVector3 halfThickness = advanceDirection * (info.MarkThickness * 0.5f);
// if (scrollOffset != 0f)
// last--;
bool hasValues = ((IInternalUse)parent).InternalHasValues(this);
double maxValue = ((IInternalUse)parent).InternalMaxValue(this);
double minValue = ((IInternalUse)parent).InternalMinValue(this);
double range = maxValue - minValue;
float AutoAxisDepth = Depth.Value;
// float scrollFactor = (scrollOffset / (float)(maxValue - minValue));
//scrollOffset = scrollFactor * parentSize;
if (Depth.Automatic)
{
AutoAxisDepth = (float)((((IInternalUse)parent).InternalTotalDepth) - markDepth);
}
double startValue = (scrollOffset + minValue);
double endValue = (scrollOffset + maxValue) + double.Epsilon;
double direction = 1.0;
Func<double, double> ValueToPosition = x => ((x - startValue) / range) * parentSize;
if (startValue > endValue)
{
direction = -1.0;
//ValueToPosition = x => (1.0- ((x - startValue) / range)) * parentSize;
}
gap = Math.Abs(gap);
double fraction = gap - (scrollOffset - Math.Floor((scrollOffset / gap) - double.Epsilon) * gap);
double mainfraction = -1f;
double currentMain = 0f;
if (mainGap > 0f)
{
mainfraction = mainGap - (scrollOffset - Math.Floor((scrollOffset / mainGap) - double.Epsilon) * mainGap);
currentMain = (scrollOffset + minValue + mainfraction);
}
int i = 0;
mTmpToRemove.Clear();
double startRange = startValue + fraction;
foreach (double key in mFormats.Keys)
{
if (key* direction > endValue* direction || key* direction < startRange* direction)
mTmpToRemove.Add(key);
}
for(int k=0; k<mTmpToRemove.Count; k++)
mFormats.Remove(mTmpToRemove[k]);
foreach (double current in new DivisionEnumerable(startValue,fraction,direction,gap,endValue, WithEdges))
{
++i;
if (i > 3000)
{
break;
}
if (mainGap > 0.0)
{
if(Math.Abs(current - currentMain) < 0.00001)
{
currentMain += mainGap;
continue;
}
if(current > currentMain)
{
currentMain += mainGap;
}
}
double offset = ValueToPosition(current);
if (offset < 0 || offset > parentSize)
continue;
DoubleVector3 start = startPosition + advanceDirection * offset;
DoubleVector3 size = halfThickness + length * lengthDirection;
start -= halfThickness*0.5f;
//size += halfThickness;
float uvoffset = 0f;
Rect r = ChartCommon.FixRect(new Rect((float)start.x, (float)start.y, (float)size.x, (float)size.y));
SetMeshUv(mesh, (float)(-length / totaluv), uvoffset);
uvoffset += Math.Abs(mesh.Length);
mesh.AddXYRect(r, group, AutoAxisDepth);
if (hasValues)
{
double val = Math.Round(current*10000000.0)/ 10000000.0;
string toSet = "";
double keyVal = val;// (int)Math.Round(val);
var dic = (orientation == ChartOrientation.Horizontal) ? parent.HorizontalValueToStringMap : parent.VerticalValueToStringMap;
if (!(Math.Abs(val - keyVal) < 0.0000001 && dic.TryGetValue(keyVal, out toSet)))
{
if (mFormats.TryGetValue(val, out toSet) == false)
{
if (format == AxisFormat.Number)
toSet = ChartAdancedSettings.Instance.FormatFractionDigits(info.FractionDigits, val, parent.CustomNumberFormat);
else
{
DateTime date = ChartDateUtility.ValueToDate(val);
if (format == AxisFormat.DateTime)
toSet = ChartDateUtility.DateToDateTimeString(date, parent.CustomDateTimeFormat);
else
{
if (format == AxisFormat.Date)
toSet = ChartDateUtility.DateToDateString(date);
else
toSet = ChartDateUtility.DateToTimeString(date);
}
}
toSet = info.TextPrefix + toSet + info.TextSuffix;
mFormats[val] = toSet;
}
}
else
{
toSet = info.TextPrefix + toSet + info.TextSuffix;
}
DoubleVector3 textPos = new DoubleVector3(start.x, start.y);
textPos += lengthDirection * info.TextSeperation;
textPos += halfThickness * 0.5f;
TextData userData = new TextData();
userData.interp = (float)(offset/parentSize);
userData.info = info;
userData.fractionDigits = info.FractionDigits;
mesh.AddText(parent, info.TextPrefab, parentTransform, info.FontSize, info.FontSharpness, toSet, (float)textPos.x, (float)textPos.y, AutoAxisDepth + info.TextDepth, 0f, userData);
}
if (markDepth > 0)
{
if (orientation == ChartOrientation.Horizontal)
{
SetMeshUv(mesh,(float)( markDepth / totaluv), uvoffset);
r = ChartCommon.FixRect(new Rect((float)start.x, AutoAxisDepth, (float)size.x, (float)markDepth));
mesh.AddXZRect(r, group, (float)start.y);
}
else
{
SetMeshUv(mesh,(float) (-markDepth / totaluv), uvoffset);
r = ChartCommon.FixRect(new Rect((float)start.y, AutoAxisDepth, (float)size.y, (float)markDepth));
mesh.AddYZRect(r, group, (float)start.x);
}
uvoffset += Math.Abs(mesh.Length);
if (backLength != 0)
{
SetMeshUv(mesh, (float)(backLength / totaluv), uvoffset);
uvoffset += Math.Abs(mesh.Length);
DoubleVector3 backSize = halfThickness + backLength * lengthDirection;
Rect backR = ChartCommon.FixRect(new Rect((float)start.x, (float)start.y, (float)backSize.x, (float)backSize.y));
mesh.AddXYRect(backR, group, (float)(AutoAxisDepth + markDepth));
}
}
}
// Debug.Log("start");
// Debug.Log(mFormats.Count);
// Debug.Log(cached);
}
// /// <summary>
// /// used internally to draw the division of the axis into a chart mesh
// /// </summary>
// /// <param name="parent"></param>
// /// <param name="parentTransform"></param>
// /// <param name="info"></param>
// /// <param name="mesh"></param>
// /// <param name="group"></param>
// /// <param name="orientation"></param>
// /// <param name="totalDivisions"></param>
// /// <param name="oppositeSide"></param>
// /// <param name="skip"></param>
// private void DrawDivisions(float scrollOffset,AnyChart parent, Transform parentTransform, ChartDivisionInfo info, IChartMesh mesh, int group, ChartOrientation orientation, float totalDivisions, bool oppositeSide, int skip)
// {
// //scrollOffset = -scrollOffset;
// float parentSize = (orientation == ChartOrientation.Vertical) ? ((IInternalUse)parent).InternalTotalHeight : ((IInternalUse)parent).InternalTotalWidth;
// Vector2 startPosition, lengthDirection, advanceDirection;
// GetDirectionVectors(parent, info, orientation, 0f, oppositeSide, out startPosition, out lengthDirection, out advanceDirection);
// float markDepth = ChartCommon.GetAutoDepth(parent, orientation, info);
// float length = ChartCommon.GetAutoLength(parent, orientation, info);
// float backLength = (orientation == ChartOrientation.Vertical) ? ((IInternalUse)parent).InternalTotalWidth : ((IInternalUse)parent).InternalTotalHeight;
// if (info.MarkBackLength.Automatic == false)
// backLength = info.MarkBackLength.Value;
// float totaluv = Math.Abs(length);
// if (backLength != 0 && markDepth > 0)
// totaluv += Math.Abs(backLength) + Math.Abs(markDepth);
// Vector2 halfThickness = advanceDirection * (info.MarkThickness * 0.5f);
// // if (scrollOffset != 0f)
// // last--;
// bool hasValues = ((IInternalUse)parent).InternalHasValues(this);
// double maxValue = ((IInternalUse)parent).InternalMaxValue(this);
// double minValue = ((IInternalUse)parent).InternalMinValue(this);
// ChartMainDivisionInfo main = info as ChartMainDivisionInfo;
// float divisionComplement = 0f;
// float divisionOffsetComplement = 0f;
// if (main != null)
// {
// if(main.Messure == ChartDivisionInfo.DivisionMessure.DataUnits)
// {
// if (main.UnitsPerDivision <= 0.0001f)
// return;
// float range = (float)(maxValue - minValue);
// totalDivisions = (range / main.UnitsPerDivision) + 1;
// divisionComplement = (float)(1f - (main.UnitsPerDivision - Math.Truncate(main.UnitsPerDivision))) / range;
// divisionOffsetComplement = (divisionComplement) * parentSize;
// }
// }
// float first, last;
// GetStartEnd(parent, orientation, totalDivisions, out first, out last);
// float AutoAxisDepth = Depth.Value;
// float scrollFactor = (scrollOffset / (float)(maxValue - minValue));
// scrollOffset = scrollFactor * parentSize;
// if (Depth.Automatic)
// {
// AutoAxisDepth = (((IInternalUse)parent).InternalTotalDepth) - markDepth;
// }
// float floorLast = Mathf.Floor(last);
// for (float i = first; i < floorLast; i++)
// {
// if (skip != -1 && ((int)i) % skip == 0)
// continue;
// float factor = ((float)i) / (float)(totalDivisions - 1);
// float offset = -scrollOffset + factor * parentSize;
// if (scrollOffset != 0f)
// {
// float prevOffs = offset;
// offset = offset - Mathf.Floor((offset / parentSize)) * parentSize;
//// Debug.Log("prev " + prevOffs);
//// Debug.Log("offs " + offset);
// if (offset < prevOffs)
// {
// offset -= divisionOffsetComplement;
// }
// }
// if (offset < 0f)
// continue;
// Vector2 start = startPosition + advanceDirection * offset;
// Vector2 size = halfThickness + length * lengthDirection;
// start -= halfThickness;
// //size += halfThickness;
// float uvoffset = 0f;
// Rect r = ChartCommon.FixRect(new Rect(start.x, start.y, size.x, size.y));
// SetMeshUv(mesh, -length / totaluv, uvoffset);
// uvoffset += Math.Abs(mesh.Length);
// mesh.AddXYRect(r, group, AutoAxisDepth);
// if (hasValues)
// {
// float valFactor = -scrollFactor + factor;
// if (scrollOffset != 0f)
// {
// float prevFact = valFactor;
// valFactor -= Mathf.Floor(valFactor);
// if(valFactor < prevFact)
// {
// valFactor -= divisionComplement;
// }
// }
// //valFactor += scrollFactor;
// double offsetPos = (maxValue - minValue) * valFactor;
// double scroll = minValue + ((maxValue - minValue) * scrollFactor);
// double val = scroll + offsetPos;
// string toSet = "";
// if (format == AxisFormat.Number)
// toSet = ChartAdancedSettings.Instance.FormatFractionDigits(info.FractionDigits, (float)val);
// else
// {
// DateTime date = ChartDateUtility.ValueToDate(val);
// if (format == AxisFormat.DateTime)
// toSet = ChartDateUtility.DateToDateTimeString(date);
// else
// {
// if (format == AxisFormat.Date)
// toSet = ChartDateUtility.DateToDateString(date);
// else
// toSet = ChartDateUtility.DateToTimeString(date);
// }
// }
// toSet = info.TextPrefix + toSet + info.TextSuffix;
// Vector2 textPos = new Vector2(start.x, start.y);
// textPos += lengthDirection * info.TextSeperation;
// TextData userData = new TextData();
// userData.interp = factor;
// userData.info = info;
// userData.fractionDigits = info.FractionDigits;
// mesh.AddText(parent, info.TextPrefab, parentTransform, info.FontSize, info.FontSharpness, toSet, textPos.x, textPos.y, AutoAxisDepth + info.TextDepth,0f, userData);
// }
// if (markDepth > 0)
// {
// if (orientation == ChartOrientation.Horizontal)
// {
// SetMeshUv(mesh, markDepth / totaluv, uvoffset);
// r = ChartCommon.FixRect(new Rect(start.x, AutoAxisDepth, size.x, markDepth));
// mesh.AddXZRect(r, group, start.y);
// }
// else
// {
// SetMeshUv(mesh, -markDepth / totaluv, uvoffset);
// r = ChartCommon.FixRect(new Rect(start.y, AutoAxisDepth, size.y, markDepth));
// mesh.AddYZRect(r, group, start.x);
// }
// uvoffset += Math.Abs(mesh.Length);
// if (backLength != 0)
// {
// SetMeshUv(mesh, backLength / totaluv, uvoffset);
// uvoffset += Math.Abs(mesh.Length);
// Vector2 backSize = halfThickness + backLength * lengthDirection;
// Rect backR = ChartCommon.FixRect(new Rect(start.x, start.y, backSize.x, backSize.y));
// mesh.AddXYRect(backR, group, AutoAxisDepth + markDepth);
// }
// }
// }
// }
/// <summary>
/// used internally to determine drawing direction of the each chart division
/// </summary>
/// <param name="parent"></param>
/// <param name="info"></param>
/// <param name="orientation"></param>
/// <param name="oppositeSide"></param>
/// <param name="startPosition"></param>
/// <param name="lengthDirection"></param>
/// <param name="advanceDirection"></param>
private void GetDirectionVectors(AnyChart parent, ChartDivisionInfo info, ChartOrientation orientation,float scrollOffset, bool oppositeSide, out DoubleVector3 startPosition, out DoubleVector3 lengthDirection, out DoubleVector3 advanceDirection)
{
if (orientation == ChartOrientation.Horizontal)
{
advanceDirection = new DoubleVector3(1f, 0f);
if (oppositeSide)
{
startPosition = new DoubleVector3(scrollOffset, ((IInternalUse)parent).InternalTotalHeight);
lengthDirection = new DoubleVector3(0f, -1f);
return;
}
startPosition = new DoubleVector3(0f, 0f);
lengthDirection = new DoubleVector3(0f, 1f);
return;
}
advanceDirection = new DoubleVector3(0f, 1f);
if (oppositeSide)
{
startPosition = new DoubleVector3(0f, 0f);
lengthDirection = new DoubleVector3(1f, 0f);
return;
}
startPosition = new DoubleVector3(((IInternalUse)parent).InternalTotalWidth, scrollOffset);
lengthDirection = new DoubleVector3(-1f, 0f);
}
internal void AddCustomDivisionsToChartMesh(double scrollOffset, AnyChart parent, Transform parentTransform, IChartMesh mesh, ChartOrientation orientation,bool isSub)
{
double maxValue = ((IInternalUse)parent).InternalMaxValue(this);
double minValue = ((IInternalUse)parent).InternalMinValue(this);
double range = maxValue - minValue;
if (isSub)
{
mesh.Tile = ChartCommon.GetTiling(SubDivisions.MaterialTiling);
if ((SubDivisions.Alignment & ChartDivisionAligment.Opposite) == ChartDivisionAligment.Opposite)
DrawCustomDivisions(scrollOffset, parent, parentTransform, SubDivisions, mesh, 0, orientation, false, true);
if ((SubDivisions.Alignment & ChartDivisionAligment.Standard) == ChartDivisionAligment.Standard)
DrawCustomDivisions(scrollOffset, parent, parentTransform, SubDivisions, mesh, 0, orientation, true, true);
}
else
{
mesh.Tile = ChartCommon.GetTiling(MainDivisions.MaterialTiling);
if ((MainDivisions.Alignment & ChartDivisionAligment.Opposite) == ChartDivisionAligment.Opposite)
DrawCustomDivisions(scrollOffset, parent, parentTransform, MainDivisions, mesh, 0, orientation, false, false);
if ((MainDivisions.Alignment & ChartDivisionAligment.Standard) == ChartDivisionAligment.Standard)
DrawCustomDivisions(scrollOffset, parent, parentTransform, MainDivisions, mesh, 0, orientation, true, false);
}
}
/// <summary>
/// used internally , adds the axis sub divisions to the chart mesh
/// </summary>
/// <param name="parent"></param>
/// <param name="parentTransform"></param>
/// <param name="mesh"></param>
/// <param name="orientation"></param>
internal void AddSubdivisionToChartMesh(double scrollOffset,AnyChart parent, Transform parentTransform, IChartMesh mesh, ChartOrientation orientation)
{
int total = SubDivisions.Total;
if (total <= 1) // no need for more
return;
double maxValue = ((IInternalUse)parent).InternalMaxValue(this);
double minValue = ((IInternalUse)parent).InternalMinValue(this);
double range = maxValue - minValue;
double? gap = GetMainGap(parent, range);
if (gap.HasValue == false)
return;
double subGap = gap.Value / (total);
mesh.Tile = ChartCommon.GetTiling(SubDivisions.MaterialTiling);
if ((SubDivisions.Alignment & ChartDivisionAligment.Opposite) == ChartDivisionAligment.Opposite)
DrawDivisions(scrollOffset,parent, parentTransform, SubDivisions, mesh, 0, orientation, subGap, false, gap.Value);
if ((SubDivisions.Alignment & ChartDivisionAligment.Standard) == ChartDivisionAligment.Standard)
DrawDivisions(scrollOffset,parent, parentTransform, SubDivisions, mesh, 0, orientation, subGap, true, gap.Value);
}
double? GetMainGap(AnyChart parent, double range)
{
double gap = ((ChartMainDivisionInfo)MainDivisions).UnitsPerDivision;
if (((ChartMainDivisionInfo)MainDivisions).Messure == ChartDivisionInfo.DivisionMessure.TotalDivisions)
{
int total = ((ChartMainDivisionInfo)MainDivisions).Total;
if (total <= 0)
return null;
gap = (range / (double)(total));
}
return gap;
}
/// <summary>
/// used internally , adds the axis main divisions to the chart mesh
/// </summary>
/// <param name="parent"></param>
/// <param name="parentTransform"></param>
/// <param name="mesh"></param>
/// <param name="orientation"></param>
internal void AddMainDivisionToChartMesh(double scrollOffset,AnyChart parent, Transform parentTransform, IChartMesh mesh, ChartOrientation orientation)
{
double maxValue = ((IInternalUse)parent).InternalMaxValue(this);
double minValue = ((IInternalUse)parent).InternalMinValue(this);
double range = maxValue - minValue;
double? gap = GetMainGap(parent, range);
if (gap.HasValue == false)
return;
mesh.Tile = ChartCommon.GetTiling(MainDivisions.MaterialTiling);
if ((MainDivisions.Alignment & ChartDivisionAligment.Opposite) == ChartDivisionAligment.Opposite)
DrawDivisions(scrollOffset,parent, parentTransform, MainDivisions, mesh, 0, orientation,gap.Value, false, -1);
if ((MainDivisions.Alignment & ChartDivisionAligment.Standard) == ChartDivisionAligment.Standard)
DrawDivisions(scrollOffset,parent, parentTransform, MainDivisions, mesh, 0, orientation, gap.Value, true, -1);
}
void ISerializationCallbackReceiver.OnBeforeSerialize()
{
}
void ISerializationCallbackReceiver.OnAfterDeserialize()
{
AddInnerItems();
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: ae8b4348f222b8246983af20f8444169
timeCreated: 1479124371
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,31 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ChartAndGraph
{
/// <summary>
/// Enumeration for the format of axis label data.
/// </summary>
public enum AxisFormat
{
/// <summary>
/// format the labels as floating point numbers
/// </summary>
Number,
/// <summary>
/// format the labels as time of day
/// </summary>
Time,
/// <summary>
/// format the labels as date only
/// </summary>
Date,
/// <summary>
/// format the labels as date and time
/// </summary>
DateTime,
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: a65b5ecb37567ff4f92e31c7b6438605
timeCreated: 1480864086
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,33 @@
#define Graph_And_Chart_PRO
using UnityEngine;
using System.Collections;
namespace ChartAndGraph.Axis
{
public partial class AxisGenerator : MonoBehaviour,IAxisGenerator
{
partial void InnerFixLabels(AnyChart parent);
partial void InnerSetAxis(double scrollOffset, AnyChart parent, AxisBase axis, ChartOrientation axisOrientation, int divType);
public void FixLabels(AnyChart parent)
{
InnerFixLabels(parent);
}
public void SetAxis(double scrollOffset, AnyChart parent, AxisBase axis, ChartOrientation axisOrientation, int divType)
{
InnerSetAxis(scrollOffset, parent, axis, axisOrientation, divType);
}
public UnityEngine.Object This()
{
return this;
}
public GameObject GetGameObject()
{
return gameObject;
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: d784632ef29d0444c8a7273ffbb24ab1
timeCreated: 1560543419
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,207 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace ChartAndGraph.Axis
{
/// <summary>
/// generates an axis mesh from an AxisBase settings instance.
/// </summary>
[RequireComponent(typeof(MeshRenderer))]
[RequireComponent(typeof(MeshFilter))]
[ExecuteInEditMode]
partial class AxisGenerator
{
MeshRenderer mRenderer;
MeshFilter mFilter;
Mesh mCleanMesh;
List<BillboardText> mTexts;
AxisBase mAxis;
Material mDispose;
Material mMaterial;
float mTiling=1f;
WorldSpaceChartMesh mMesh;
Mesh mCreated;
double mScroll = 0f;
AnyChart mParent = null;
ChartOrientation mOrientation = ChartOrientation.Vertical;
int mDivType = 0;
void Start()
{
}
void OnDestroy()
{
ChartCommon.CleanMesh(null, ref mCleanMesh);
ChartCommon.SafeDestroy(mDispose);
}
/// <summary>
/// fix the labels after the axis data is updated
/// </summary>
/// <param name="parent"></param>
partial void InnerFixLabels(AnyChart parent)
{
if (mAxis == null)
return;
if((((ChartMainDivisionInfo) mAxis.MainDivisions).Messure == ChartDivisionInfo.DivisionMessure.DataUnits) || (mDivType == 2))
{
SetAxis(mScroll, mParent, mAxis, mOrientation, mDivType);
return;
}
for(int i=0; i<mTexts.Count; i++)
{
BillboardText text = mTexts[i];
double min = ((IInternalUse)parent).InternalMinValue(mAxis);
double max = ((IInternalUse)parent).InternalMaxValue(mAxis);
if (text.UserData is AxisBase.TextData)
{
AxisBase.TextData data = (AxisBase.TextData)text.UserData;
double newVal = min * (1.0 - (double)data.interp) + max * (double)data.interp;
string toSet = "";
if (mAxis.Format == AxisFormat.Number)
toSet = ChartAdancedSettings.Instance.FormatFractionDigits(data.fractionDigits, (float)newVal,parent.CustomNumberFormat);
else
{
DateTime date = ChartDateUtility.ValueToDate(newVal);
if (mAxis.Format == AxisFormat.DateTime)
toSet = ChartDateUtility.DateToDateTimeString(date,mParent.CustomDateTimeFormat);
else
{
if (mAxis.Format == AxisFormat.Date)
toSet = ChartDateUtility.DateToDateString(date);
else
toSet = ChartDateUtility.DateToTimeString(date);
}
}
toSet = data.info.TextPrefix + toSet + data.info.TextSuffix;
ChartCommon.UpdateTextParams(text.UIText, toSet);
}
}
}
/// <summary>
/// used internally to get the tiling for a chart axis division
/// </summary>
/// <param name="parent"></param>
/// <param name="orientation"></param>
/// <param name="inf"></param>
/// <returns></returns>
float GetTiling(AnyChart parent, ChartOrientation orientation, ChartDivisionInfo inf)
{
MaterialTiling tiling = inf.MaterialTiling;
if (tiling.EnableTiling == false || tiling.TileFactor <= 0f)
return 1f;
float length = Math.Abs(ChartCommon.GetAutoLength(parent, orientation, inf));
float backLength = ChartCommon.GetAutoLength(parent, orientation);
float depth = ChartCommon.GetAutoDepth(parent, orientation, inf);
if (inf.MarkBackLength.Automatic == false)
backLength = inf.MarkBackLength.Value;
if (backLength != 0 && depth > 0)
length += Math.Abs(backLength) + Math.Abs(depth);
return length / tiling.TileFactor;
}
/// <summary>
/// sets the axis settings. Calling this method will cause the axisgenerator to create the axis mesh
/// </summary>
/// <param name="parent"></param>
/// <param name="axis"></param>
/// <param name="axisOrientation"></param>
/// <param name="isSubDivisions"></param>
partial void InnerSetAxis(double scrollOffset, AnyChart parent, AxisBase axis, ChartOrientation axisOrientation, int divType)
{
mScroll = scrollOffset;
mParent = parent;
mAxis = axis;
mOrientation = axisOrientation;
mDivType = divType;
if (mMesh == null)
{
mMesh = new WorldSpaceChartMesh(2);
mMesh.RecycleText = true;
}
mMesh.Clear();
mMesh.Orientation = axisOrientation;
mAxis = axis;
switch(divType)
{
case 0:
axis.AddMainDivisionToChartMesh(scrollOffset, parent, transform, mMesh, axisOrientation);
break;
case 1:
axis.AddSubdivisionToChartMesh(scrollOffset, parent, transform, mMesh, axisOrientation);
break;
case 2:
axis.AddCustomDivisionsToChartMesh(scrollOffset, parent, transform, mMesh, axisOrientation,false);
break;
case 3:
axis.AddCustomDivisionsToChartMesh(scrollOffset, parent, transform, mMesh, axisOrientation,true);
break;
}
if (mMesh.TextObjects != null)
{
foreach (BillboardText text in mMesh.TextObjects)
{
((IInternalUse)parent).InternalTextController.AddText(text);
}
}
mTexts = mMesh.CurrentTextObjects;
Mesh newMesh = mMesh.Generate(mCreated);
mCreated = newMesh;
newMesh.hideFlags = HideFlags.DontSave;
if (mFilter == null)
mFilter = GetComponent<MeshFilter>();
mFilter.sharedMesh = newMesh;
MeshCollider collider = GetComponent<MeshCollider>();
if (collider != null)
collider.sharedMesh = newMesh;
ChartCommon.CleanMesh(newMesh, ref mCleanMesh);
MeshRenderer renderer = GetComponent<MeshRenderer>();
if(renderer != null)
{
Material m = mAxis.MainDivisions.Material;
float tiling = GetTiling(parent, axisOrientation, mAxis.MainDivisions);
if (divType == 1)
{
m = mAxis.SubDivisions.Material;
tiling = GetTiling(parent, axisOrientation, mAxis.SubDivisions) ;
}
mMaterial = m;
if (m != null)
{
ChartCommon.SafeDestroy(mDispose);
mDispose = new Material(m);
mDispose.hideFlags = HideFlags.DontSave;
renderer.sharedMaterial = mDispose;
mTiling = tiling;
if (mDispose.HasProperty("_ChartTiling"))
mDispose.SetFloat("_ChartTiling", mTiling);
}
}
mMesh.DestoryRecycled();
}
protected virtual void Update()
{
if (mMaterial != null && mDispose != null && mDispose.HasProperty("_ChartTiling"))
{
if (mDispose != mMaterial)
mDispose.CopyPropertiesFromMaterial(mMaterial);
mDispose.SetFloat("_ChartTiling", mTiling);
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 2bfad3f1e4ea9a644bbd41612e6342ef
timeCreated: 1472984373
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,249 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.UI;
namespace ChartAndGraph.Axis
{
/// <summary>
/// Generates an axis mesh for a canvas chart
/// </summary>
[RequireComponent(typeof(CanvasRenderer))]
[ExecuteInEditMode]
class CanvasAxisGenerator : Image, IAxisGenerator
{
MeshRenderer mRenderer;
MeshFilter mFilter;
Mesh mCleanMesh;
List<BillboardText> mTexts;
AxisBase mAxis;
AnyChart mParent;
ChartOrientation mOrientation;
int mDivType = 0;
Material mDispose = null;
Material mMaterial;
CanvasChartMesh mMesh = null;
float mTiling = 1f;
double mScrollOffset;
#if (!UNITY_5_2_0) && (!UNITY_5_2_1)
protected override void OnPopulateMesh(VertexHelper vh)
{
base.OnPopulateMesh(vh);
vh.Clear();
if (mAxis == null || mParent == null)
return;
CanvasChartMesh mesh = new CanvasChartMesh(vh);
AddToCanvasChartMesh(mesh);
}
#endif
private void AddToCanvasChartMesh(CanvasChartMesh mesh)
{
mesh.Orientation = mOrientation;
switch(mDivType)
{
case 0:
mAxis.AddSubdivisionToChartMesh(mScrollOffset, mParent, transform, mesh, mOrientation);
break;
case 1:
mAxis.AddMainDivisionToChartMesh(mScrollOffset, mParent, transform, mesh, mOrientation);
break;
case 2:
mAxis.AddCustomDivisionsToChartMesh(mScrollOffset, mParent, transform, mesh, mOrientation,false);
break;
case 3:
mAxis.AddCustomDivisionsToChartMesh(mScrollOffset, mParent, transform, mesh, mOrientation,true);
break;
}
}
//#pragma warning disable 0672
// protected override void OnPopulateMesh(Mesh m)
// {
// m.Clear();
// if (mAxis == null || mParent == null)
// return;
// WorldSpaceChartMesh mesh = new WorldSpaceChartMesh(true);
// mesh.Orientation = mOrientation;
// if(mDivType)
// mAxis.AddMainDivisionToChartMesh(mScrollOffset,mParent, transform, mesh, mOrientation);
// else
// mAxis.AddSubdivisionToChartMesh(mScrollOffset,mParent, transform, mesh, mOrientation);
// mesh.ApplyToMesh(m);
// }
//#pragma warning restore 0672
public void FixLabels(AnyChart parent)
{
if (mAxis == null)
return;
if (((ChartMainDivisionInfo)mAxis.MainDivisions).Messure == ChartDivisionInfo.DivisionMessure.DataUnits)
{
SetAxis(mScrollOffset, mParent, mAxis, mOrientation, mDivType);
return;
}
for (int i = 0; i < mTexts.Count; i++)
{
BillboardText text = mTexts[i];
double min = ((IInternalUse)parent).InternalMinValue(mAxis);
double max = ((IInternalUse)parent).InternalMaxValue(mAxis);
if (text.UserData is AxisBase.TextData)
{
AxisBase.TextData data = (AxisBase.TextData)text.UserData;
double newVal = min * (1.0 - (double)data.interp) + max * (double)data.interp;
string toSet = "";
if (mAxis.Format == AxisFormat.Number)
toSet = ChartAdancedSettings.Instance.FormatFractionDigits(data.fractionDigits, (float)newVal,parent.CustomNumberFormat);
else
{
DateTime date = ChartDateUtility.ValueToDate(newVal);
if (mAxis.Format == AxisFormat.DateTime)
toSet = ChartDateUtility.DateToDateTimeString(date,parent.CustomDateTimeFormat);
else
{
if (mAxis.Format == AxisFormat.Date)
toSet = ChartDateUtility.DateToDateString(date);
else
toSet = ChartDateUtility.DateToTimeString(date);
}
}
toSet = data.info.TextPrefix + toSet + data.info.TextSuffix;
ChartCommon.UpdateTextParams(text.UIText, toSet);
}
}
}
protected override void UpdateMaterial()
{
base.UpdateMaterial();
if (material == null)
return;
if (material.mainTexture != null)
canvasRenderer.SetTexture(material.mainTexture);
canvasRenderer.SetColor(Color.white);
}
protected override void OnDestroy()
{
base.OnDestroy();
if (mDispose != null)
ChartCommon.SafeDestroy(mDispose);
}
float GetTiling(MaterialTiling tiling)
{
if (tiling.EnableTiling == false || tiling.TileFactor <= 0f)
return 1f;
ChartDivisionInfo inf = mAxis.MainDivisions;
if (mDivType == 1)
inf = mAxis.SubDivisions;
float length = ChartCommon.GetAutoLength(mParent, mOrientation, inf);
return length / tiling.TileFactor;
}
public void SetAxis(double scrollOffset,AnyChart parent, AxisBase axis, ChartOrientation axisOrientation,int divType)
{
mScrollOffset = scrollOffset;
raycastTarget = false;
color = Color.white;
mAxis = axis;
mParent = parent;
mDivType = divType;
mOrientation = axisOrientation;
if (mMesh == null)
{
mMesh = new CanvasChartMesh(true);
mMesh.RecycleText = true;
}
mMesh.Clear();
switch (mDivType)
{
case 0:
mAxis.AddSubdivisionToChartMesh(mScrollOffset, mParent, transform, mMesh, mOrientation);
break;
case 1:
mAxis.AddMainDivisionToChartMesh(mScrollOffset, mParent, transform, mMesh, mOrientation);
break;
case 2:
mAxis.AddCustomDivisionsToChartMesh(mScrollOffset, mParent, transform, mMesh, mOrientation,false);
break;
case 3:
mAxis.AddCustomDivisionsToChartMesh(mScrollOffset, mParent, transform, mMesh, mOrientation, true);
break;
}
mTexts = mMesh.CurrentTextObjects;
if (mMesh.TextObjects != null)
{
foreach (BillboardText text in mMesh.TextObjects)
{
((IInternalUse)parent).InternalTextController.AddText(text);
}
}
canvasRenderer.materialCount = 1;
if (mDispose != null)
ChartCommon.SafeDestroy(mDispose);
float tiling = 1f;
if (divType != 1)
{
if (axis.SubDivisions.Material != null)
{
mMaterial = axis.SubDivisions.Material;
mDispose = new Material(mMaterial);
mDispose.hideFlags = HideFlags.DontSave;
material = mDispose;
tiling = GetTiling(axis.SubDivisions.MaterialTiling);
}
}
else
{
if (axis.MainDivisions.Material != null)
{
mMaterial = axis.MainDivisions.Material;
mDispose = new Material(mMaterial);
mDispose.hideFlags = HideFlags.DontSave;
material = mDispose;
tiling = GetTiling(axis.MainDivisions.MaterialTiling);
}
}
mTiling = tiling;
if(mDispose != null)
{
if (mDispose.HasProperty("_ChartTiling"))
mDispose.SetFloat("_ChartTiling", tiling);
}
SetAllDirty();
Rebuild(CanvasUpdate.PreRender);
mMesh.DestoryRecycled();
}
protected virtual void Update()
{
if (mMaterial != null && mDispose != null && mDispose.HasProperty("_ChartTiling"))
{
if (mDispose != mMaterial)
mDispose.CopyPropertiesFromMaterial(mMaterial);
mDispose.SetFloat("_ChartTiling", mTiling);
}
}
public GameObject GetGameObject()
{
return gameObject;
}
public UnityEngine.Object This()
{
return this;
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 7d05bb511ff55104f930cb9d1c27c8d7
timeCreated: 1478793256
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,423 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.UI;
namespace ChartAndGraph
{
/// <summary>
/// holds settings for an axis division.
/// </summary>
[Serializable]
public class ChartDivisionInfo : IInternalSettings
{
public enum DivisionMessure
{
TotalDivisions,
DataUnits
}
/// <summary>
/// validates all properties of this instance. (check if they have correct values)
/// </summary>
public void ValidateProperites()
{
if (total < 0)
total = 0;
fontSharpness = Mathf.Clamp(fontSharpness, 1f, 3f);
fontSize = Mathf.Max(fontSize, 0);
fractionDigits = Mathf.Clamp(fractionDigits, 0, 7);
markThickness = Mathf.Max(markThickness, 0f);
materialTiling.TileFactor = Mathf.Max(materialTiling.TileFactor, 0f);
textPrefix = (textPrefix == null) ? "" : textPrefix;
textSuffix = (textSuffix == null) ? "" : textSuffix;
}
protected virtual float ValidateTotal(float total)
{
return total;
}
/// <summary>
/// total division lines
/// </summary>
[SerializeField]
[Canvas, NonCanvas]
[Tooltip("messure used to create divisions")]
protected DivisionMessure messure = DivisionMessure.TotalDivisions;
/// <summary>
/// data units per each division in the chart
/// </summary>
[SerializeField]
[Canvas, NonCanvas]
[Tooltip("data units per division")]
protected float unitsPerDivision;
/// <summary>
/// total division lines
/// </summary>
[SerializeField]
[Canvas, NonCanvas]
[Tooltip("total division lines")]
private int total = 3;
/// <summary>
/// total division lines
/// </summary>
public int Total
{
get { return total; }
set
{
total = value;
RaiseOnChanged();
}
}
/// <summary>
/// Material for the line of the division
/// </summary>
[SerializeField]
[Canvas, NonCanvas]
[Tooltip("Material for the line of the division")]
private Material material;
/// <summary>
/// Material for the division lines
/// </summary>
public Material Material
{
get { return material; }
set
{
material = value;
RaiseOnChanged();
}
}
/// <summary>
/// Material tiling for the division lines. Use this to strech or tile the material along the line
/// </summary>
[SerializeField]
[Canvas, NonCanvas]
[Tooltip("Material tiling for the division lines. Use this to strech or tile the material along the line")]
private MaterialTiling materialTiling = new MaterialTiling(false, 100f);
/// <summary>
/// Material tiling for the division lines. Use this to strech or tile the material along the line
/// </summary>
public MaterialTiling MaterialTiling
{
get {return materialTiling;}
set
{
materialTiling = value;
RaiseOnChanged();
}
}
/// <summary>
/// The length of the far side of the division lines. This is used only by 3d chart when MarkDepth >0
/// </summary>
[SerializeField]
[Simple, NonCanvas]
[Tooltip("The length of the far side of the division lines. This is used only by 3d chart when MarkDepth >0")]
private AutoFloat markBackLength = new AutoFloat(true, 0.5f);
/// <summary>
/// The length of the far side of the division lines. This is used only by 3d charts when MarkDepth >0
/// </summary>
public AutoFloat MarkBackLength
{
get { return markBackLength; }
set
{
markBackLength = value;
RaiseOnChanged();
}
}
/// <summary>
/// The length of the the division lines.
/// </summary>
[SerializeField]
[Simple, Canvas, NonCanvas]
[Tooltip("The length of the the division lines.")]
private AutoFloat markLength = new AutoFloat(true,0.5f);
/// <summary>
/// The length of the the division lines.
/// </summary>
public AutoFloat MarkLength
{
get { return markLength; }
set
{
markLength = value;
RaiseOnChanged();
}
}
/// <summary>
/// the depth of the division line. This is used by 3d charts only
/// </summary>
[SerializeField]
[Simple, NonCanvas]
private AutoFloat markDepth = new AutoFloat(true,0.5f);
public AutoFloat MarkDepth
{
get { return markDepth; }
set
{
markDepth = value;
RaiseOnChanged();
}
}
/// <summary>
/// the thickness of the division lines
/// </summary>
[SerializeField]
[Simple, Canvas, NonCanvas]
[Tooltip("the thickness of the division lines")]
private float markThickness = 0.1f;
/// <summary>
/// the thickness of the division lines
/// </summary>
public float MarkThickness
{
get { return markThickness; }
set
{
markThickness = value;
RaiseOnChanged();
}
}
/// <summary>
/// A prefab for the division labels
/// </summary>
[SerializeField]
[Simple,Canvas, NonCanvas]
[Tooltip("A prefab for the division labels")]
private MonoBehaviour textPrefab;
/// <summary>
/// A prefab for the division labels
/// </summary>
public MonoBehaviour TextPrefab
{
get { return textPrefab; }
set
{
textPrefab = value;
RaiseOnChanged();
}
}
/// <summary>
/// prefix for the axis labels
/// </summary>
[SerializeField]
[Simple,Canvas,NonCanvas]
[Tooltip("prefix for the axis labels")]
private string textPrefix;
/// <summary>
/// prefix for the axis labels
/// </summary>
public string TextPrefix
{
get { return textPrefix; }
set
{
textPrefix = value;
RaiseOnChanged();
}
}
/// <summary>
/// suffix for the axis labels
/// </summary>
[SerializeField]
[Simple, Canvas, NonCanvas]
[Tooltip("suffix for the axis labels")]
private string textSuffix;
/// <summary>
/// suffix for the axis labels
/// </summary>
public string TextSuffix
{
get { return textSuffix; }
set
{
textSuffix = value;
RaiseOnChanged();
}
}
/// <summary>
/// the number of fraction digits in the division labels.
/// </summary>
[Range(0,7)]
[Simple, Canvas, NonCanvas]
[SerializeField]
[Tooltip("the number of fraction digits in text labels")]
private int fractionDigits = 2;
/// <summary>
/// the number of fraction digits in text labels.
/// </summary>
public int FractionDigits
{
get { return fractionDigits; }
set
{
fractionDigits = value;
RaiseOnChanged();
}
}
/// <summary>
/// Label font size
/// </summary>
[Simple,Canvas, NonCanvas]
[SerializeField]
[Tooltip("Label font size")]
private int fontSize = 12;
/// <summary>
/// Label font size
/// </summary>
public int FontSize
{
get { return fontSize; }
set
{
fontSize = value;
RaiseOnChanged();
}
}
/// <summary>
/// makes the labels sharper if they are blurry
/// </summary>
[Range(1f,3f)]
[Simple, Canvas, NonCanvas]
[Tooltip("makes the labels sharper if they are blurry")]
[SerializeField]
private float fontSharpness = 1f;
/// <summary>
/// makes the labels sharper if they are blurry
/// </summary>
public float FontSharpness
{
get { return fontSharpness; }
set
{
fontSharpness = value;
RaiseOnChanged();
}
}
/// <summary>
/// depth seperation the division lables. used by 3d charts only
/// </summary>
[Simple, NonCanvas]
[SerializeField]
[Tooltip("depth seperation the division lables")]
private float textDepth;
/// <summary>
/// depth seperation the division lables.used by 3d charts only
/// </summary>
public float TextDepth
{
get { return textDepth; }
set
{
textDepth = value;
RaiseOnChanged();
}
}
/// <summary>
/// breadth seperation for the division labels
/// </summary>
[Simple, Canvas,NonCanvas]
[SerializeField]
[Tooltip("breadth seperation for the division labels")]
private float textSeperation;
/// <summary>
/// breadth seperation for the division labels
/// </summary>
public float TextSeperation
{
get { return textSeperation; }
set
{
textSeperation = value;
RaiseOnChanged();
}
}
/// <summary>
/// Alignment of the division lables
/// </summary>
[Simple, Canvas, NonCanvas]
[SerializeField]
[Tooltip("Alignment of the division lables")]
private ChartDivisionAligment alignment = ChartDivisionAligment.Standard;
/// <summary>
/// Alignment of the division lables
/// </summary>
public ChartDivisionAligment Alignment
{
get { return alignment; }
set
{
alignment = value;
RaiseOnChanged();
}
}
#pragma warning disable 0067
private event EventHandler OnDataUpdate;
#pragma warning restore 0067
private event EventHandler OnDataChanged;
protected virtual void RaiseOnChanged()
{
if (OnDataChanged != null)
OnDataChanged(this, EventArgs.Empty);
}
#region Intenal Use
event EventHandler IInternalSettings.InternalOnDataUpdate
{
add
{
OnDataUpdate += value;
}
remove
{
OnDataUpdate -= value;
}
}
event EventHandler IInternalSettings.InternalOnDataChanged
{
add
{
OnDataChanged += value;
}
remove
{
OnDataChanged -= value;
}
}
#endregion
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 359f85bed13b139458429a9181677dc1
timeCreated: 1478832101
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,34 @@
#define Graph_And_Chart_PRO
using ChartAndGraph;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ChartAndGraph
{
[Serializable]
public class ChartMainDivisionInfo : ChartDivisionInfo
{
public DivisionMessure Messure
{
get { return messure; }
set
{
messure = value;
RaiseOnChanged();
}
}
public float UnitsPerDivision
{
get { return unitsPerDivision; }
set
{
unitsPerDivision = value;
RaiseOnChanged();
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 9deba227f79698e41bdd30467581bec3
timeCreated: 1497092384
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,21 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace ChartAndGraph
{
/// <summary>
/// holds settings for an axis division.
/// </summary>
[Serializable]
class ChartSubDivisionInfo : ChartDivisionInfo
{
protected override float ValidateTotal(float total)
{
return Mathf.Round(total);
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 7b560179d771be94991a4686a1e7fc94
timeCreated: 1496763003
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,34 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ChartAndGraph
{
/// <summary>
/// defines a horizontal axis for the chart componenet attached to the same object
/// </summary>
public class HorizontalAxis : AxisBase
{
protected override Action<IInternalUse, bool> Assign
{
get
{
return (x, clear) =>
{
if (clear)
{
if (x.HorizontalAxis == this)
x.HorizontalAxis = null;
}
else
{
if (x.HorizontalAxis != this)
x.HorizontalAxis = this;
}
};
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 08395b16192f9114e8ad4953e48f90bd
timeCreated: 1479132481
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,20 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace ChartAndGraph.Axis
{
/// <summary>
/// Axis generator functionallity that is not dependant on the diminetion of the chart
/// </summary>
public interface IAxisGenerator
{
UnityEngine.Object This();
GameObject GetGameObject();
void FixLabels(AnyChart parent);
void SetAxis(double scrollOffset,AnyChart parent, AxisBase axis, ChartOrientation axisOrientation, int divType);
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: be5483351106eff4e872930ec406b3ea
timeCreated: 1478793461
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,34 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ChartAndGraph
{
/// <summary>
/// defines a vertical axis for the chart componenet attached to the same object
/// </summary>
public class VerticalAxis : AxisBase
{
protected override Action<IInternalUse, bool> Assign
{
get
{
return (x, clear) =>
{
if (clear)
{
if (x.VerticalAxis == this)
x.VerticalAxis = null;
}
else
{
if (x.VerticalAxis != this)
x.VerticalAxis = this;
}
};
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 7598682dc3bb9174d9546fe226cab95a
timeCreated: 1479132481
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,13 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ChartAndGraph
{
public abstract class AxisChart : AnyChart
{
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: a0d908c90a583d74a8aeb06991f84a58
timeCreated: 1480253096
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: d75b86172e1e709448c4be48ed625af7
folderAsset: yes
timeCreated: 1560535493
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,30 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ChartAndGraph
{
public partial class BarChart
{
partial void StackedStage1(ref float elevation, double prevIntep)
{
if (Stacked)
elevation = (float)prevIntep * HeightRatio;
}
partial void StackedStage2(ref double prevIntep, double interp)
{
if (Stacked)
prevIntep = interp;
}
partial void StackedStage3(ref double interp, double amount, double min, double total)
{
if (Stacked)
{
interp = (amount - min) / total;
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 95fd0ed42f0ce34459cd9abe796dbbce
timeCreated: 1560592679
licenseType: Store
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,12 @@
fileFormatVersion: 2
guid: 5bcc7a36d1f7adf46a882749324dca81
timeCreated: 1472816162
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,56 @@
#define Graph_And_Chart_PRO
using UnityEngine;
using System.Collections;
using ChartAndGraph;
[RequireComponent(typeof(RectTransform))]
[RequireComponent(typeof(CanvasBarChart))]
public class BarContentFiller : MonoBehaviour
{
public float FixedAxisMarign = 40f;
public float FixedGroupSpacing = 25f;
public float FixedBarSeperation = 10f;
// Use this for initialization
void Start()
{
}
void OnValidate()
{
var bar = GetComponent<BarChart>();
bar.Invalidate();
}
public virtual void Match()
{
var rect = GetComponent<RectTransform>();
var totalWidth = rect.rect.width;
var bar = GetComponent<CanvasBarChart>();
bool Stacked = bar.ViewType == BarChart.BarType.Stacked;
int columnCount = bar.DataSource.TotalCategories;
int rowCount = bar.DataSource.TotalGroups;
int rowLimit = rowCount - 1;
double groupSize = (totalWidth - FixedAxisMarign * 2 - FixedGroupSpacing * rowLimit) / rowCount;
double groupSeperation = groupSize + FixedGroupSpacing;
double barSize = (groupSize - FixedBarSeperation * (columnCount - 1)) / columnCount;
if (Stacked)
barSize = groupSize;
bar.AxisSeperation = FixedAxisMarign;
if (Stacked)
bar.BarSeperation = 0;
else
bar.BarSeperation = FixedBarSeperation + (float)barSize;
bar.GroupSeperation = (float)groupSeperation;
bar.BarSize = (float)barSize;// (float)(RatioBarSize * factor);
}
// Update is called once per frame
void Update()
{
}
}

View File

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

View File

@@ -0,0 +1,54 @@
#define Graph_And_Chart_PRO
using UnityEngine;
using System.Collections;
using ChartAndGraph;
[RequireComponent(typeof(RectTransform))]
[RequireComponent(typeof(CanvasBarChart))]
public class BarContentFitter : MonoBehaviour
{
public float RatioAxisMarign = 1f;
public float FixedBarSize = 30f;
public float RatioGroupSeperation = 5f;
public float RatioBarSeperation = 2f;
// Use this for initialization
void Start()
{
}
void OnValidate()
{
var bar = GetComponent<BarChart>();
bar.Invalidate();
}
public virtual void Match()
{
var rect = GetComponent<RectTransform>();
var totalWidth = rect.rect.width;
var bar = GetComponent<CanvasBarChart>();
int columnCount = bar.DataSource.TotalCategories;
int rowCount = bar.DataSource.TotalGroups;
int rowLimit = rowCount - 1;
double barGroupSeprationSize = RatioBarSeperation * (columnCount - 1);
double barGroupSize = barGroupSeprationSize;// + RatioBarSize;
double totalSize = RatioGroupSeperation * rowLimit;
double baseSize = totalSize + 2* RatioAxisMarign + barGroupSize;
double factor = totalWidth / baseSize;
bar.HeightRatio = rect.rect.height;
bar.AxisSeperation = (float)(RatioAxisMarign * factor);
bar.BarSeperation = (float)(RatioBarSeperation * factor);
bar.GroupSeperation = (float)(RatioGroupSeperation * factor);
bar.BarSize = FixedBarSize;// (float)(RatioBarSize * factor);
}
// Update is called once per frame
void Update()
{
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 9cd0887944b07804e8103d5070b1cf3b
timeCreated: 1579111521
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,589 @@
#define Graph_And_Chart_PRO
using System;
using ChartAndGraph.DataSource;
using UnityEngine;
using System.Collections.Generic;
using ChartAndGraph.Exceptions;
using System.Linq;
namespace ChartAndGraph
{
/// <summary>
/// data source for bar charts
/// </summary>
[Serializable]
public class BarData : AbstractChartData,IInternalBarData, IChartData
{
[Serializable]
class CategoryData
{
public string Name;
public ChartDynamicMaterial Materials;
}
[Serializable]
class DataEntry
{
public string GroupName;
public string ColumnName;
public double Amount;
}
private ChartSparseDataSource mDataSource = new ChartSparseDataSource();
ChartSparseDataSource IInternalBarData.InternalDataSource { get { return mDataSource; } }
[SerializeField]
private CategoryData[] mCategories = new CategoryData[0];
[SerializeField]
private string[] mGroups = new string[0];
[SerializeField]
private DataEntry[] mData = new DataEntry[0];
public event Action ProperyUpdated;
protected void RaisePropertyUpdated()
{
if (ProperyUpdated != null)
ProperyUpdated();
}
/// <summary>
/// the number of categories in the data source
/// </summary>
public int TotalCategories { get { return mDataSource.Columns.Count; } }
/// <summary>
/// the number of groups in the data source
/// </summary>
public int TotalGroups { get { return mDataSource.Rows.Count; } }
/// <summary>
/// set this to true to automatically detect the highest bar value int the chart. This value will be used to scale all other bars
/// </summary>
[SerializeField]
private bool automaticMaxValue = true;
public void Update()
{
}
/// <summary>
/// renames a category. throw an exception on error
/// </summary>
/// <param name="prevName"></param>
/// <param name="newName"></param>
public void RenameCategory(string prevName,string newName)
{
mDataSource.Columns[prevName].Name = newName;
RaisePropertyUpdated();
}
/// <summary>
/// renames a group. throw an exception on error
/// </summary>
/// <param name="prevName"></param>
/// <param name="newName"></param>
public void RenameGroup(string prevName,string newName)
{
mDataSource.Rows[prevName].Name = newName;
RaisePropertyUpdated();
}
/// <summary>
/// set this to true to automatically detect the highest bar value int the chart. This value will be used to scale all other bars
/// </summary>
public bool AutomaticMaxValue
{
get { return automaticMaxValue; }
set
{
automaticMaxValue = value;
RaisePropertyUpdated();
}
}
/// <summary>
/// Mannualy set the maximum value , all bars will be scaled based on this value. If a bar value is larger than this value it will be clamped
/// Note: set AutomaticMaxValue to false in order to use this field
/// </summary>
[SerializeField]
private double maxValue = 10;
/// <summary>
/// Mannualy set the maximum value , all bars will be scaled based on this value. If a bar value is larger than this value it will be clamped
/// Note: set AutomaticMaxValue to false in order to use this field
/// </summary>
public double MaxValue
{
get { return maxValue; }
set
{
maxValue = value;
RaisePropertyUpdated();
}
}
public bool HasGroup(string groupName)
{
try
{
var row = mDataSource.Rows[groupName];
if (row != null)
return true;
}
catch
{
}
return false;
}
public bool HasCategory(string category)
{
try
{
var col = mDataSource.Columns[category];
if (col != null)
return true;
}
catch
{
}
return false;
}
/// <summary>
/// set this to true to automatically detect the lowest bar value int the chart. This value will be used to scale all other bars
/// </summary>
[SerializeField]
private bool automaticMinValue = false;
/// <summary>
/// set this to true to automatically detect the lowest bar value int the chart. This value will be used to scale all other bars
/// </summary>
public bool AutomaticMinValue
{
get { return automaticMinValue; }
set
{
automaticMinValue = value;
RaisePropertyUpdated();
}
}
/// <summary>
/// Mannualy set the minimum value , all bars will be scaled based on this value. If a bar value is larger than this value it will be clamped
/// Note: set AutomaticMinValue to false in order to use this field
/// </summary>
[SerializeField]
private double minValue = 0;
/// <summary>
/// Mannualy set the minimum value , all bars will be scaled based on this value. If a bar value is larger than this value it will be clamped
/// Note: set AutomaticMinValue to false in order to use this field
/// </summary>
public double MinValue
{
get { return minValue; }
set
{
minValue = value;
RaisePropertyUpdated();
}
}
void IInternalBarData.Update()
{
UpdateSliders();
}
/// <summary>
/// call this to suspend chart redrawing while updating the data of the chart
/// </summary>
public void StartBatch()
{
mDataSource.SuspendEvents = true;
}
/// <summary>
/// call this after StartBatch , this will apply all the changed made between the StartBatch call to this call
/// </summary>
public void EndBatch()
{
mDataSource.SuspendEvents = false;
}
public double GetMinValue()
{
double min = MinValue;
double? rawMin = mDataSource.getRawMinValue();
if (AutomaticMinValue && rawMin.HasValue)
min = rawMin.Value;
return min;
}
public double GetMaxValue()
{
double max = MaxValue;
double? rawMax = mDataSource.getRawMaxValue();
if (AutomaticMaxValue && rawMax.HasValue)
max = rawMax.Value;
return max;
}
public string GetCategoryName(int index)
{
return mDataSource.Columns[index].Name;
}
public string GetGroupName(int index)
{
return mDataSource.Rows[index].Name;
}
/// <summary>
/// used intenally , do not call
/// </summary>
/// <param name="cats"></param>
public object[] StoreAllCategoriesinOrder()
{
return mCategories.ToArray();
}
public void OnBeforeSerialize()
{
int totalColumns = mDataSource.Columns.Count;
mCategories = new CategoryData[totalColumns];
for (int i = 0; i < totalColumns; i++)
{
CategoryData data = new CategoryData();
data.Name = mDataSource.Columns[i].Name;
data.Materials = mDataSource.Columns[i].Material;
mCategories[i] = data;
}
int totalRows = mDataSource.Rows.Count;
mGroups = new string[totalRows];
for(int i=0; i< totalRows; i++)
mGroups[i] = mDataSource.Rows[i].Name;
double[,] raw = mDataSource.getRawData();
int current = 0;
mData = new DataEntry[raw.GetLength(0) * raw.GetLength(1)];
for (int i = 0; i < raw.GetLength(0); ++i)
{
for (int j = 0; j < raw.GetLength(1); ++j)
{
DataEntry entry = new DataEntry();
entry.ColumnName = mDataSource.Columns[j].Name;
entry.GroupName = mDataSource.Rows[i].Name;
entry.Amount = raw[i, j];
mData[current++] = entry;
}
}
}
public void OnAfterDeserialize()
{
mDataSource = new ChartSparseDataSource();
mDataSource.SuspendEvents = true;
mDataSource.Clear();
if (mCategories == null)
mCategories = new CategoryData[0];
if (mGroups == null)
mGroups = new string[0];
if (mData == null)
mData = new DataEntry[0];
for (int i = 0; i < mCategories.Length; i++)
{
AddCategory(mCategories[i].Name, mCategories[i].Materials);
}
for (int i = 0; i < mGroups.Length; i++)
AddGroup(mGroups[i]);
for(int i=0; i< mData.Length; i++)
{
try
{
DataEntry entry = mData[i];
mDataSource.SetValue(entry.ColumnName, entry.GroupName, entry.Amount);
}
catch(Exception)
{
}
}
mDataSource.SuspendEvents = false;
}
/// <summary>
/// Adds a new category to the bar chart. Each category has it's own material and name.
/// Note: you must also have at least one group on the bar chart
/// Example: you can set the categories to "Player 1","Player 2","Player 3" and the groups to "Gold","Wood","Oil","Total"
/// in order to compare the resources the players have gather during a level
/// </summary>
/// <param name="name">the name of the category</param>
/// <param name="material">the material of the category</param>
public void AddCategory(string name, Material material)
{
AddCategory(name, new ChartDynamicMaterial(material));
}
/// <summary>
/// clears all groups in the bar chart
/// </summary>
public void ClearGroups()
{
string[] groups = mDataSource.Rows.Select(x => x.Name).ToArray();
foreach(string s in groups)
{
RemoveGroup(s);
}
}
/// <summary>
/// sets all values to the value parameted
/// </summary>
public void ClearValues(double value = 0.0)
{
string[] catgories = mDataSource.Columns.Select(x => x.Name).ToArray();
string[] groups = mDataSource.Rows.Select(x => x.Name).ToArray();
foreach (string g in groups)
{
foreach (string c in catgories)
{
SetValue(c, g, value);
}
}
}
/// <summary>
/// clears alll categories in the bar chart
/// </summary>
public void ClearCategories()
{
string[] catgories = mDataSource.Columns.Select(x => x.Name).ToArray();
foreach (string s in catgories)
{
RemoveCategory(s);
}
}
/// <summary>
/// Adds a new category to the bar chart. Each category has it's own material and name.
/// Note: you must also add groups to the bar data.
/// Example: you can set the chart categories to be "Player 1","Player 2","Player 3" in order to compare player achivments
/// </summary>
/// <param name="name">the name of the category</param>
/// <param name="material">the dynamic material of the category. dynamic materials allows setting the material for different events</param>
public void AddCategory(string name, ChartDynamicMaterial material,int position)
{
ChartDataColumn column = new ChartDataColumn(name);
column.Material = material;
mDataSource.mColumns.Insert(position,column);
}
/// <summary>
/// moves the category to a new position
/// </summary>
/// <param name="name"></param>
/// <param name="newPosition"></param>
public void MoveCategory(string name,int newPosition)
{
mDataSource.mColumns.Move(name, newPosition);
}
public void SwitchCategoryPositions(string firstCategory,string secondCategory)
{
mDataSource.mColumns.SwitchPositions(firstCategory, secondCategory);
}
/// <summary>
/// Adds a new category to the bar chart. Each category has it's own material and name.
/// Note: you must also add groups to the bar data.
/// Example: you can set the chart categories to be "Player 1","Player 2","Player 3" in order to compare player achivments
/// </summary>
/// <param name="name">the name of the category</param>
/// <param name="material">the dynamic material of the category. dynamic materials allows setting the material for different events</param>
public void AddCategory(string name, ChartDynamicMaterial material)
{
ChartDataColumn column = new ChartDataColumn(name);
column.Material = material;
mDataSource.mColumns.Add(column);
}
public void SetCategoryIndex(string name,int index)
{
ChartDataColumn col = mDataSource.mColumns[name];
double[] values = new double[TotalGroups];
for(int i=0; i<TotalGroups; i++)
{
string g = GetGroupName(i);
values[i] = GetValue(name, g);
}
mDataSource.Columns.Remove(col);
mDataSource.Columns.Insert(index, col);
for (int i = 0; i < TotalGroups; i++)
{
string g = GetGroupName(i);
SetValue(name, g, values[i]);
}
}
/// <summary>
/// sets the material for the specified category
/// </summary>
/// <param name="category">the name of the category</param>
/// <param name="material">the material of the category</param>
public void SetMaterial(string category,Material material)
{
SetMaterial(category, new ChartDynamicMaterial(material));
}
public ChartDynamicMaterial GetMaterial(string category)
{
return mDataSource.Columns[category].Material;
}
/// <summary>
/// sets the material for the specified category
/// </summary>
/// <param name="category">the name of the category</param>
/// <param name="material">the dynamic material of the category. dynamic materials allows setting the material for different events</param>
public void SetMaterial(string category,ChartDynamicMaterial material)
{
mDataSource.Columns[category].Material = material;
RaisePropertyUpdated();
}
/// <summary>
/// removes a category from the bar chart
/// </summary>
/// <param name="name">the name of the category to remove</param>
public void RemoveCategory(string name)
{
ChartDataColumn column = mDataSource.Columns[name];
RemoveSliderForCategory(name);
mDataSource.Columns.Remove(column);
}
/// <summary>
/// removes a group from the bar chart
/// </summary>
/// <param name="name">the name of the group to remove</param>
public void RemoveGroup(string name)
{
ChartDataRow row = mDataSource.Rows[name];
RemoveSliderForGroup(name);
mDataSource.Rows.Remove(row);
}
/// <summary>
/// Adds a group to the bar chart. Each group holds a double value for each category.
/// Note: you must also add at least one category to the bar chart
/// Example: you can set the categories to "Player 1","Player 2","Player 3" and the groups to "Gold","Wood","Oil","Total"
/// in order to compare the resources the players have gather during a level
/// </summary>
/// <param name="name"></param>
public void AddGroup(string name)
{
mDataSource.Rows.Add(new ChartDataRow(name));
}
/// <summary>
/// gets the value for the specified group and category
/// </summary>
/// <param name="category">the category name</param>
/// <param name="group">the group name</param>
/// <returns></returns>
public double GetValue(string category,string group)
{
return mDataSource.GetValue(category, group);
}
public bool CheckAnimationEnded(float time, AnimationCurve curve)
{
if (curve.length == 0)
return true;
return time > curve.keys[curve.length - 1].time;
}
private void FixEaseFunction(AnimationCurve curve)
{
curve.postWrapMode = WrapMode.Once;
curve.preWrapMode = WrapMode.Once;
}
public void RestoreCategory(string name,object obj)
{
var cat = (CategoryData)obj;
SetMaterial(name, cat.Materials);
}
public void SlideValue(string category, string group, double slideTo,float totalTime, AnimationCurve curve)
{
try
{
RemoveSlider(category, group);
curve.postWrapMode = WrapMode.Once;
curve.preWrapMode = WrapMode.Once;
float time = 0f;
if (curve.length > 0)
time = curve.keys[curve.length - 1].time;
Slider s = new Slider();
s.category = category;
s.group = group;
s.from = GetValue(category, group);
s.to = slideTo;
s.startTime = Time.time;
s.timeScale = time / totalTime;
s.totalTime = time;
s.curve = curve;
mSliders.Add(s);
}
catch (ChartException e)
{
Debug.LogWarning(e.Message);
}
}
public void SlideValue(string category,string group,double slideTo,float time)
{
try
{
RemoveSlider(category, group);
Slider s = new Slider();
s.category = category;
s.group = group;
s.from = GetValue(category, group);
s.to = slideTo;
s.startTime = Time.time;
s.totalTime = time;
mSliders.Add(s);
}
catch (ChartException e)
{
Debug.LogWarning(e.Message);
}
}
/// <summary>
/// sets the value for the specified group and category
/// </summary>
/// <param name="category">the category name</param>
/// <param name="group">the group name</param>
/// <param name="amount">the value fo the bar</param>
public void SetValue(string category,string group,double amount)
{
RemoveSlider(category, group);
SetValueInternal(category, group, amount);
}
protected override void SetValueInternal(string category, string group, double amount)
{
try
{
mDataSource.SetValue(category, group, amount);
}
catch (ChartException e)
{
Debug.LogWarning(e.Message);
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 83cafb2eb9779f3468aad148987eb4bc
timeCreated: 1473966108
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,24 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.Events;
namespace ChartAndGraph
{
public abstract class BarGenerator : MonoBehaviour, IBarGenerator
{
/// <summary>
/// generates a bar within the specified rect. The rect is in local coordinates
/// </summary>
/// <param name="rect">A rect that specifies the bounds of the bar. the rect is in local coordinates</param>
/// <param name="normalizedSize">a value between 0 to 1 representing the size of the rect relative to the size of the chart</param>
public abstract void Generate(float normalizedSize,float scale);
/// <summary>
/// clears the bar the was generated be the Generate method.
/// </summary>
public abstract void Clear();
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: fe88eea2abcbbb0439344abc5d2f6a1b
timeCreated: 1472816163
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,80 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.UI;
namespace ChartAndGraph
{
public class BarInfo : MonoBehaviour
{
public BarChart.BarObject BarObject {get; set;}
/// <summary>
/// gets the item label for this bar, or null if no item label is assigned to it
/// </summary>
public GameObject ItemLabel
{
get
{
if (BarObject == null)
return null;
if (BarObject.ItemLabel == null)
return null;
return BarObject.ItemLabel.UIText;
}
}
public GameObject CategoryLabel
{
get
{
if (BarObject == null)
return null;
if (BarObject.CategoryLabel == null)
return null;
return BarObject.CategoryLabel.UIText;
}
}
/// <summary>
/// gets the value of the bar
/// </summary>
public double Value
{
get
{
if (BarObject == null)
return 0.0;
return BarObject.Value;
}
}
/// <summary>
/// gets the category of the bar
/// </summary>
public string Category
{
get
{
if (BarObject == null)
return "";
return BarObject.Category;
}
}
/// <summary>
/// gets the group of the bar
/// </summary>
public string Group
{
get
{
if (BarObject == null)
return "";
return BarObject.Group;
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 77680f04204076142818a77ae4c9a124
timeCreated: 1478381852
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,20 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ChartAndGraph
{
public enum BarMaterialFit
{
/// <summary>
/// Stretch the material along the bar.
/// </summary>
Stretch,
/// <summary>
/// If the bar is small , the material will be cut to match it's size. If the bar is at maximum size , all the material will be visible
/// </summary>
Trim
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 3acd3aa78306f2145b6a366a02c3daa6
timeCreated: 1472816161
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,232 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace ChartAndGraph
{
/// <summary>
/// This class contains functionallity for generating 3d and 2d bar meshes
/// </summary
class BarMesh
{
private static Mesh m2DStrechMesh;
/// <summary>
/// A lazy loaded 2d stretch mesh. This mesh is always the same
/// </summary>
public static Mesh StrechMesh2D
{
get
{
if (m2DStrechMesh == null)
m2DStrechMesh = Generate2DMesh(1.0f);
return m2DStrechMesh;
}
}
/// <summary>
/// updates the uv of a mesh generated with Generate2DMesh
/// </summary>
/// <param name="m"></param>
/// <param name="maxV"></param>
public static void Update2DMeshUv(Mesh m,float maxV)
{
Vector2[] uv = m.uv;
uv[4] = uv[0] = new Vector2(0f, 0f);
uv[5] = uv[1] = new Vector2(1f, 0f);
uv[6] = uv[2] = new Vector2(1f, maxV);
uv[7] = uv[3] = new Vector2(0f, maxV);
m.uv = uv;
}
/// <summary>
/// generates a 2d bar mesh with the specified maximum V coord. (used with trim material fit)
/// </summary>
/// <param name="maxV"></param>
/// <returns></returns>
public static Mesh Generate2DMesh(float maxV)
{
Vector3[] vertices = new Vector3[8];
Vector2[] uv = new Vector2[8];
int[] tringles = new int[12];
vertices[4] = vertices[0] = new Vector3(-0.5f, 0f, 0f);
vertices[5] = vertices[1] = new Vector3(0.5f, 0f, 0f);
vertices[6] = vertices[2] = new Vector3(0.5f, 1f, 0f);
vertices[7] = vertices[3] = new Vector3(-0.5f, 1f, 0f);
uv[4] = uv[0] = new Vector2(0f, 0f);
uv[5] = uv[1] = new Vector2(1f, 0f);
uv[6] = uv[2] = new Vector2(1f, maxV);
uv[7] = uv[3] = new Vector2(0f, maxV);
WriteRect(tringles, 0, 1, 2, 0, 3, false);
WriteRect(tringles, 2, 5, 6, 4, 7, true);
Mesh mesh = new Mesh();
mesh.hideFlags = HideFlags.DontSave;
mesh.vertices = vertices;
mesh.uv = uv;
mesh.triangles = tringles;
mesh.RecalculateNormals();
return mesh;
}
/// <summary>
/// writes a single rectangle to the tringles array
/// </summary>
/// <param name="tringles"></param>
/// <param name="tringleIndex">this value is multiplied by 3 in order to find the real array index</param>
/// <param name="a"> index of the first vertex</param>
/// <param name="b"> index of the second vertex</param>
/// <param name="c"> index of the third vertex</param>
/// <param name="d"> index of the forth vertex</param>
static void WriteRect(int[] tringles,int tringleIndex,int a,int b,int c,int d,bool flip)
{
if (flip)
{
WriteTringle(tringles, tringleIndex++, a, b, c);
WriteTringle(tringles, tringleIndex, d, c, b);
}
else
{
WriteTringle(tringles, tringleIndex++, c, b, a);
WriteTringle(tringles, tringleIndex, b, c, d);
}
}
/// <summary>
/// writes a single tringle to the tringle array
/// </summary>
/// <param name="tringles"></param>
/// <param name="tringleIndex">this value is multiplied by 3 in order to find the real array index</param>
/// <param name="a">index of the first vertex</param>
/// <param name="b">index of the second vertex</param>
/// <param name="c">index of the third vertex</param>
static void WriteTringle(int[] tringles,int tringleIndex,int a,int b,int c)
{
int index = tringleIndex*3;
tringles[index++] = a;
tringles[index++] = b;
tringles[index++] = c;
}
private static Mesh m3DStretchMesh;
/// <summary>
/// A lazy loaded 3d stretch mesh. This mesh is always the same
/// </summary>
public static Mesh StrechMesh3D
{
get
{
if (m3DStretchMesh == null)
m3DStretchMesh = Generate3DMesh(1.0f);
return m3DStretchMesh;
}
}
/// <summary>
/// updates the uv of a mesh created with Generate3DMesh
/// </summary>
/// <param name="m"></param>
/// <param name="maxV"></param>
public static void Update3DMeshUv(Mesh m, float maxV)
{
Vector2[] uv = m.uv;
uv[0] = new Vector2(0f, 0f);
uv[1] = new Vector2(1f, 0f);
uv[2] = new Vector2(1f, maxV);
uv[3] = new Vector2(0f, maxV);
uv[4] = new Vector2(1f, 0f);
uv[5] = new Vector2(0f, 0f);
uv[6] = new Vector2(0f, maxV);
uv[7] = new Vector2(1f, maxV);
uv[8] = new Vector2(0f, 0f);
uv[9] = new Vector2(1f, 0f);
uv[10] = new Vector2(1f, 1f);
uv[11] = new Vector2(0f, 1f);
uv[12] = new Vector2(1f, 0f);
uv[13] = new Vector2(0f, 0f);
uv[14] = new Vector2(0f, 1f);
uv[15] = new Vector2(1f, 1f); m.uv = uv;
}
/// <summary>
/// generates a 3d bar mesh with the specified maximum V coord. (used with trim material fit)
/// </summary>
/// <param name="maxV"></param>
/// <returns></returns>
public static Mesh Generate3DMesh(float maxV)
{
Vector3[] vertices = new Vector3[16];
Vector2[] uv = new Vector2[16];
int[] tringles = new int[36];
vertices[0] = new Vector3(-0.5f, 0f, -0.5f);
vertices[1] = new Vector3(0.5f, 0f, -0.5f);
vertices[2] = new Vector3(0.5f, 1f, -0.5f);
vertices[3] = new Vector3(-0.5f, 1f, -0.5f);
vertices[4] = new Vector3(-0.5f, 0f, 0.5f);
vertices[5] = new Vector3(0.5f, 0f, 0.5f);
vertices[6] = new Vector3(0.5f, 1f, 0.5f);
vertices[7] = new Vector3(-0.5f, 1f, 0.5f);
vertices[8] = new Vector3(-0.5f, 0f, -0.5f);
vertices[9] = new Vector3(0.5f, 0f, -0.5f);
vertices[10] = new Vector3(0.5f, 1f, -0.5f);
vertices[11] = new Vector3(-0.5f, 1f, -0.5f);
vertices[12] = new Vector3(-0.5f, 0f, 0.5f);
vertices[13] = new Vector3(0.5f, 0f, 0.5f);
vertices[14] = new Vector3(0.5f, 1f, 0.5f);
vertices[15] = new Vector3(-0.5f, 1f, 0.5f);
uv[0] = new Vector2(0f, 0f);
uv[1] = new Vector2(1f, 0f);
uv[2] = new Vector2(1f, maxV);
uv[3] = new Vector2(0f, maxV);
uv[4] = new Vector2(1f, 0f);
uv[5] = new Vector2(0f, 0f);
uv[6] = new Vector2(0f, maxV);
uv[7] = new Vector2(1f, maxV);
uv[8] = new Vector2(0f, 0f);
uv[9] = new Vector2(1f, 0f);
uv[10] = new Vector2(1f, 1f);
uv[11] = new Vector2(0f, 1f);
uv[12] = new Vector2(1f, 0f);
uv[13] = new Vector2(0f, 0f);
uv[14] = new Vector2(0f, 1f);
uv[15] = new Vector2(1f, 1f);
WriteRect(tringles, 0, 1, 2, 0, 3, false);
WriteRect(tringles, 2, 5, 6, 4, 7, true);
WriteRect(tringles, 4, 8, 9, 12, 13, true);
WriteRect(tringles, 6, 10, 11, 14, 15, true);
WriteRect(tringles, 8, 6, 5, 2, 1, true);
WriteRect(tringles, 10, 7, 4, 3, 0, false);
Mesh mesh = new Mesh();
mesh.hideFlags = HideFlags.DontSave;
mesh.vertices = vertices;
mesh.uv = uv;
mesh.triangles = tringles;
mesh.RecalculateNormals();
return mesh;
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 78e63bbfee62a1f4db007c2147bd8177
timeCreated: 1472893291
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,17 @@
#define Graph_And_Chart_PRO
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using UnityEngine;
//namespace ChartAndGraph
//{
// /// <summary>
// /// This class contains functionallity for generating 3d and 2d bar meshes
// /// </summary
// partial class BarMesh
// {
// }
//}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: c2901fb0eecf53045ae83755f482ad62
timeCreated: 1560535998
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,106 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace ChartAndGraph
{
[RequireComponent(typeof(MeshRenderer))]
[RequireComponent(typeof(MeshFilter))]
class BarMeshGenerator : BarGenerator
{
/// <summary>
/// Sets the dimention of the generated mesh. can be either 2d or 3d
/// </summary>
public MeshDimention MeshDimention = MeshDimention._2D;
/// <summary>
/// Sets the way materials are fit to the bar mesh
/// </summary>
public BarMaterialFit MaterialFit = BarMaterialFit.Stretch;
/// <summary>
/// Contains a mesh that was generate for this object only and should be destoryed once the object is cleaned
/// </summary>
Mesh mCleanMesh = null;
/// <summary>
/// the mesh filter for this object
/// </summary>
MeshFilter mFilter;
MeshDimention mCurrentDimention;
BarMaterialFit mCurrentMaterialFit;
private bool EnsureMeshFilter()
{
if (mFilter == null)
mFilter = GetComponent<MeshFilter>();
if (mFilter == null)
return false;
return true;
}
/// <summary>
///
/// </summary>
/// <param name="rect"></param>
/// <param name="normalizedSize"></param>
public override void Generate(float normalizedSize,float scale)
{
if (EnsureMeshFilter() == false) // No mesh filter attached
return;
if(mFilter.sharedMesh != null)
{
if(MaterialFit == BarMaterialFit.Trim && mCurrentMaterialFit == BarMaterialFit.Trim)
{
if(MeshDimention == mCurrentDimention)
{
if (MeshDimention == ChartAndGraph.MeshDimention._2D)
BarMesh.Update2DMeshUv(mFilter.sharedMesh, normalizedSize);
else
BarMesh.Update3DMeshUv(mFilter.sharedMesh, normalizedSize);
return;
}
}
}
mCurrentDimention = MeshDimention;
mCurrentMaterialFit = MaterialFit;
if(MaterialFit == BarMaterialFit.Stretch)
{
if (MeshDimention == ChartAndGraph.MeshDimention._2D)
mFilter.sharedMesh = BarMesh.StrechMesh2D;
else
mFilter.sharedMesh = BarMesh.StrechMesh3D;
ChartCommon.CleanMesh(null, ref mCleanMesh);
return;
}
if (MaterialFit == BarMaterialFit.Trim)
{
Mesh newMesh = null;
if (MeshDimention == ChartAndGraph.MeshDimention._2D)
newMesh = BarMesh.Generate2DMesh(normalizedSize);
else
newMesh = BarMesh.Generate3DMesh(normalizedSize);
mFilter.sharedMesh = newMesh;
ChartCommon.CleanMesh(newMesh, ref mCleanMesh);
}
else
return; // should not happen ever
}
/// <summary>
///
/// </summary>
public override void Clear()
{
ChartCommon.CleanMesh(null, ref mCleanMesh);
}
void OnDestroy()
{
Clear();
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: bff5a247b0442474daa4fc07d33bdeab
timeCreated: 1472816163
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,349 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.EventSystems;
namespace ChartAndGraph
{
public class CanvasBarChart : BarChart, ICanvas
{
/// <summary>
/// The seperation between the axis and the chart bars.
/// </summary>
[SerializeField]
private bool fitToContainer = false;
public bool FitToContainer
{
get { return fitToContainer; }
set
{
fitToContainer = value;
OnPropertyUpdated();
}
}
[SerializeField]
private ChartMagin fitMargin;
public ChartMagin FitMargin
{
get { return fitMargin; }
set
{
fitMargin = value;
OnPropertyUpdated();
}
}
protected override ChartMagin MarginLink
{
get
{
return fitMargin;
}
}
[SerializeField]
/// <summary>
/// prefab for the bar elements of the chart. must be the size of one unit with a pivot at the middle bottom
/// </summary>
[Tooltip("Prefab for the bar elements of the chart. must be the size of one unit with a pivot at the middle bottom")]
private CanvasRenderer barPrefab;
/// <summary>
/// prefab for the bar elements of the chart. must be the size of one unit with a pivot at the middle bottom
/// </summary>
public CanvasRenderer BarPrefab
{
get { return barPrefab; }
set
{
barPrefab = value;
OnPropertyUpdated();
}
}
public override bool IsCanvas
{
get
{
return true;
}
}
/// <summary>
/// The seperation between the axis and the chart bars.
/// </summary>
[SerializeField]
[Tooltip("The seperation between the axis and the chart bars")]
private float axisSeperation = 20f;
protected override float TotalDepthLink
{
get
{
return 0.0f;
}
}
/// <summary>
/// The seperation between the axis and the chart bars.
/// </summary>
public float AxisSeperation
{
get { return axisSeperation; }
set
{
axisSeperation = value;
OnPropertyUpdated();
}
}
/// <summary>
/// seperation between bar of the same group
/// </summary>
[SerializeField]
[Tooltip("seperation between bar of the same group")]
private float barSeperation = 45f;
/// <summary>
/// seperation between bars of the same group.
/// </summary>
public float BarSeperation
{
get { return barSeperation; }
set
{
barSeperation = value;
OnPropertyUpdated();
}
}
/// <summary>
/// seperation between bar groups
/// </summary>
[SerializeField]
[Tooltip("seperation between bar groups")]
private float groupSeperation = 220f;
/// <summary>
/// The seperation between bar groups.
/// <summary>
public float GroupSeperation
{
get { return groupSeperation; }
set
{
groupSeperation = value;
OnPropertyUpdated();
}
}
public override bool SupportRealtimeGeneration
{
get
{
return false;
}
}
/// <summary>
/// the width of each bar in the chart
/// </summary>
[SerializeField]
[Tooltip("the width of each bar in the chart")]
private float barSize = 20f;
/// <summary>
/// the width of each bar in the chart
/// </summary>
public float BarSize
{
get { return barSize; }
set
{
barSize = value;
OnPropertyUpdated();
}
}
protected override ChartOrientedSize AxisSeperationLink
{
get
{
return new ChartOrientedSize(AxisSeperation);
}
}
protected override ChartOrientedSize BarSeperationLink
{
get
{
return new ChartOrientedSize(BarSeperation);
}
}
protected override ChartOrientedSize GroupSeperationLink
{
get
{
return new ChartOrientedSize(GroupSeperation);
}
}
protected override ChartOrientedSize BarSizeLink
{
get
{
return new ChartOrientedSize(BarSize);
}
}
protected override void SetBarSize(GameObject bar, Vector3 size,float elevation)
{
RectTransform rect = bar.GetComponent<RectTransform>();
if (rect != null)
{
float ySize = size.y;
float yAnchor = 0f;
if (ySize < 0)
{
ySize = -ySize;
yAnchor = 1;
}
rect.pivot = new Vector2(0.5f, yAnchor);
rect.sizeDelta = new Vector2(size.x, ySize);
Vector2 v = rect.localPosition;
v.y = elevation;
rect.localPosition = v;
}
else
base.SetBarSize(bar, size,elevation);
}
protected override void Update()
{
base.Update();
}
//protected override Vector3 CanvasFitOffset
//{
// get
// {
// return new Vector3();
// }
//}
/// <summary>
///
/// </summary>
///
[SerializeField]
[Tooltip("")]
private FitOrientation barFitDirection = FitOrientation.Normal;
/// <summary>
/// the width of each bar in the chart
/// </summary
public FitOrientation BarFitDirection
{
get { return barFitDirection; }
set
{
barFitDirection = value;
OnPropertyUpdated();
}
}
[SerializeField]
[Tooltip("")]
private FitType barFitType = FitType.Aspect;
/// <summary>
/// the width of each bar in the chart
/// </summary
public FitType BarFitType
{
get { return barFitType; }
set
{
barFitType = value;
OnPropertyUpdated();
}
}
/// <summary>
///
/// </summary>
[SerializeField]
[Tooltip("")]
private FitAlign barFitAlign = FitAlign.CenterXCenterY;
/// <summary>
/// the width of each bar in the chart
/// </summary
public FitAlign BarFitAlign
{
get { return barFitAlign; }
set
{
barFitAlign = value;
OnPropertyUpdated();
}
}
protected override float FitZRotationCanvas
{
get { return (barFitDirection == FitOrientation.Vertical) ? -90 :(barFitDirection == FitOrientation.VerticalOpopsite ? 90 : 0); }
}
protected override FitType FitAspectCanvas { get { return BarFitType; } }
protected override FitAlign FitAlignCanvas { get { return BarFitAlign; } }
[ContextMenu("Refresh chart")]
public override void InternalGenerateChart()
{
RectTransform trans = GetComponent<RectTransform>();
if (FitToContainer)
{
if (barFitDirection == FitOrientation.Normal)
{
float width = MessureWidth();
heightRatio = width * (trans.rect.size.y / trans.rect.size.x);
}
else
{
float width = MessureWidth();
heightRatio = width * (trans.rect.size.x / trans.rect.size.y);
}
}
base.InternalGenerateChart();
//if (TextController != null && TextController.gameObject)
// TextController.gameObject.transform.SetAsLastSibling();
//float widthScale = trans.rect.size.x / TotalWidth;
//float heightScale = trans.rect.size.y / HeightRatio;
//GameObject fixPosition = new GameObject();
//ChartCommon.HideObject(fixPosition, hideHierarchy);
//fixPosition.AddComponent<ChartItem>();
//fixPosition.transform.position = transform.position;
//while (gameObject.transform.childCount > 0)
// transform.GetChild(0).SetParent(fixPosition.transform, false);
//fixPosition.transform.SetParent(transform, false);
//fixPosition.transform.localScale = new Vector3(1f, 1f, 1f);
//float uniformScale = Math.Min(widthScale, heightScale);
//fixPosition.transform.localScale = new Vector3(uniformScale, uniformScale, uniformScale);
//fixPosition.transform.localPosition = new Vector3(-TotalWidth * uniformScale * 0.5f, -HeightRatio * uniformScale * 0.5f, 0f);
}
protected override GameObject BarPrefabLink
{
get
{
if (BarPrefab == null)
return null;
return BarPrefab.gameObject;
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: acb1d1c592b0c794d8bff6d0a590986e
timeCreated: 1478565292
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ChartAndGraph
{
public interface IBarGenerator
{
void Generate(float normalizedSize,float scale);
void Clear();
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 890470d3be0138e408ab56d25c63b82f
timeCreated: 1499880160
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,234 @@
#define Graph_And_Chart_PRO
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ChartAndGraph.Axis;
using UnityEngine;
namespace ChartAndGraph
{
public class WorldSpaceBarChart : BarChart
{
/// <summary>
/// If this value is set all the text in the chart will be rendered to this specific camera. otherwise text is rendered to the main camera
/// </summary>
[SerializeField]
[Tooltip("If this value is set all the text in the chart will be rendered to this specific camera. otherwise text is rendered to the main camera")]
private Camera textCamera;
/// <summary>
/// If this value is set all the text in the chart will be rendered to this specific camera. otherwise text is rendered to the main camera
/// </summary>
public Camera TextCamera
{
get { return textCamera; }
set
{
textCamera = value;
OnPropertyUpdated();
}
}
public override bool IsCanvas
{
get
{
return false;
}
}
/// <summary>
/// The distance from the camera at which the text is at it's original size.
/// </summary>
[SerializeField]
[Tooltip("The distance from the camera at which the text is at it's original size")]
private float textIdleDistance = 20f;
/// <summary>
/// The distance from the camera at which the text is at it's original size.
/// </summary>
public float TextIdleDistance
{
get { return textIdleDistance; }
set
{
textIdleDistance = value;
OnPropertyUpdated();
}
}
/// <summary>
/// prefab for all the bar elements of the chart. must be one unit size and with a bottom middle pivot
/// </summary>
[SerializeField]
[Tooltip("prefab for all the bar elements of the chart. must be one unit size and with a bottom middle pivot")]
private GameObject barPrefab;
/// <summary>
/// prefab for all the bar elements of the chart. must be one unit size and with a bottom middle pivot
/// </summary>
public GameObject BarPrefab
{
get
{
return barPrefab;
}
set
{
barPrefab = value;
OnPropertyUpdated();
}
}
/// <summary>
/// The seperation between the axis and the chart bars.
/// </summary>
[SerializeField]
[Tooltip("The seperation between the axis and the chart bars")]
private ChartOrientedSize AxisSeperation = new ChartOrientedSize();
/// <summary>
/// The seperation between the axis and the chart bars
/// </summary>
public ChartOrientedSize axisSeperation
{
get { return AxisSeperation; }
set
{
AxisSeperation = value;
OnPropertyUpdated();
}
}
/// <summary>
/// The seperation between bars of the same group.
/// Use cases:
/// 1. set the depth to 0 to make each group look more 2d.
/// 2. set the breadth to 0 to make align the bars of each group along the z axis
/// </summary>
[SerializeField]
[Tooltip("The seperation between bars of the same group")]
private ChartOrientedSize barSeperation = new ChartOrientedSize();
/// <summary>
/// The seperation between bars of the same group.
/// Use cases:
/// 1. set the depth to 0 to make each group look more 2d.
/// 2. set the breadth to 0 to make align the bars of each group along the z axis
/// </summary>
public ChartOrientedSize BarSeperation
{
get { return barSeperation; }
set
{
barSeperation = value;
OnPropertyUpdated();
}
}
/// <summary>
/// The seperation between bar groups.
/// Use cases:
/// 1.set the depth to 0 for a more 2d look.
/// 2.set the breadth to 0 to align the groups on the z axis
/// </summary>
[SerializeField]
[Tooltip("seperation between bar groups")]
private ChartOrientedSize groupSeperation = new ChartOrientedSize();
/// <summary>
/// The seperation between bar groups.
/// Use cases:
/// 1.set the depth to 0 for a more 2d look.
/// 2.set the breadth to 0 to align the groups on the z axis
/// <summary>
public ChartOrientedSize GroupSeperation
{
get { return groupSeperation; }
set
{
groupSeperation = value;
OnPropertyUpdated();
}
}
/// <summary>
/// the size of each bar in the chart
/// </summary>
[SerializeField]
[Tooltip("the size of each bar in the chart")]
private ChartOrientedSize barSize = new ChartOrientedSize(1f, 1f);
/// <summary>
/// the size of each bar in the chart
/// </summary>
public ChartOrientedSize BarSize
{
get { return barSize; }
set
{
barSize = value;
OnPropertyUpdated();
}
}
protected override ChartOrientedSize AxisSeperationLink
{
get
{
return AxisSeperation;
}
}
protected override ChartOrientedSize BarSeperationLink
{
get
{
return BarSeperation;
}
}
protected override ChartOrientedSize GroupSeperationLink
{
get
{
return GroupSeperation;
}
}
protected override ChartOrientedSize BarSizeLink
{
get
{
return BarSize;
}
}
protected override Camera TextCameraLink
{
get
{
return TextCamera;
}
}
protected override float TextIdleDistanceLink
{
get
{
return TextIdleDistance;
}
}
protected override GameObject BarPrefabLink
{
get
{
return BarPrefab;
}
}
protected override void ValidateProperties()
{
base.ValidateProperties();
if (barSize.Breadth < 0f)
barSize.Breadth = 0f;
if (barSize.Depth < 0f)
barSize.Depth = 0f;
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 82d167234d2aa7746a9618de50700879
timeCreated: 1478712963
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,70 @@
#define Graph_And_Chart_PRO
using ChartAndGraph;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class customBarSelection : MonoBehaviour
{
void Start()
{
try
{
//register with MasterBarRotation when started
var master = GetComponentInParent<masterBarSelection>();
if(master != null)
master.Register(this);
}
catch(Exception)
{
}
}
void OnDestroy()
{
try
{
//unregister when destroyed
GetComponentInParent<masterBarSelection>().Unregister(this);
}
catch (Exception)
{
}
}
public void ToogleSelection(string category, string group)
{
// get the bar info of the prefab
var barInfo = GetComponent<BarInfo>();
// check for a category match
if (barInfo.Category != category)
return;
//check for a group match
if (barInfo.Group != group)
return;
// get the bar info of the prefab
var control = GetComponent<ChartMaterialController>();
control.Selected = !control.Selected;
control.Refresh();
}
// when rotate is called . a check is performed to see if this bar is the bar that should be rotated
public void SetSelection(string category, string group,bool selected)
{
// get the bar info of the prefab
var barInfo = GetComponent<BarInfo>();
// check for a category match
if (barInfo.Category != category)
return;
//check for a group match
if (barInfo.Group != group)
return;
// get the bar info of the prefab
var control = GetComponent<ChartMaterialController>();
control.Selected = selected;
control.Refresh();
}
}

View File

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

View File

@@ -0,0 +1,36 @@
#define Graph_And_Chart_PRO
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class masterBarSelection : MonoBehaviour
{
List<customBarSelection> mSelections = new List<customBarSelection>();
public void Register(customBarSelection sel)
{
mSelections.Add(sel);
}
public void Unregister(customBarSelection sel)
{
mSelections.Remove(sel);
}
public void ToogleBar(string category, string group)
{
foreach (customBarSelection s in mSelections)
s.ToogleSelection(category, group);
}
public void SelectBar(string category, string group)
{
foreach(customBarSelection s in mSelections)
s.SetSelection(category, group,true);
}
public void DeselectBar(string category, string group)
{
foreach (customBarSelection s in mSelections)
s.SetSelection(category, group, false);
}
}

View File

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

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 1c5df8a40695a4340beca4c338df7e39
folderAsset: yes
timeCreated: 1491152606
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,651 @@
#define Graph_And_Chart_PRO
#define CandleChart
using ChartAndGraph;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.Events;
namespace ChartAndGraph
{
[ExecuteInEditMode]
public abstract class CandleChart : ScrollableAxisChart
{
/// <summary>
/// a candle chart event
/// </summary>
[Serializable]
public class CandleEvent : UnityEvent<CandleEventArgs>
{
}
[SerializeField]
[Tooltip("The height ratio of the chart")]
protected float heightRatio = 300;
[SerializeField]
[Tooltip("The width ratio of the chart")]
protected float widthRatio = 600;
protected override float TotalHeightLink
{
get
{
return heightRatio;
}
}
protected override float TotalWidthLink
{
get
{
return widthRatio;
}
}
/// <summary>
/// occures when a point is clicked
/// </summary>
public CandleEvent CandleClicked = new CandleEvent();
/// <summary>
/// occurs when a point is hovered
/// </summary>
public CandleEvent CandleHovered = new CandleEvent();
/// <summary>
/// occurs when no candle is hovered any longer
/// </summary>
public UnityEvent NonHovered = new UnityEvent();
public enum CandleThicknessMode
{
/// <summary>
/// the candle size is detemined only by the candle duration paramenter
/// </summary>
Fill,
/// <summary>
/// the candle is of constant size , regardless of the view size
/// </summary>
Constant,
/// <summary>
/// the candle size is fixed , but proportional to the view size
/// </summary>
Proportional
}
/// <summary>
/// format a candle value to the parameter strings
/// </summary>
/// <param name="candleVal"></param>
/// <param name="fractionDigits"></param>
/// <param name="open"></param>
/// <param name="high"></param>
/// <param name="low"></param>
/// <param name="close"></param>
public void FormatCandleValue(CandleChartData.CandleValue candleVal, int fractionDigits, out string open, out string high, out string low, out string close)
{
open = StringFromAxisFormat(new DoubleVector3(candleVal.Start,candleVal.Open,0.0), mVerticalAxis,false);
close = StringFromAxisFormat(new DoubleVector3(candleVal.Start, candleVal.Close, 0.0), mVerticalAxis, false);
high = StringFromAxisFormat(new DoubleVector3(candleVal.Start, candleVal.High, 0.0), mVerticalAxis, false);
low = StringFromAxisFormat(new DoubleVector3(candleVal.Start, candleVal.Low, 0.0), mVerticalAxis, false);
}
/// <summary>
/// format a candle value to the parameter strings
/// </summary>
/// <param name="candleVal"></param>
/// <param name="fractionDigits"></param>
/// <param name="start"></param>
/// <param name="duration"></param>
public void FormatCandleValue(CandleChartData.CandleValue candleVal, int fractionDigits, out string start, out string duration)
{
start = StringFromAxisFormat(new DoubleVector3(candleVal.Start, candleVal.Open, 0.0), mHorizontalAxis, true);
duration = StringFromAxisFormat(new DoubleVector3(candleVal.Duration, candleVal.Open, 0.0), mHorizontalAxis, true);
}
/// <summary>
/// format a candle value to the parameter strings
/// </summary>
/// <param name="candleVal"></param>
/// <param name="fractionDigits"></param>
/// <param name="open"></param>
/// <param name="high"></param>
/// <param name="low"></param>
/// <param name="close"></param>
/// <param name="start"></param>
/// <param name="duration"></param>
public void FormatCandleValue(CandleChartData.CandleValue candleVal, int fractionDigits, out string open, out string high, out string low, out string close, out string start, out string duration)
{
FormatCandleValue(candleVal, fractionDigits, out open, out high, out low, out close);
FormatCandleValue(candleVal, fractionDigits, out start, out duration);
}
public class CandleEventArgs
{
int mType;
public CandleEventArgs(int index, int type, Rect selectionRect, Vector3 position, CandleChartData.CandleValue value, string category)
{
mType = type;
Position = position;
SelectionRect = selectionRect;
CandleValue = value;
Category = category;
}
/// <summary>
/// true if this event is triggered for the high portion of the candle
/// </summary>
public bool IsHighEvent { get { return mType == 0; } }
/// <summary>
/// true if this event is triggered for the low portion of the candle
/// </summary>
public bool IsLowEvent { get { return mType == 2; } }
/// <summary>
/// true if this event is triggerd for the body portion of the candle (open/close)
/// </summary>
public bool IsBodyEvent { get { return mType == 1; } }
/// <summary>
/// the rect on the canvas that represents the selected object
/// </summary>
public Rect SelectionRect { get; private set; }
/// <summary>
/// mouse position
/// </summary>
public Vector3 Position { get; private set; }
/// <summary>
/// the index of the candle in the data
/// </summary>
public int Index { get; private set; }
/// <summary>
/// the value of the candle
/// </summary>
public CandleChartData.CandleValue CandleValue { get; private set; }
/// <summary>
/// the category of the candle
/// </summary>
public string Category { get; private set; }
}
[SerializeField]
[Tooltip("Thickness mode for the candle chart")]
protected CandleThicknessMode thicknessMode = CandleThicknessMode.Constant;
/// <summary>
/// Thickness mode for the candle chart
/// </summary>
public CandleThicknessMode ThicknessMode
{
get { return thicknessMode; }
set
{
thicknessMode = value;
Invalidate();
}
}
protected override IChartData DataLink
{
get
{
return Data;
}
}
[SerializeField]
[Tooltip("Thickness contant for the candle chart , it's meaning depends on the thickness mode")]
protected float thicknessConstant = 10f;
/// <summary>
/// Thickness contant for the candle chart , it's meaning depends on the thickness mode\
/// Fill - multiply the duration size of the candle by a constant , should be between 0f to 1f
/// Constant - the pixel size of the candle
/// Proportional - constant size of the candle in seconds
/// </summary>
public float ThicknessConstant
{
get { return thicknessConstant; }
set
{
thicknessConstant = value;
Invalidate();
}
}
protected override float GetScrollingRange(int axis)
{
float min = (float)((IInternalCandleData)Data).GetMinValue(axis, false);
float max = (float)((IInternalCandleData)Data).GetMaxValue(axis, false);
return max - min;
}
[SerializeField]
[Tooltip("format with the following labels: <?start> , <?duration>,<?open>,<?high>,<?low>,<?close>")]
private string itemFormat = "O:<?open>,H:<?high>,L:<?low>,C:<?close>";
/// <summary>
/// format with the following labels:
/// <?start>
/// <?duration>
/// <?open>
/// <?close>
/// <?high>
/// <?low>
/// </summary>
public string ItemFormat
{
get { return itemFormat; }
set
{
itemFormat = value;
Invalidate();
}
}
[SerializeField]
[Tooltip("Used when using hoverItem component, and the mouse is hovering over the body of the candle,format with the following labels: <?start> , <?duration>,<?open>,<?high>,<?low>,<?close>")]
private string bodyFormat = "O:<?open>,C:<?close>";
/// <summary>
/// format with the following labels:
/// <?start>
/// <?duration>
/// <?open>
/// <?close>
/// <?high>
/// <?low>
/// </summary>
public string BodyFormat
{
get { return bodyFormat; }
set
{
bodyFormat = value;
Invalidate();
}
}
[SerializeField]
[Tooltip("Used when using hoverItem component, and the mouse is hovering over the high line of the candle,format with the following labels: <?start> , <?duration>,<?open>,<?high>,<?low>,<?close>")]
private string highFormat = "H:<?high>";
public string HighFormat
{
get { return highFormat; }
set
{
highFormat = value;
Invalidate();
}
}
[SerializeField]
[Tooltip("Used when using hoverItem component, and the mouse is hovering over the low line of the candle,format with the following labels: <?start> , <?duration>,<?open>,<?high>,<?low>,<?close>")]
private string lowFormat = "L:<?low>";
public string LowFormat
{
get { return lowFormat; }
set
{
lowFormat = value;
Invalidate();
}
}
/// <summary>
/// the candle chart data
/// </summary>
[HideInInspector]
[SerializeField]
protected CandleChartData Data = new CandleChartData();
/// <summary>
/// Holds the candle chart data. including values and categories
/// </summary>
public CandleChartData DataSource { get { return Data; } }
protected override void Start()
{
base.Start();
if (ChartCommon.IsInEditMode == false)
{
HookEvents();
}
Invalidate();
}
protected override void OnValidate()
{
base.OnValidate();
if (ChartCommon.IsInEditMode == false)
{
HookEvents();
}
Data.RestoreDataValues();
Invalidate();
}
/// <summary>
/// hooks data source events.
/// </summary>
protected void HookEvents()
{
((IInternalCandleData)Data).InternalDataChanged -= CandleChart_InternalDataChanged;
((IInternalCandleData)Data).InternalDataChanged += CandleChart_InternalDataChanged;
((IInternalCandleData)Data).InternalViewPortionChanged -= CandleChart_InternalViewPortionChanged;
((IInternalCandleData)Data).InternalViewPortionChanged += CandleChart_InternalViewPortionChanged;
((IInternalCandleData)Data).InternalRealTimeDataChanged -= CandleChart_InternalRealTimeDataChanged;
((IInternalCandleData)Data).InternalRealTimeDataChanged += CandleChart_InternalRealTimeDataChanged;
}
private void CandleChart_InternalViewPortionChanged(object sender, EventArgs e)
{
InvalidateRealtime();
}
private void CandleChart_InternalRealTimeDataChanged(int index,string str)
{
InvalidateRealtime();
}
private void CandleChart_InternalDataChanged(object sender, EventArgs e)
{
Invalidate();
}
protected override void OnLabelSettingChanged()
{
base.OnLabelSettingChanged();
Invalidate();
}
protected override void OnAxisValuesChanged()
{
base.OnAxisValuesChanged();
Invalidate();
}
protected override void OnLabelSettingsSet()
{
base.OnLabelSettingsSet();
Invalidate();
}
protected override LegenedData LegendInfo
{
get
{
LegenedData data = new LegenedData();
if (Data == null)
return data;
foreach (var cat in ((IInternalCandleData)Data).Categories)
{
for (int i = 0; i < 2; i++)
{
LegenedData.LegenedItem item = new LegenedData.LegenedItem();
CandleChartData.CandleSettings settings = cat.UpCandle;
if (i == 0)
{
item.Name = cat.Name + " Increasing";
}
else
{
item.Name = cat.Name + " Decreasing";
settings = cat.DownCandle;
}
if (settings.Fill != null)
item.Material = settings.Fill;
else
{
if (settings.Outline != null)
item.Material = settings.Outline;
else
item.Material = settings.Line;
}
data.AddLegenedItem(item);
}
}
return data;
}
}
protected override bool SupportsCategoryLabels
{
get
{
return true;
}
}
protected override bool SupportsGroupLables
{
get
{
return false;
}
}
protected override bool SupportsItemLabels
{
get
{
return true;
}
}
protected override bool HasValues(AxisBase axis)
{
if (axis == mVerticalAxis || axis == mHorizontalAxis) // has both horizontal and vertical axis
return true;
return false;
}
protected override double MaxValue(AxisBase axis)
{
if (axis == null)
return 0.0;
if (axis == mHorizontalAxis)
return ((IInternalCandleData)Data).GetMaxValue(0, false);
if (axis == mVerticalAxis)
return ((IInternalCandleData)Data).GetMaxValue(1, false);
return 0.0;
}
protected override double MinValue(AxisBase axis)
{
if (axis == null)
return 0.0;
if (axis == mHorizontalAxis)
return ((IInternalCandleData)Data).GetMinValue(0, false);
if (axis == mVerticalAxis)
return ((IInternalCandleData)Data).GetMinValue(1, false);
return 0.0;
}
void Deflate(ref double start, ref double duration, double amount)
{
double center = start + duration * 0.5;
duration *= amount;
start = center - duration * 0.5;
}
CandleChartData.CandleValue NormalizeCandle(CandleChartData.CandleValue candle, DoubleVector3 min, DoubleVector3 range)
{
CandleChartData.CandleValue res = new CandleChartData.CandleValue();
res.Open = ChartCommon.normalizeInRangeY(candle.Open, min, range);
res.Close = ChartCommon.normalizeInRangeY(candle.Close, min, range);
res.High = ChartCommon.normalizeInRangeY(candle.High, min, range);
res.Low = ChartCommon.normalizeInRangeY(candle.Low, min, range);
double duration = candle.Duration;
double start = candle.Start;
if (ThicknessMode == CandleThicknessMode.Fill)
Deflate(ref start, ref duration, ThicknessConstant);
else if (thicknessMode == CandleThicknessMode.Proportional)
Deflate(ref start, ref duration, ThicknessConstant / duration);
double candleEnd = start + duration;
candleEnd = ChartCommon.normalizeInRangeX(candleEnd, min, range);
res.Start = ChartCommon.normalizeInRangeX(start, min, range);
res.Duration = candleEnd - res.Start;
return res;
}
public CandleChartData.CandleValue InterpolateCandleInRect(CandleChartData.CandleValue candle, Rect viewRect)
{
CandleChartData.CandleValue res = new CandleChartData.CandleValue();
res.Open = ChartCommon.interpolateInRectY(viewRect, candle.Open);
res.Close = ChartCommon.interpolateInRectY(viewRect, candle.Close);
res.High = ChartCommon.interpolateInRectY(viewRect, candle.High);
res.Low = ChartCommon.interpolateInRectY(viewRect, candle.Low);
if (res.High < res.Low)
{
double tmp = res.High;
res.High = res.Low;
res.Low = tmp;
tmp = res.Open;
res.Open = res.Close;
res.Close = tmp;
}
double candleEnd = candle.Start + candle.Duration;
candleEnd = ChartCommon.interpolateInRectX(viewRect, candleEnd);
double start = ChartCommon.interpolateInRectX(viewRect, candle.Start);
double duration = candleEnd - start;
if (start > candleEnd)
{
double tmp = start;
start = candleEnd;
candleEnd = tmp;
}
if (ThicknessMode == CandleThicknessMode.Constant)
{
Deflate(ref start, ref duration, ThicknessConstant / duration);
}
res.Start = start;
res.Duration = duration;
return res;
}
StringBuilder mTmpBuilder = new StringBuilder();
protected string FormatItemWithFormat(string format, string open, string close, string high, string low, string start, string duration)
{
FormatItemWithFormat(mTmpBuilder, format, open, close, high, low, start, duration);
return mTmpBuilder.ToString();
}
public string FormatItem(string open, string close, string high, string low, string start, string duration)
{
return FormatItemWithFormat(itemFormat, open, close, high, low, start, duration);
}
public string FormatLow(string open, string close, string high, string low, string start, string duration)
{
return FormatItemWithFormat(lowFormat, open, close, high, low, start, duration);
}
public string FormatHigh(string open, string close, string high, string low, string start, string duration)
{
return FormatItemWithFormat(highFormat, open, close, high, low, start, duration);
}
public string FormatBody(string open, string close, string high, string low, string start, string duration)
{
return FormatItemWithFormat(bodyFormat, open, close, high, low, start, duration);
}
protected void FormatItem(StringBuilder builder, string open, string close, string high, string low, string start, string duration)
{
FormatItemWithFormat(builder, itemFormat, open, close, high, low, start, duration);
}
protected void FormatItemWithFormat(StringBuilder builder, string format, string open, string close, string high, string low, string start, string duration)
{
builder.Length = 0;
builder.Append(format);
builder.Replace("<?open>", open).Replace("<?close>", close).Replace("<?high>", high).Replace("<?low>", low).Replace("<?start>", start).Replace("<?duration>", duration);
}
protected void TransformCandles(IList<CandleChartData.CandleValue> candles, List<CandleChartData.CandleValue> output, Rect viewRect, DoubleVector3 min, DoubleVector3 max)
{
DoubleVector3 range = max - min;
if (Math.Abs(range.x) <= 0.0001f || Math.Abs(range.y) < 0.0001f)
return;
output.Clear();
for (int i = 0; i < candles.Count; i++)
{
CandleChartData.CandleValue candle = candles[i];
candle = InterpolateCandleInRect(NormalizeCandle(candle, min, range), viewRect);
output.Add(candle);
}
}
protected int ClipCandles(IList<CandleChartData.CandleValue> candles, List<CandleChartData.CandleValue> result)
{
result.Clear();
double minX, minY, maxX, maxY, xScroll, yScroll, xSize, ySize, xOut;
GetScrollParams(out minX, out minY, out maxX, out maxY, out xScroll, out yScroll, out xSize, out ySize, out xOut);
double direction = 1.0;
if (minX > maxX)
direction = -1.0;
bool prevOut = true;
int refrenceIndex = 0;
for (int i = 0; i < candles.Count; i++)
{
CandleChartData.CandleValue candle = candles[i];
double candleEnd = candle.Duration + candle.Start;
if (candleEnd* direction >= xScroll* direction && candle.Start* direction <= xOut* direction) // if the candle is within range
{
if (prevOut)
{
refrenceIndex = i;
prevOut = false;
}
result.Add(candle);
}
}
return refrenceIndex;
}
protected override void OnNonHoverted()
{
base.OnNonHoverted();
if (NonHovered != null)
NonHovered.Invoke();
}
protected override void OnItemSelected(object userData)
{
base.OnItemSelected(userData);
CandleEventArgs args = userData as CandleEventArgs;
if (CandleClicked != null)
CandleClicked.Invoke(args);
}
protected override void OnItemHoverted(object userData)
{
base.OnItemHoverted(userData);
CandleEventArgs args = userData as CandleEventArgs;
if (CandleHovered != null)
CandleHovered.Invoke(args);
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 8205d387a1db4a04c85ed37decb56caf
timeCreated: 1491152606
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,657 @@
#define Graph_And_Chart_PRO
using ChartAndGraph;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace ChartAndGraph
{
[Serializable]
public class CandleChartData : ScrollableChartData, IInternalCandleData
{
[Serializable]
public struct CandleValue
{
public CandleValue(double open, double high, double low, double close, DateTime start, TimeSpan duration)
{
Open = open;
High = high;
Low = low;
Close = close;
Start = ChartDateUtility.DateToValue(start);
Duration = ChartDateUtility.TimeSpanToValue(duration);
}
public CandleValue(double open, double high, double low, double close, double start, double duration)
{
Open = open;
High = high;
Low = low;
Close = close;
Start = start;
Duration = duration;
}
public double Open;
public double High;
public double Low;
public double Close;
public double Start;
public double Duration;
public bool isUp
{
get { return Close > Open; }
}
public double End
{
get { return Start + Duration; }
}
public DoubleVector2 MidPoint
{
get { return new DoubleVector2(Start + (Duration * 0.5), (Open + Close) * 0.5); }
}
public double Max
{
get
{
return Math.Max(Open, Close);
}
}
public double LowBound
{
get
{
return Math.Min(Math.Min(High, Low), Math.Min(Open, Close));
}
}
public double HighBound
{
get
{
return Math.Max(Math.Max(High, Low), Math.Max(Open, Close));
}
}
public double Min
{
get
{
return Math.Min(Open, Close);
}
}
}
[Serializable]
public class CandleSettings
{
public double LineThickness = 2.0;
public double CandleThicknessMultiplier = 1.0;
public double OutlineThickness = 0.0;
public ChartItemEffect CandleHoverPrefab;
public Material Outline;
public Material Line;
public Material Fill;
public GameObject CandlePrefab;
}
[Serializable]
public class CategoryData : BaseScrollableCategoryData
{
public List<CandleValue> Data = new List<CandleValue>();
public CandleSettings UpCandle = new CandleSettings();
public CandleSettings DownCandle = new CandleSettings();
public double Depth = 0f;
}
class CandleComparer : IComparer<CandleValue>
{
public int Compare(CandleValue x, CandleValue y)
{
if (x.Open < y.Open)
return -1;
if (x.Open > y.Open)
return 1;
return 0;
}
}
[Serializable]
class SerializedCategory
{
public string Name;
[HideInInspector]
public CandleValue[] Data;
[HideInInspector]
public double? MaxX, MaxY, MinX, MinY;
public CandleSettings UpCandle = new CandleSettings();
public CandleSettings DownCandle = new CandleSettings();
public double Depth = 0f;
}
CandleComparer mComparer = new CandleComparer();
[SerializeField]
SerializedCategory[] mSerializedData = new SerializedCategory[0];
event EventHandler IInternalCandleData.InternalViewPortionChanged
{
add
{
ViewPortionChanged += value;
}
remove
{
ViewPortionChanged -= value;
}
}
event EventHandler IInternalCandleData.InternalDataChanged
{
add
{
DataChanged += value;
}
remove
{
DataChanged -= value;
}
}
/// <summary>
/// rename a category. throws and exception on error
/// </summary>
/// <param name="prevName"></param>
/// <param name="newName"></param>
public void RenameCategory(string prevName, string newName)
{
if (prevName == newName)
return;
if (mData.ContainsKey(newName))
throw new ArgumentException(String.Format("A category named {0} already exists", newName));
CategoryData cat = (CategoryData)mData[prevName];
mData.Remove(prevName);
cat.Name = newName;
mData.Add(newName, cat);
RaiseDataChanged();
}
/// <summary>
/// Adds a new category to the candle chart.
/// </summary>
/// <param name="category"></param>
/// <param name="material"></param>
/// <param name="innerFill"></param>
public void AddCategory(string category, CandleSettings up, CandleSettings down, double depth)
{
AddCategory3DCandle(category, up, down, 0f);
}
/// <summary>
/// add category to the candle chart
/// </summary>
/// <param name="category"></param>
/// <param name="up"></param>
/// <param name="down"></param>
/// <param name="depth"></param>
public void AddCategory3DCandle(string category, CandleSettings up, CandleSettings down, double depth)
{
if (mData.ContainsKey(category))
throw new ArgumentException(String.Format("A category named {0} already exists", category));
CategoryData data = new CategoryData();
mData.Add(category, data);
data.Name = category;
data.DownCandle = down;
data.UpCandle = up;
data.Depth = depth;
RaiseDataChanged();
}
/// <summary>
/// removed a category from the DataSource. returnes true on success , or false if the category does not exist
/// </summary>
/// <param name="category"></param>
/// <returns></returns>
public bool RemoveCategory(string category)
{
return mData.Remove(category);
}
public void SetDownCandle(string category, CandleSettings down)
{
if (mData.ContainsKey(category) == false)
{
Debug.LogWarning("Invalid category name. Make sure the category is present in the chart");
return;
}
CategoryData data = (CategoryData)mData[category];
data.DownCandle = down;
RaiseDataChanged();
}
public void SetUpCandle(string category, CandleSettings up)
{
if (mData.ContainsKey(category) == false)
{
Debug.LogWarning("Invalid category name. Make sure the category is present in the chart");
return;
}
CategoryData data = (CategoryData)mData[category];
data.UpCandle = up;
RaiseDataChanged();
}
/// <summary>
/// sets the depth for a 3d graph category
/// </summary>
/// <param name="category"></param>
/// <param name="depth"></param>
public void Set3DCategoryDepth(string category, double depth)
{
if (mData.ContainsKey(category) == false)
{
Debug.LogWarning("Invalid category name. Make sure the category is present in the chart");
return;
}
if (depth < 0)
depth = 0f;
CategoryData data = (CategoryData)mData[category];
data.Depth = depth;
RaiseDataChanged();
}
/// <summary>
/// clears all the data for the selected category
/// </summary>
/// <param name="category"></param>
public void ClearCategory(string category)
{
if (mData.ContainsKey(category) == false)
{
Debug.LogWarning("Invalid category name. Make sure the category is present in the chart");
return;
}
mData[category].MaxX = null;
mData[category].MaxY = null;
mData[category].MinX = null;
mData[category].MinY = null;
((CategoryData)mData[category]).Data.Clear();
RaiseDataChanged();
}
/// <summary>
/// gets the candle at the specified index for a given category
/// </summary>
/// <param name="category"></param>
/// <param name="index"></param>
/// <returns></returns>
public int GetCandleCount(string category)
{
if (mData.ContainsKey(category) == false)
{
Debug.LogWarning("Invalid category name. Make sure the category is present in the chart");
return 0;
}
CategoryData data = (CategoryData)mData[category];
return data.Data.Count;
}
/// <summary>
/// gets the candle at the specified index for a given category
/// </summary>
/// <param name="category"></param>
/// <param name="index"></param>
/// <returns></returns>
public CandleValue GetCandle(string category, int index)
{
if (mData.ContainsKey(category) == false)
{
Debug.LogWarning("Invalid category name. Make sure the category is present in the chart");
return new CandleValue();
}
CategoryData data = (CategoryData)mData[category];
return data.Data[index];
}
/// <summary>
/// returns the total amount of candles in the given category
/// </summary>
/// <param name="category"></param>
/// <returns></returns>
public int GetTotalCandlesInCategory(string category)
{
if (mData.ContainsKey(category) == false)
{
Debug.LogWarning("Invalid category name. Make sure the category is present in the chart");
return 0;
}
CategoryData data = (CategoryData)mData[category];
return data.Data.Count;
}
/// <summary>
/// use this to modify candles in realtime.
/// </summary>
/// <param name="category"></param>
/// <param name="candle"></param>
public void ModifyCandleInCategory(string category, int candleIndex, double open, double high, double low, double close)
{
if (mData.ContainsKey(category) == false)
{
Debug.LogWarning("Invalid category name. Make sure the category is present in the chart");
return;
}
CategoryData data = (CategoryData)mData[category];
List<CandleValue> candles = data.Data;
if (candleIndex == -1)
candleIndex = data.Data.Count - 1;
if (candleIndex < 0 || candleIndex >= candles.Count)
{
Debug.LogWarning("Candle index is out of range, call is ignored");
return;
}
double candleMax = Math.Max(Math.Max(open, close), Math.Max(high, low));
double candleMin = Math.Min(Math.Min(open, close), Math.Min(high, low));
if (data.MaxY.HasValue == false || data.MaxY.Value < candleMax)
data.MaxY = candleMax;
if (data.MinY.HasValue == false || data.MinY.Value > candleMin)
data.MinY = candleMin;
CandleValue candle = data.Data[candleIndex];
candle.Open = open;
candle.Close = close;
candle.High = high;
candle.Low = low;
data.Data[candleIndex] = candle;
RaiseRealtimeDataChanged(candleIndex, category);
}
/// <summary>
/// removes a candle from a category
/// </summary>
/// <param name="category"></param>
/// <param name="index"></param>
public void RemoveCandleInCategory(string category, int candleIndex)
{
if (mData.ContainsKey(category) == false)
{
Debug.LogWarning("Invalid category name. Make sure the category is present in the chart");
return;
}
CategoryData data = (CategoryData)mData[category];
List<CandleValue> candles = data.Data;
if (candleIndex < 0 || candleIndex >= candles.Count)
{
Debug.LogWarning("Candle index is out of range, call is ignored");
return;
}
data.Data.RemoveAt(candleIndex);
RaiseRealtimeDataChanged(candleIndex, category);
}
/// <summary>
/// use this to modify candles in realtime. this overload modifies the last candle and can be used for realtime candle data stream
/// </summary>
/// <param name="category"></param>
/// <param name="candle"></param>
public void ModifyLastCandleInCategory(string category, double open, double high, double low, double close)
{
ModifyCandleInCategory(category, -1, open, high, low, close);
}
class Slider : BaseSlider
{
public string category;
public double from;
public int index;
public double to;
public double current;
public double y;
private CandleChartData mParent;
public Slider(CandleChartData parent)
{
mParent = parent;
}
public override DoubleVector2 Max
{
get
{
return new DoubleVector2(current, y);
}
}
public override DoubleVector2 Min
{
get
{
return new DoubleVector2(current, y);
}
}
public override string Category { get { return category; } }
public override int MinIndex
{
get { return index; }
}
public override bool Update()
{
BaseScrollableCategoryData baseData;
if (mParent.mData.TryGetValue(category, out baseData) == false)
return true;
double time = Time.time;
time -= StartTime;
if (Duration <= 0.0001f)
time = 1f;
else
{
time /= Duration;
Math.Max(0.0, Math.Min(time, 1.0));
}
current = from * (1.0 - time) + to * time;
if (time >= 1f)
{
mParent.ModifyMinMax(baseData, new DoubleVector3(current, y, 0.0));
return true;
}
return false;
}
}
/// <summary>
/// adds a point to the category. The points are sorted by their x value automatically
/// </summary>
/// <param name="category"></param>
/// <param name="point"></param>
public void AddCandleToCategory(string category, CandleValue candle, float autoScrollSlideTime = 0f)
{
if (mData.ContainsKey(category) == false)
{
Debug.LogWarning("Invalid category name. Make sure the category is present in the chart");
return;
}
CategoryData data = (CategoryData)mData[category];
List<CandleValue> candles = data.Data;
double start = candle.Start;
double end = candle.Start + candle.Duration;
double candleMax = Math.Max(Math.Max(candle.Open, candle.Close), Math.Max(candle.High, candle.Low));
double candleMin = Math.Min(Math.Min(candle.Open, candle.Close), Math.Min(candle.High, candle.Low));
if (autoScrollSlideTime <= 0f)
{
if (data.MaxX.HasValue == false || data.MaxX.Value < end)
data.MaxX = end;
}
if (data.MinX.HasValue == false || data.MinX.Value > start)
data.MinX = start;
if (data.MaxY.HasValue == false || data.MaxY.Value < candleMax)
data.MaxY = candleMax;
if (data.MinY.HasValue == false || data.MinY.Value > candleMin)
data.MinY = candleMin;
if (candles.Count > 0)
{
if (candles[candles.Count - 1].Start < candle.Start)
{
if (autoScrollSlideTime > 0f)
{
Slider s = new Slider(this);
s.category = category;
s.from = candles[candles.Count - 1].End;
s.to = end;
s.StartTime = Time.time;
s.Duration = autoScrollSlideTime;
s.y = (candleMax + candleMin) * 0.5;
s.index = candles.Count - 1;
mSliders.Add(s);
}
candles.Add(candle);
RaiseRealtimeDataChanged(candles.Count-1, category);
return;
}
}
int search = candles.BinarySearch(candle, mComparer);
if (search < 0)
search = ~search;
candles.Insert(search, candle);
RaiseRealtimeDataChanged(search, category);
}
double IInternalCandleData.GetMaxValue(int axis, bool dataValue)
{
return GetMaxValue(axis, dataValue);
}
double IInternalCandleData.GetMinValue(int axis, bool dataValue)
{
return GetMinValue(axis, dataValue);
}
public override void OnAfterDeserialize()
{
if (mSerializedData == null)
return;
mData.Clear();
mSuspendEvents = true;
for (int i = 0; i < mSerializedData.Length; i++)
{
SerializedCategory cat = mSerializedData[i];
if (cat.Depth < 0)
cat.Depth = 0f;
string name = cat.Name;
AddCategory3DCandle(name, cat.UpCandle, cat.DownCandle, cat.Depth);
CategoryData data = (CategoryData)mData[name];
data.Data.AddRange(cat.Data);
data.MaxX = cat.MaxX;
data.MaxY = cat.MaxY;
data.MinX = cat.MinX;
data.MinY = cat.MinY;
}
mSuspendEvents = false;
}
public override void OnBeforeSerialize()
{
List<SerializedCategory> serialized = new List<SerializedCategory>();
foreach (KeyValuePair<string, CategoryData> pair in mData.Select(x => new KeyValuePair<string, CategoryData>(x.Key, (CategoryData)x.Value)))
{
SerializedCategory cat = new SerializedCategory();
cat.Name = pair.Key;
cat.MaxX = pair.Value.MaxX;
cat.MinX = pair.Value.MinX;
cat.MaxY = pair.Value.MaxY;
cat.MinY = pair.Value.MinY;
cat.UpCandle = pair.Value.UpCandle;
cat.DownCandle = pair.Value.DownCandle;
cat.Depth = pair.Value.Depth;
cat.Data = pair.Value.Data.ToArray();
if (cat.Depth < 0)
cat.Depth = 0f;
serialized.Add(cat);
}
mSerializedData = serialized.ToArray();
}
public override BaseScrollableCategoryData GetDefaultCategory()
{
throw new NotImplementedException();
}
protected override void InnerClearCategory(string category)
{
throw new NotImplementedException();
}
protected override void AppendDatum(string category, MixedSeriesGenericValue value)
{
throw new NotImplementedException();
}
protected override void AppendDatum(string category, IList<MixedSeriesGenericValue> value)
{
throw new NotImplementedException();
}
protected override bool AddCategory(string category, BaseScrollableCategoryData data)
{
throw new NotImplementedException();
}
int IInternalCandleData.TotalCategories
{
get { return mData.Count; }
}
event Action<int,string> IInternalCandleData.InternalRealTimeDataChanged
{
add
{
RealtimeDataChanged += value;
}
remove
{
RealtimeDataChanged -= value;
}
}
IEnumerable<CategoryData> IInternalCandleData.Categories
{
get
{
return mData.Values.Select(x => (CategoryData)x);
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e8db3da49553a7d449f2082158192d56
timeCreated: 1491152608
licenseType: Store
MonoImporter:
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